Proposed XML Syntax for DQL

From: Richard Fikes (fikes@ksl.stanford.edu)
Date: 09/24/02

  • Next message: Mike Dean: "Joint Committee telecon today 24 September"
    Attached for your consideration and comment are some examples of DQL
    queries, answers, and answer bundles in an XML syntax.  We don't yet
    have the XML schema for the syntax.  We thought we would work with
    examples until there was some initial consensus.
    
    I am leaving on vacation today and probably will not be on today's
    telecon.  CC your comments on the XML syntax to Rob McCool, who is the
    KSL person developing it.
    
    Richard
    
    Q: (owns ?p ?c) (type ?c Car) (has-color ?c Red)
       must-bind ?p don't-bind ?c
    A: (exists ?c (and (owns Joe ?c) (type ?c Car) (has-color ?c Red)))
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#owns"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
        </rdf:Statement>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
          <rdf:predicate rdf:resource="rdf:type"/>
          <rdf:object rdf:resource="#Car"/>
        </rdf:Statement>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
          <rdf:predicate rdf:resource="#has-color"/>
          <rdf:object rdf:resource="#Red"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MustBindVars>
        <var:p/>
      </dql:MustBindVars>
      <dql:answerKBPattern>
        <dql:kbRef rdf:resource="http://joedata/joe.daml"/>
      </dql:answerKBPattern>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#owns"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
        </rdf:Statement>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
          <rdf:predicate rdf:resource="rdf:type"/>
          <rdf:object rdf:resource="#Car"/>
        </rdf:Statement>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#c"/>
          <rdf:predicate rdf:resource="#has-color"/>
          <rdf:object rdf:resource="#Red"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:answer>
        <dql:binding-set>
          <var:p rdf:resource="#Joe"/>
        </dql:binding-set>
      </dql:answer>
      <dql:continuation>
        <dql:none/>
      </dql:continuation>
    </dql:answerBundle>
    
    
    Q: (has-father Bill ?f)
       must-bind ?f
    A: No answers
    
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#Bill"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MustBindVars>
        <var:f/>
      </dql:MustBindVars>
      <dql:answerKBPattern>
        <dql:kbRef rdf:resource="http://billdata/bill.daml"/>
      </dql:answerKBPattern>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#Bill"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:continuation>
        <dql:none/>
      </dql:continuation>
    </dql:answerBundle>
    
    
    Q: (has-father Bill ?f)
       may-bind ?f (or don't-bind ?f)
    A: One answer (with no binding for ?f)
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#Bill"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MayBindVars>
        <var:f/>
      </dql:MayBindVars>
      <dql:answerKBPattern>
        <dql:kbRef rdf:resource="http://billdata/bill.daml"/>
      </dql:answerKBPattern>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#Bill"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:answer>
        <dql:binding-set>
        </dql:binding-set>
      </dql:answer>
      <dql:continuation>
        <dql:none/>
      </dql:continuation>
    </dql:answerBundle>
    
    
    Q: (has-father ?p ?f)
       must-bind: ?p ?f
    A: One answer for each known father
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MustBindVars>
        <var:p/>
        <var:f/>
      </dql:MustBindVars>
      <dql:answerKBPattern>
        <var:kb/>
      </dql:answerKBPattern>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:answer>
        <dql:binding-set>
          <var:p rdf:resource="#Bill"/>
          <var:f rdf:resource="#Joe"/>
          <var:kb rdf:resource="http://geneology.com/jones.daml"/>     
        </dql:binding-set>
      </dql:answer>
      <dql:answer>
        <dql:binding-set>
          <var:p rdf:resource="#Joe"/>
          <var:f rdf:resource="#Frank"/>
          <var:kb rdf:resource="http://geneology.com/jones.daml"/>     
        </dql:binding-set>
      </dql:answer>
      <dql:continuation>
        <dql:termination-token>
          <dql:none/>
        </dql:termination-token>
      </dql:continuation>
    </dql:answerBundle>
    
    
    Q: (has-father ?p ?f)
       must-bind ?p, may-bind ?f (or don't-bind ?f)
    A: One answer for each known person
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MustBindVars>
        <var:p/>
      </dql:MustBindVars>
      <dql:MayBindVars>
        <var:f/>
      </dql:MayBindVars>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="http://www.daml.org/2002/10/dql-variables#p"/>
          <rdf:predicate rdf:resource="#has-father"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:answer>
        <dql:binding-set>
          <var:p rdf:resource="#Bill"/>
          <var:f rdf:resource="#Joe"/>
        </dql:binding-set>
      </dql:answer>
      <dql:answer>
        <dql:binding-set>
          <var:p rdf:resource="#Joe"/>
          <var:f rdf:resource="#Frank"/>
        </dql:binding-set>
      </dql:answer>
      <dql:answer>
        <rdf:Description rdf:about="#Bill">
          <has-father rdf:resource="http://www.daml.org/2002/10/dql-variables#f"/>
        </rdf:Description>
      </dql:answer>
      <dql:continuation>
        <dql:termination-token>
          <dql:none/>
        </dql:termination-token>
      </dql:continuation>
    </dql:answerBundle>
    
    
    If C1 is a Seafood Course and W1 is a drink of C1, what color is W1?
    P: (type C1 Seafood-Course) (drink C1 W1)
    Q: (has-color W1 ?x)
       must-bind ?x
    A: White
    
    
    <dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
               xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:premise>
        <rdf:RDF>
          <rdf:Description rdf:about="#C1">
            <rdf:type rdf:resource="#Seafood-Course"/>
            <drink rdf:resource="#W1"/>
          </rdf:Description>
        </rdf:RDF>
      </dql:premise>
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#W1"/>
          <rdf:predicate rdf:resource="#has-color"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#x"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:MustBindVars>
        <var:x/>
      </dql:MustBindVars>
      <dql:answerKBPattern>
        <dql:kbRef rdf:resource="http://ontolingua.stanford.edu/wines.daml"/>
      </dql:answerKBPattern>
      <dql:answerSizeBound>5</dql:answerSizeBound>
    </dql:query>
    
    <dql:answerBundle xmlns:dql="http://www.daml.org/2002/10/dql-syntax#"
                      xmlns:var="http://www.daml.org/2002/10/dql-variables#">
      <dql:queryPattern>
        <rdf:Statement>
          <rdf:subject rdf:resource="#W1"/>
          <rdf:predicate rdf:resource="#has-color"/>
          <rdf:object rdf:resource="http://www.daml.org/2002/10/dql-variables#x"/>
        </rdf:Statement>
      </dql:queryPattern>
      <dql:answer>
        <dql:binding-set>
          <var:x rdf:resource="#White"/>
        </dql:binding-set>
      </dql:answer>
      <dql:continuation>
        <dql:termination-token>
          <dql:none/>
        </dql:termination-token>
      </dql:continuation>
    </dql:answerBundle>
    


    This archive was generated by hypermail 2.1.4 : 09/24/02 EDT