[Date Prev][Date Next]
Re: documents or examples on defining / adding a new syntax?
On Mon, 5 Aug 2013, Michael StrÃder wrote:
Zhang Weiwu wrote:
3. Do I need to design a new syntax at all? My requirement is the following:
I need a new syntax for ranged-values. Examples are:
- netWeight: 12~13kg
- ISOSensitivity: 800~1600
- heightAdjustableRange: 1.2m~1.5m
The spec of ranged-value is a numeric, optionally followed by a
measurement unit, followed by a tild as seperatorâ, followed by
The syntax needs its own comparison rules, so that you can filter a
range, and get entries who offer values ranging in that range.
Not exactly what you're after but have a look at slapo-constraint. Maybe you
can find some suitable regex patterns for your use-case.
Hmm, it would be handy to have min/max constraints for attribute types for
which an ORDERING matching rule is defined. So maybe extending
slapo-constraint would be the most flexible way of implementing ranges.
Thanks for the comment, but the problem your solution to solve is not the
one I face. I guess I wasn't clear enough.
I do not intend to constrain the value of attributes, but to store the
constraint into the value.
Perhaps it is best explained with examples. Say I want to find out all desks
that can adjust to exactly 1.4m, there are 3 entris:
And I do an inquiry, expect to get only MediumDesk and SmallDesk.
To reprise, there is no constraint to the value, but there are constraints
in the value.
There are 2 ways to solve it, I am unsure which is better. The first is to
design a new SYNTAX, apparently requiring coding a matching model.
The other method is to use multi-value INTEGER syntax:
And I can find my choice of desk by using:
Which should result the SmallDesk and MediumDesk.