On 14/1/06 2:48, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Chris Ridd wrote: >> <....> >> >> RFC 2252 and X.501 say that attributes can only have a single supertype. I'm >> not sure why our Schema class allows for multiple - maybe to cope with >> multiple names for a single supertype? >> >> There's no reason why couldn't define a subtype with different matching >> rules - if you don't define a matching rule then you should inherit the >> supertype's matching rule (which might inherit from the supertype's >> supertype etc etc). >> >> Cheers, >> >> Chris >> >> >> > Thanks for the info, the next snippet takes care of walking the > hierarchy, maybe it could be an extension to Net::LDAP::Schema ;-) > How should I deal with comparisons (le/ge) when there's no ordering > match specified ? > E.g. CN has only equality and substrings defined through Name and Name > has no superior.
X.501 says: --- If no ordering matching rule is indicated, the Directory shall treat any assertion of an ordering match using the syntax provided by the Directory Abstract Service as undefined. If no substrings matching rule is indicated, the Directory shall treat any assertion of a substring match using the syntax provided by the Directory Abstract Service as undefined. --- Rules for absent equality matching rules are a bit more complicated. > And in the same fashion, what to do with approx matches as 2252 does not > specify a declaration of approx filters ? Anything you like. Most implementations use something like Soundex, though this works pretty badly unless the values are English. Actually even with English the results aren't often that good. Maybe something more perl-ish would be interesting :-) > Cheers, > > Hans > <snippet> > # given the attribute and a matchtype (e.g. equality) this will return > the name of the rule to apply > > sub matchingruleforattribute{ > my $schema = shift; > my $attr = shift; > my $matchtype = shift; > > my $attrtype = $schema->attribute( $attr ); > if (exists $attrtype->{$matchtype}){ > return $attrtype->{$matchtype} ; > } > elsif (exists $attrtype->{'sup'}){ > # the assumption ( backed by RFC 2252 and X.501 ) is that all > superiors result in the same ruleset > return matchingruleforattribute( $schema, $attrtype->{'sup'}[0], > $matchtype); > } > return undef; > } That looks about right. Cheers, Chris