Introduction
This page describe the way schema are loaded into ADS. The schema are defined by the following document : RFC 4512 (wgich obsoletes the RFC 2252)
A schema defines two types of elements, accordingly to RFC 4512 :
- ObjectClasses
- AttributeTypes
Those two elements are used internally by ADS to check that an entry is valid, and to apply the correct rules to compare attributes, sort entries, check attributes, etc.
We have some relations between those elements, the OIDs, the element's names and the schema file's name. Here they are :
- A schema contains N ObjectClass and N AttributesType.
- An ObjectClass is contained by only one schema
- An AttributesType is contained by only one schema
- An OID is associated with N ObjectClass name
- An OID is associated with N AttributesType name
- A ObjectClass name is associated with only one OID
- A AttributesType name is associated with only one OID
- An ObjectClass name has only one OID
- An AttributesType name has only one OID
- An OID is associated with only one ObjectClass
- ... (To be continued)
The following diagram represent all those relations :
Actual grammar
The actual grammar used to parse schema is the following :
<WS> ::= ( '#' (~'\n')* '\n' | ' ' | '\t' | '\r' '\n' | '\n' | '\r' ) <QUOTE> ::= '\'' <DIGIT> ::= '0' .. '9' <DOLLAR> ::= '$' <OPEN_PAREN> ::= '(' <CLOSE_PAREN> ::= ')' <OPEN_BRACKET> ::= '{' <CLOSE_BRACKET> ::= '}' <NUMERIC_STRING> ::= ('0' .. '9')+ <NUMERICOID> ::= <NUMERIC_STRING ( '.' NUMERIC_STRING )+ <IDENTIFIER> ::= ( 'a' .. 'z') ( 'a' .. 'z' | '0' .. '9' | '-' | ';' )* <DESC> ::= "desc" <WS> <QUOTE> ( ~'\'' )+ <QUOTE> <SYNTAX> ::= "syntax" <WS> <NUMERICOID> ( <OPEN_BRACKET> ( <DIGIT> )+ <CLOSE_BRACKET> )? <parseSchema> ::= ( <attributeType> | <objectClass> )* <objectClass> ::= "objectclass" <OPEN_PAREN> <NUMERICOID> ( <objectClassNames> )? ( <objectClassDesc> )? ( "OBSOLETE" )? ( <objectClassSuperiors> )? ( "ABSTRACT" | "STRUCTURAL" | "AUXILIARY" )? ( <must> )? ( <may> )? <CLOSE_PAREN> <may> ::= "MAY" <woidlist> <must> ::= "MUST" <woidlist> <objectClassSuperiors> ::= "SUP" <woidlist> <woid> ::= ( <NUMERICOID> | <IDENTIFIER> ) <woidlist> ::= ( <woid> | ( <OPEN_PAREN> <woid> ( <DOLLAR> <woid> )* <CLOSE_PAREN> ) ) <objectClassDesc> ::= <DESC> <objectClassNames> ::= ( "NAME" ( <QUOTE> <IDENTIFIER> <QUOTE> | ( <OPEN_PAREN> <QUOTE> <IDENTIFIER> <QUOTE> ( <QUOTE> <IDENTIFIER> <QUOTE> )* <CLOSE_PAREN> ) ) ) <attributeType> ::= "attributetype" <OPEN_PAREN> <NUMERICOID> ( <names> )? ( <desc> )? ( "OBSOLETE" )? ( <superior> )? ( <equality> )? ( <ordering> )? ( <substr> )? ( <syntax> )? ( "SINGLE-VALUE" )? ( "COLLECTIVE" )? ( "NO-USER-MODIFICATION" )? ( <usage> )? <CLOSE_PAREN> <desc> ::= <DESC> <superior> ::= "SUP" ( <NUMERICOID> | <IDENTIFIER> ); <equality> ::= "EQUALITY" ( <NUMERICOID> | <IDENTIFIER> ); <substr> ::= "SUBSTR" ( <NUMERICOID> | <IDENTIFIER> ) <ordering> ::= "ORDERING" ( <NUMERICOID> | <IDENTIFIER> ) <names> ::= "NAME" ( <QUOTE> <IDENTIFIER> <QUOTE> | ( <OPEN_PAREN> ( <QUOTE> <IDENTIFIER> <QUOTE> )+ <CLOSE_PAREN> ) ) <syntax> ::= <SYNTAX> <usage> ::= "USAGE" ( "userApplications" | "directoryOperation" | "distributedOperation" | "dSAOperation" )
Future grammar
The next version should be a little bit more powerfull :
- it should use RFC 4512 grammar, which has extensions
- and it also should allow a less restrictive ordering of ObjectClass and AttributeType elements.
Lexical elements
Here are the lexical elements for this grammar :
<qdescrs> ::= <qdescr> | <LPAREN> <WSP> <qdescrlist> <WSP> <RPAREN> <qdescrlist> ::= ( <qdescr> ( <SP> <qdescr> )* )? <qdescr> ::= <SQUOTE> <descr> <SQUOTE> <qdstrings> ::= <qdstring> | <LPAREN> <WSP> <qdstringlist> <WSP> <RPAREN> <qdstringlist> ::= ( <qdstring> ( <SP> <qdstring> )* )? <qdstring> ::= <SQUOTE> <dstring> <SQUOTE> <dstring> ::= ( <QS> | <QQ> | <QUTF8> )+ <oids> ::= <oid> | <LPAREN> <WSP> <oidlist> <WSP> <RPAREN> <oidlist> ::= <oid> ( <WSP> <DOLLAR> <WSP> <oid> )* <extensions> ::= ( <SP> <xstring> <SP> <qdstrings> )* <noidlen> ::= <numericoid> ( <LCURLY> <number> <RCURLY> )?
and the lexical elements :
<xstring> ::= "X" <HYPHEN> ( <ALPHA> | <HYPHEN> | <USCORE> )+ <oid> ::= <descr> | <numericoid> <numericoid> ::= <number> ( <DOT> <number> )+ <descr> ::= <keystring> <keystring> ::= <leadkeychar> ( <keychar> )* <leadkeychar> ::= <ALPHA> <keychar> ::= <ALPHA> | <DIGIT> | <HYPHEN> <number> ::= <DIGIT> | <LDIGIT> ( <DIGIT> )* <ALPHA> ::= "A"-"Z" | "a"-"z" <DIGIT> ::= "0".."9" <LDIGIT> ::= "1".."9" <HEX> ::= "0".."9" | "A".."F" | "a".."f" <SP> ::= ( " " )+ <WSP> ::= ( " " )* <HYPHEN> ::= "-" <DOLLAR> ::= "$" <DOT> ::= "." <SQUOTE> ::= "'" <LPAREN> ::= "(" <RPAREN> ::= ")" <USCORE> ::= "_" <QQ> ::= "\27" <QS> ::= "\5C" | "\5c" <QUTF8> ::= <QUTF1> / <UTFMB> <QUTF1> ::= 0x00..0x26 | 0x28..0x5B | 0x5D..0x7F <UTFMB> ::= <UTF2> | <UTF3> | <UTF4> <UTF0> ::= 0x80..0xBF <UTF1> ::= 0x00..0x7F <UTF2> ::= 0xC2..0xDF <UTF0> <UTF3> ::= 0xE0 0xA0..0xBF <UTF0> | 0xE1..0xEC <UTF0> <UTF0>) | 0xED 0x80..0x9F <UTF0> | 0xEE..0xEF <UTF0> <UTF0> <UTF4> ::= 0xF0 0x90..0xBF <UTF0> <UTF0> | 0xF1..0xF3 <UTF0> <UTF0> <UTF0> | 0xF4 0x80..0x8F <UTF0> <UTF0>
ObjectClass object
The ObjectClass syntax is (as of RFC 4512) :
<ObjectClassDescription> ::= <LPAREN> <SP> <numericoid> <ocparameters> <extensions> <WSP> RPAREN // Each parameters should not be seen more than once <ocparameters> ::= ( <SP> "NAME" <SP> <qdescrs> | <SP> "DESC" <SP> <qdstring> | <SP> "OBSOLETE" | <SP> "SUP" <SP> <oids> | <SP> ( "ABSTRACT" | "STRUCTURAL" | "AUXILIARY" ) | <SP> "MUST" <SP> <oids> | <SP> "MAY" <SP> <oids> )+
AttributeType object
The AttributeType syntax is (as of RFC 4512) :
<AttributeTypeDescription> = <LPAREN> <WSP> <numericoid> <atparameters> <extensions> <WSP> <RPAREN> // Each parameters should not be seen more than once <atparameters> ::= <SP> "NAME" <SP> <qdescrs> | <SP> "DESC" <SP> qdstring | <SP> "OBSOLETE" | <SP> "SUP" <SP> <oid> | <SP> "EQUALITY" <SP> <oid> | <SP> "ORDERING" <SP> <oid> | <SP> "SUBSTR" <SP> <oid> | <SP> "SYNTAX" <SP> <noidlen> | <SP> "SINGLE-VALUE" | <SP> "COLLECTIVE" | <SP> "NO-USER-MODIFICATION" | <SP> "USAGE" <SP> <usage>