[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
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
another measurement.
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:
dn: model=BigDesk,dc=wood,dc=com
model: BigDesk
heightAdjustableRange: 1.6m~2m
dn: model=MediumDesk,dc=wood,dc=com
model: MediumDesk
heightAdjustableRange: 1.3m~1.8m
dn: model=SmallDesk,dc=wood,dc=com
model: SmallDesk
heightAdjustableRange: 1.1m~1.5m
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:
dn: model=BigDesk,dc=wood,dc=com
model: BigDesk
possibleHeightInCM: 160
possibleHeightInCM: 200
dn: model=MediumDesk,dc=wood,dc=com
model: MediumDesk
possibleHeightInCM: 130
possibleHeightInCM: 180
dn: model=SmallDesk,dc=wood,dc=com
model: SmallDesk
possibleHeightInCM: 110
possibleHeightInCM: 150
And I can find my choice of desk by using:
(&(possibleHeightInCM>=140)(possibleHeightInCM<=140))
Which should result the SmallDesk and MediumDesk.