1 Reply Latest reply on Apr 29, 2008 7:53 PM by alwu-Oracle

    user defined rules

    617912
      Hi all,

      I have this ontology:
      <?xml version="1.0" encoding="UTF-8"?>

      <rdf:RDF
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xml:base="http://www.oracle.com#">

        <owl:Class rdf:ID="Transport">
        </owl:Class>

        <owl:Class rdf:ID="LandTransport">   
        </owl:Class>

        <owl:Class rdf:ID="AirTransport">
          <rdfs:subClassOf rdf:resource="#Transport"/>
        </owl:Class>

        <owl:Class rdf:ID="Bus">
          <rdfs:subClassOf rdf:resource="#LandTransport"/>
        </owl:Class>

        <owl:Class rdf:ID="Car">
          <rdfs:subClassOf rdf:resource="#LandTransport"/>
        </owl:Class>

      </rdf:RDF>
      In the above ontology: Bus, Car are subclasses of LandTransport and AirTransport is a subclass of Transport.

      Now I wrote a rule:
      insert into mdsys.rdfr_testRuleBase values( 'testRule1' , 
                                       '(?x rdfs:subClassOf ns1:LandTransport)' ,
                                        null  ,
                                        '(?x rdfs:subClassOf ns1:Transport)' ,
                                        sdo_rdf_aliases( sdo_rdf_alias('ns1' , 'http://www.oracle.com#'),
                                                   sdo_rdf_alias('rdfs' , 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
                                                  )
                                    );
      The rule states that any resource that is a subclass of LandTransport is also a subclass of Transport, i.e, Bus and Car should become subclasses of Transport.

      Now my query is:
      select x from table
      (
        sdo_rdf_match(
                    '(?x rdfs:subClassOf ns1:Transport)',
                    sdo_rdf_models('test' ),
                    sdo_rdf_rulebases('rdfs' , 'testRuleBase'),
                    sdo_rdf_aliases( sdo_rdf_alias('ns1' , 'http://www.oracle.com#') ),
                    null
                  )
      );
      So, I am expecting Bus, Car, AirTransport as the results. But it is returning AirTransport only. Can any one explain why this is happening?

      Thanks,
      Rajesh.