[Ietf-not43] how to scare small children

Andrew Newton anewton at ecotroph.net
Thu Sep 11 13:26:03 EDT 2003


               How To Scare Small Children:
Using Generalized Query Mechanisms As Frightening Devices
---------------------------------------------------------

Because the question of using a generalized query mechanism in
IRIS has surfaced, I have taken the time to put together what
one could look like.  As stated previously, it is not that IRIS
cannot do it, it is simply that it has not been done.

Attached is a set of samples of the generalized query syntax
and the XML Schema defining the formal syntax.  I believe this
to be at least comparably powerful to LDAP's query syntax.

WARNING: Just because it CAN be done, does not mean that it
SHOULD be done.  The point of this excercise is to show that
the necessary expressiveness is at our ready.

Personally, I'd favor a much more scaled back version of
this to solve the corner cases, if at all.

-andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: greg-request.xml
Type: text/xml
Size: 4019 bytes
Desc: not available
Url : http://lists.verisignlabs.com/pipermail/ietf-not43/attachments/20030911/2a1b21bd/greg-request-0001.xml
-------------- next part --------------
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:greg="urn:ietf:params:xml:ns:greg1"
        xmlns:iris="urn:ietf:params:xml:ns:iris1"
        targetNamespace="urn:ietf:params:xml:ns:greg1"
        elementFormDefault="qualified" >

  <import namespace="urn:ietf:params:xml:ns:iris1" />

  <annotation>
    <documentation>
      General registry schema 
      derived from IRIS schema 
    </documentation>
  </annotation>

  <!--             -->
  <!-- Query types -->
  <!--             -->

  <!-- find Object query               -->
  <!-- This is an interesting academic -->
  <!-- notion but a horrible idea.     -->
  <!-- It is provided to show that     -->
  <!-- this sort of thing can be done. -->
  
  <complexType name="findObjectsType">
    <complexContent>
      <extension base="iris:queryType">
        <sequence>

          <!-- 'of result type'           -->
          <!-- specifies which types of   -->
          <!-- entities should be         -->
          <!-- returned.  The values of   -->
          <!-- QName must be derivatives  -->
          <!-- of iris:result.            -->
          
          <element 
            name="ofResultType"
            type="greg:qnameListType"
            minOccurs="0" 
            maxOccurs="1" />

          <choice
            minOccurs="0" 
            maxOccurs="1" >

            <!-- 'by constraints'           -->
            <!-- specifies that the search  -->
            <!-- is to be narrowed by a set -->
            <!-- of constraints.            -->
            <!-- Such constraints are of    -->
            <!-- nature 'is value of x      -->
            <!-- greater than y', etc...    -->
            
            <element
              name="byConstraints"
              type="greg:byConstraintsType" />

            <!-- 'by search function'       -->
            <!-- specifies that the search  -->
            <!-- is to be narrowed by a     -->
            <!-- specific search function   -->
            <!-- that is defined locally.   -->
			      
			      <element
			        name="bySearchFunction"
			        type="greg:bySearchFunctionType" />

          </choice>

          <!-- 'with reference'                       -->
          <!-- allows for the expression of narrowing -->
          <!-- a search via the relationships objects -->
          <!-- have with one another. The selection   -->
          <!-- of the references can also be narrowed -->
          <!-- by constraints or by locally defined   -->
          <!-- search functions. The reference itself -->
          <!-- can be  narrowed with the              -->
          <!-- 'toResultType' (to result type) and    -->
          <!-- the 'asRoleType' (as role type)        -->
          <!-- attributes.  'toResultType' specifies  -->
          <!-- a reference to a type of entity where  -->
          <!-- as 'asRoleType' specifies how the      -->
          <!-- entity is related.                     -->
          
          <element
            name="withReference"
            minOccurs="0" maxOccurs="unbounded" >
            <complexType>
              <choice
                minOccurs="0" 
                maxOccurs="1" >
			          <element
			            name="byConstraints"
			            type="greg:byConstraintsType" />
			          <element
			            name="bySearchFunction"
			            type="greg:bySearchFunctionType" />
              </choice>
              <attribute
                name="toResultType"
                type="QName" />
              <attribute
                name="asRoleType"
                type="QName" />
            </complexType>
          </element>

        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="findObjects"
    type="greg:findObjectsType"
    substitutionGroup="iris:query" />

  <simpleType name="qnameListType">
    <list itemType="QName" />
  </simpleType>

  <complexType name="byConstraintsType">
    <sequence>
      <element
        name="not"
        minOccurs="0"
        maxOccurs="1">
        <complexType />
      </element>
      <element
        name="constraint"
        type="greg:constraintType" />
      <choice
        minOccurs="0"
        maxOccurs="unbounded">
        <choice>
          <element
            name="and">
            <complexType />
          </element>
          <element
            name="or">
            <complexType />
          </element>
        </choice>
	      <element
	        name="not"
	        minOccurs="0"
	        maxOccurs="1">
	        <complexType />
	      </element>
        <element
          name="constraint"
          type="greg:constraintType" />
      </choice>
    </sequence>
  </complexType>

  <complexType name="constraintType">
    <choice>
      <element
        name="before"
        type="dateTime" />
      <element
        name="after"
        type="dateTime" />
      <sequence>
	      <element
	        name="beginsWith"
	        type="normalizedString" 
	        minOccurs="1" maxOccurs="1"/>
	      <element
	        name="endsWith"
	        type="normalizedString" 
	        minOccurs="0" maxOccurs="1"/>
      </sequence>
      <element
        name="exactMatch"
        type="normalizedString" />
      <element
        name="containsToken"
        type="token" />
      <element
        name="greaterThan"
        type="integer" />
      <element
        name="lessThan"
        type="integer" />
      <element
        name="equalTo"
        type="integer" />
      <element
        name="greaterThanOrEqualTo"
        type="integer" />
      <element
        name="lessThanOrEqualTo"
        type="integer" />
      <element
        name="is"
        type="boolean" />
      <element
        name="doesExist">
        <complexType />
      </element>
      <element
        name="doesNotExist">
        <complexType />
      </element>
    </choice>
    <attribute
      name="type"
      type="QName" 
      use="required" />
  </complexType>

  <complexType name="bySearchFunctionType">
    <sequence>
      <element name="parameter">
        <complexType>
          <choice
            minOccurs="1"
            maxOccurs="unbounded" >
            <element
              name="boolean"
              type="boolean" />
            <element
              name="dateTime"
              type="dateTime" />
            <element
              name="integer"
              type="integer" />
            <element
              name="token"
              type="token" />
            <element
              name="undefinedStringData"
              type="string" />
            <element
              name="undefinedBinaryData"
              type="base64Binary" />
            <element
              name="valueOfObjectProperty">
              <complexType />
            </element>
          </choice>
          <attribute
            name="name"
            type="QName"
            use="required" />
        </complexType>
      </element>
    </sequence>
    <attribute
      name="name"
      type="QName"
      use="required" />
  </complexType>

  <!--              -->
  <!-- Result types -->
  <!--              -->

  <complexType name="generalObjectType">
    <complexContent>
      <extension base="iris:resultType">
        <sequence>
          <element
            name="property"
            minOccurs="1" maxOccurs="unbounded">
            <complexType>
              <sequence>
                <choice
                  minOccurs="1" maxOccurs="unbounded">
                  <element
                    name="boolean"
                    type="boolean" />
                  <element
                    name="integer"
                    type="integer" />
                  <element
                    name="dateTime"
                    type="dateTime" />
                  <element
                    name="string"
                    type="normalizedString" />
                  <element
                    name="binaryData"
                    type="base64Binary" />
                  <element
                    name="uri"
                    type="anyURI" />
                </choice>
              </sequence>
            </complexType>
          </element>
          <element name="relation"
            minOccurs="0" maxOccurs="unbounded" >
            <complexType>
              <sequence>
                <element ref="iris:entity" 
                  minOccurs="1" maxOccurs="unbounded" />
              </sequence>
              <attribute
                name="type"
                type="QName" />
            </complexType>
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="generalObject"
    type="greg:generalObjectType"
    substitutionGroup="iris:result" />

</schema>


More information about the Ietf-not43 mailing list