DQL Examples

From: Richard Fikes ([email protected])
Date: 06/25/02

  • Next message: Frank van Harmelen: "Re: DQL Examples"
    Here are a couple of query examples for today's discussion.  These
    examples are intended to be illustrative of aspects of the current
    design of DQL rather than being illustrative of typical query-answering
    cases.
    
    The first example illustrates answers that contain bindings for only
    some of the "may bind" variables in cases where an answer is inferable
    (from a min-cardinalityQ restriction in the example) and where an answer
    is an anonymous node.
    
    KB0:
    
    * Class "Red-Car".
    
    * Class "Red-Car-Owner" with a min-cardinalityQ restriction of 1 and
    hasClassQ "Red-Car" on property "has-car" (i.e., every Red-Car-Owner has
    at least one car that is a Red-Car).
    
    * (type RC1 Red-Car)
    
    * (has-car Bill RC1)
    
    * (type Joe Red-Car-Owner)
    
    * (has-car Fred _:r)
    
    * (type _:r Red-Car)
    
    QUERY-01:
    
    query pattern: (has-car ?p ?c) (type ?c Red-Car)
    must bind: ?p ?c
    answer KB: KB0
    
    One answer: {[?p/Bill], [?c/RC1]}
    
    QUERY-02:
    
    query pattern: (has-car ?p ?c) (type ?c Red-Car)
    may bind: ?p ?c
    answer KB: KB0
    
    Three answers: {[?p/Bill], [?c/RC1]}, {[?p/Joe]}, and {[?p/Fred]}
    
    QUERY-03:
    
    query pattern: (has-car ?p ?c) (type ?c Red-Car)
    may bind: ?p
    don't bind: ?c
    answer KB: KB0
    
    Three answers: {[?p/Bill]}, {[?p/Joe]}, and {[?p/Fred]}
    
    ------------------------------------
    
    This is an example of an answer being inferable from the existence of an
    instance of a class and a cardinality restriction.
    
    KB1:
    
    * Class "Country".
    
    * Class "Person" with a cardinality restriction of 1 and a valueType
    restriction of "Country" on property "country-of-birth" (i.e., every
    person has exactly one country-of-birth and a person's country-of-birth
    is a Country).
    
    * (type Bill Person)
    
    QUERY-11: 
    
    query pattern: (type ?x Country)
    must bind: ?x
    answer KB: KB1
    
    No answers.
    
    QUERY-12: 
    
    query pattern: (type ?x Country)
    may bind: ?x
    answer KB: KB1
    
    Query has one answer.  The answer has an empty set of bindings.  The
    answer corresponds to a proof that since there is a person and that
    person has a "country-of-birth" that is a Country, then there exists a
    Country (i.e., an ?x such that ?x is type Country).
    
    QUERY-13: 
    
    query pattern: (type ?x Country)
    don't bind: ?x
    answer KB: KB1
    
    Query has one answer.  The answer has an empty set of bindings.  As with
    QUERY-2, the answer corresponds to a proof that since there is a person
    and that person has a "country-of-birth" that is a Country, then there
    exists a Country (i.e., an ?x such that ?x is type Country).
    


    This archive was generated by hypermail 2.1.4 : 06/25/02 EDT