XML Schema for User-defined Lexer Query Procedure
This section describes additional constraints imposed on the XML document returned by the user-defined lexer query procedure. The XML document returned must be valid with respect to the following XML Schema:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="tokens">
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="num" type="QueryTokenType"/>
<xsd:group ref="QueryCompositeGroup"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!--
Enforce constraint that compMem element must be preceeded by word element
or compMem element for query
-->
<xsd:group name="QueryCompositeGroup">
<xsd:sequence>
<xsd:element name="word" type="QueryTokenType"/>
<xsd:element name="compMem" type="QueryTokenType" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:group>
<!--
QueryTokenType defines an element with content and with an optional attribute
-->
<xsd:complexType name="QueryTokenType">
<xsd:simpleContent>
<xsd:extension base="xsd:token">
<xsd:attribute name="wildcard" type="WildcardType" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="WildcardType">
<xsd:restriction base="WildcardBaseType">
<xsd:minLength value="1"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="WildcardBaseType">
<xsd:list>
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:maxInclusive value="378"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:list>
</xsd:simpleType>
</xsd:schema>
Here are some of the constraints imposed by this XML Schema:
-
The
rootelement is tokens. This is mandatory. It has no attributes. -
The
rootelement can have zero or more child elements. The child elements can be one of the following elements:numandword. Each of these represent a specific type of token. -
The
compMemelement must be preceded by awordelement or acompMemelement.The purpose of
compMemis to enableUSER_LEXERqueries to return multiple forms for a single query. For example, if a user-defined lexer indexes the word bank asBANK(FINANCIAL)andBANK(RIVER), the query procedure can return the first term as awordand the second as acompMemelement:
<tokens>
<word>BANK(RIVER)</word>
<compMem>BANK(FINANCIAL)</compMem>
</tokens>
SeeTable 2-35, “Table 2-35” for more on the compMem element.
-
The num and word elements have a single optional attribute: wildcard. Oracle Text will normalize the content of these elements as follows: convert whitespace characters to space characters, collapse adjacent space characters to a single space character, remove leading and trailing spaces, perform entity reference replacement, and truncate to 255 bytes.
-
The wildcard attribute value is a white-space separated list of integers. The minimum number of integers is 1 and the maximum number of integers is 64. The value of the integers must be between 0 and 378 inclusive. The intriguers in the list can be in any order.
Table 2-33 describes the element types defined in the preceding XML Schema. Table 2-35 describes the attribute defined in the preceding XML Schema.
Table 35 User-defined Lexer Query Procedure XML Schema Attributes
| Attribute | Description |
|---|---|
compMem |
Same as the word element, but its implicit word offset is the same as the previous word token. Oracle Text will equate this token with the previous word token and with subsequent compMem tokens using the query EQUIV operator. |
wildcard |
Any The offset of the first character in the content of the element is 0. Offset information follows USC-2 codepoint semantics. If the token does not contain any wildcard characters then this attribute must not be specified. |
Examples
Query word: pseudo-%morph%
Tokens:
<tokens>
<word> PSEUDO </word>
<word wildcard="1 7"> %MORPH% </word>
</tokens>
Query word: <%>
Tokens:
<tokens>
<word wildcard="5"> <%> </word>
</tokens>