How to use the Taxonomy Querying System of OO jDREW

How to Input a Taxonomy

     There are two different methods to define a Taxonomy (RDFS/XML subClassOf). One way is to use RDFS/XML to define the taxonomy. The other way to define a taxonomy is to use the RuleML/POSL syntax of subsumes(superClass, subClass). This also comes with a RuleML/XML syntax.

     All of the examples shown will be based on the following taxonomy diagram. The artificial class Thing at the top of the directed labeled graph is used to show that every class has a superClass of type "Thing". As well as the artificial Nothing is used to show that every class is a subClass of "Nothing".




RuleML/POSL Syntax

     How to write the RuleML/POSL syntax for types is explained in the next few lines.

     subsumes(superClass, subClass).

     Where superClass is the superClass in the relation and subClass is the sub class in the relation. The predicate subsumes means that the superClass can subsume the subClass.

     The RuleML/POSL syntax for the illustrated Taxonomy can be defined in the following RuleML/POSL facts:

% Taxonomy Facts:

subsumes(Vehicle,PassengerVehicle).
subsumes(Vehicle,Van).
subsumes(PassengerVehicle,Car).
subsumes(PassengerVehicle,MiniVan).
subsumes(Van,MiniVan).
subsumes(Car,Sedan).
subsumes(Car,SportsCoupe).
subsumes(Sedan,ToyotaCorolla).

RDFS/XML Syntax

     The above taxonomy can be defined in RDFS/XML by the following schema:
<rdf:RDF 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://example.org/schemas/vehicles"> <rdf:Description rdf:ID="Vehicle"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> </rdf:Description> <rdf:Description rdf:ID="PassengerVehicle"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Vehicle"/> </rdf:Description> <rdf:Description rdf:ID="Van"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Vehicle"/> </rdf:Description> <rdf:Description rdf:ID="Car"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#PassengerVehicle"/> </rdf:Description> <rdf:Description rdf:ID="MiniVan"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Van"/> <rdfs:subClassOf rdf:resource="#PassengerVehicle"/> </rdf:Description> <rdf:Description rdf:ID="Sedan"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Car"/> </rdf:Description> <rdf:Description rdf:ID="SportsCoupe"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Car"/> </rdf:Description> <rdf:Description rdf:ID="ToyotaCorolla"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Sedan"/> </rdf:Description> </rdf:RDF>

How to Query the Taxonomy

    There are 10 different ways to query the Taxonomy.

  1. To test if two classes are in a direct super/sub class relationship then the following query is used:

    In POSL Syntax:

    subsumes(superClass,subClass).

    In RuleML Syntax:
    <Subsumes>
       <Rel>superClass</Rel>
       <Rel>subClass</Rel>
    </Subsumes>
    

  2. To test if two classes are in a indirect (transitive closure) super/sub class relationship then the following query is used:

    In POSL Syntax:

    subsumesPlus(superClass,subClass).

    In RuleML Syntax:
    <SubsumesPlus>
       <Rel>superClass</Rel>
       <Rel>subClass</Rel>
    </SubsumesPlus>
    

  3. To find all of the direct subClasses of a class the following query is used:

    In POSL Syntax:

    subsumes(superClass, ?subClass).

    In RuleML Syntax:
    <Subsumes>
       <Rel>superClass</Rel>
       <Var>subClass</Var>
    </Subsumes>
    

  4. To find all of subClasses of a class in the transitive closure the following query is used:

    In POSL Syntax:

    subsumesPlus(superClass, ?subClass).

    In RuleML Syntax:
    <SubsumesPlus>
       <Rel>superClass</Rel>
       <Var>subClass</Var>
    </SubsumesPlus>
    

  5. To find all of the direct superClasses of a class the following query is used:

    In POSL Syntax:

    subsumes(?superClass, subClass).

    In RuleML Syntax:
    <Subsumes>
       <Var>superClass</Var>
       <Rel>subClass</Rel>
    </Subsumes>
    

  6. To find all of superClasses of a class in the transitive closure the following query is used:

    In POSL Syntax:

    subsumesPlus(?superClass, subClass).

    In RuleML Syntax:
    <SubsumesPlus>
       <Var>superClass</Var>
       <Rel>subClass</Rel>
    </SubsumesPlus>
    

  7. To find all direct super/sub class relationships for every class in the taxonomy the following query is used:

    In POSL Syntax:

    subsumes(?superClass, ?subClass).

    In RuleML Syntax:
    <Subsumes>
       <Var>superClass</Var>
       <Var>subClass</Var>
    </Subsumes>
    

  8. To find all indirect (transitive closure) super/sub class relationships for every class in the taxonomy the following query is used:

    In POSL Syntax:

    subsumesPlus(?superClass, ?subClass).

    In RuleML Syntax:
    <SubsumesPlus>
       <Var>superClass</Var>
       <Var>subClass</Var>
    </SubsumesPlus>
    

  9. To find the least upper bound of a set of classes the following is used (Relational):

    In POSL Syntax:

    lub(?result,class1,class2,class3,...,classN).

    In RuleML Syntax:
    <LUB>
       <Var>result</Var> 
       <Rel>class1</Rel>
       <Rel>class2</Rel>
       <Rel>class3</Rel>
       ................
       <Rel>classN</Rel>
    </LUB>
    

  10. To find the greater lower bound of a set of classes the following is used (Relational):

    In POSL Syntax:

    glb(?result,class1,class2,class3,...,classN).

    In RuleML Syntax:
    <GLB>
       <Var>result</Var> 
       <Rel>class1</Rel>
       <Rel>class2</Rel>
       <Rel>class3</Rel>
       ................
       <Rel>classN</Rel>
    </GLB>
    

How to input the taxonomy into OO jDREW

To input the taxonomy you must first select the format you want to use, either POSL format or RDFS. You can then copy and paste your taxonomy into the text area. Once your taxonomy has been placed in the text area then you must press the "Load Type Information" button.







Examples of Querying the Taxonomy with POSL

Once the taxonomy information has been parsed, switch to the "Type Query" pane to query the taxonomy.

  1. subsumes(Vehicle, Car).

    Since a Vehicle is not a direct superClass of Car OO jDREW will return false.



  2. subsumesPlus(Vehicle, Car).

    Since a Vehicle is a superClass of Car in the transitive closure OO jDREW will return true.



  3. subsumes(Car, ?X).

    In this query, OO jDREW will bind ?X to all of the direct subClasses of the class Car. The first solution OO jDREW finds is Sedan, while the next solution would be bound to SportsCoupe.



  4. subsumesPlus(Car, ?X).

    In this query, OO jDREW will bind ?X to all of the classes below Car in the transitive closure. So ?X would be bound to the following: Sedan, SportsCoupe, and ToyotaCorolla.



  5. subsumes(?X, MiniVan).

    In this query, OO jDREW will bind ?X to all of the direct superClasses of MiniVan. The bindings of ?X are as follows: Van and PassengerVehicle. MiniVan is in the scope of multiple inheritance, since it is both a Van and a PassengerVehicle.



  6. subsumesPlus(?X, MiniVan).

    In this query, OO JDREW will bind ?X to all of the superClasses of MiniVan in the transitive closure. ?X will bind to the following classes: Vehicle, Van, and PassengerVehicle.



  7. subsumes(?X, ?Y).

    This query will return all of the direct subClass and superClass relations stored in the taxonomy.



  8. subsumesPlus(?X, ?Y).

    This query will return all of the subClass and superClass relations inferred by the transitive closure.



  9. lub(?Result, SportsCoupe, ToyotaCorolla, MiniVan).

    The least upper bound of a SportsCoupe, ToyotaCorolla, and MiniVan is a passenger vehicle. I.e PassengerVehicle is the smallest class above SportsCoupe, ToyotaCorrla, and MiniVan. The result is bound to a variable.



  10. glb(?Result, PassengerVehicle, Van).

    The greast lower bound of PassengerVehicle and Van is a MiniVan. I.e, MiniVan directly inherits from both a Van and a PassengerVehicle. The Result is bound to a variable.



  11. glb(?x,Car,Van).

    The greast lower bound of Car and Van is Nothing. I.e, No class inherits from Van and Car. The Result is bound to a variable.



Examples of Querying the Taxonomy with RuleML

Once the taxonomy information has been parsed, switch to the "Type Query" pane to query the taxonomy.
  1. <Subsumes>
       <Rel>Vehicle</Rel>
       <Rel>Car</Rel>
    </Subsumes>
    
    Since a Vehicle is not a direct superClass of Car OO jDREW will return false.



  2. <SubsumesPlus>
       <Rel>Vehicle</Rel>
       <Rel>Car</Rel>
    </SubsumesPlus>
    
    Since a Vehicle is a superClass of Car in the transitive closure OO jDREW will return true.



  3. <Subsumes>
       <Rel>Car</Rel>
       <Var>X</Var>
    </Subsumes>
    
    In this query, OO jDREW will bind ?X to all of the direct subClasses of the class Car. The first solution OO jDREW finds is Sedan, while the next solution would be bound to SportsCoupe.



  4. <SubsumesPlus>
       <Rel>Car</Rel>
       <Var>X</Var>
    </SubsumesPlus>
    
    In this query, OO jDREW will bind ?X to all of the classes below Car in the transitive closure. So ?X would be bound to the following: Sedan, SportsCoupe, and ToyotaCorolla.



  5. <Subsumes>
       <Var>X</Var>
       <Rel>MiniVan</Rel>
    </Subsumes>
    
    In this query, OO jDREW will bind ?X to all of the direct superClasses of MiniVan. The bindings of ?X are as follows: Van and PassengerVehicle. MiniVan is in the scope of multiple inheritance, since it is both a Van and a PassengerVehicle.



  6. <SubsumesPlus>
       <Var>X</Var>
       <Rel>MiniVan</Rel>
    </SubsumesPlus>
    
    In this query, OO JDREW will bind ?X to all of the superClasses of MiniVan in the transitive closure. ?X will bind to the following classes: Vehicle, Van, and PassengerVehicle.



  7. <Subsumes>
       <Var>X</Var>
       <Var>Y</Var>
    </Subsumes>
    
    This query will return all of the direct subClass and superClass relations stored in the taxonomy.



  8. <SubsumesPlus>
       <Var>X</Var>
       <Var>Y</Var>
    </SubsumesPlus>
    
    This query will return all of the subClass and superClass relations inferred by the transitive closure.



  9. <LUB>
       <Var>Result</Var>
       <Rel>SportsCoupe</Rel>
       <Rel>ToyotaCorolla</Rel>
       <Rel>MiniVan</Rel>
    </LUB>
    
    The least upper bound of a SportsCoupe, ToyotaCorolla, and MiniVan is a passenger vehicle. I.e PassengerVehicle is the smallest class above SportsCoupe, ToyotaCorrla, and MiniVan. The result is bound to a variable.



  10. <GLB>
       <Var>Result</Var>
       <Rel>PassengerVehicle</Rel>
       <Rel>Van</Rel>
    </GLB>
    
    The greast lower bound of PassengerVehicle and Van is a MiniVan. I.e, MiniVan directly inherits from both a Van and a PassengerVehicle. The Result is bound to a variable.



  11. <GLB>
       <Var>Result</Var>
       <Rel>Car</Rel>
       <Rel>Van</Rel>
    </GLB>
    
    The greast lower bound of Car and Van is Nothing. I.e, No class inherits from Van and Car. The Result is bound to a variable.



Last Updated:
   July 30, 2008

By:
   Ben Craig