5 Replies Latest reply on Jan 20, 2009 8:35 PM by alwu-Oracle

    SWRL in Oracle

    673499
      Hi... im a newbie in Semantic...
      I've used Protege to develop Semantic Web Application.... but it's based on RDF/XML file..
      I'm interested in Database Semantic...
      I know in Oracle 11g has feature deal with Semantic ... but is there a way for me to create SWRL builtin function in Oracle Layer...?
        • 1. Re: SWRL in Oracle
          alwu-Oracle
          Hi,

          What specific SWRL built in expressions are you looking for? We may be able to provide you similar support through user-defined rules.

          Cheers,

          Zhe Wu
          • 2. Re: SWRL in Oracle
            673499
            Thanks Alwu for Your Reply...

            I'm trying to create user defined rule function and bind variable in rule syntax, but i dont know how to do that in
            Oracle Db. I did that successfully when i tried in Jena and using RDF/XML File...
            For example i have such RDF/XML file like this :

            <?xml version="1.0"?>
            <rdf:RDF
            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:owl="http://www.w3.org/2002/07/owl#"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
            xmlns="http://www.owl-ontologies.com/Ontology1230795417.owl#"
            xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
            xml:base="http://www.owl-ontologies.com/Ontology1230795417.owl">
            <owl:Ontology rdf:about=""/>
            <owl:Class rdf:ID="Example"/>
            <owl:FunctionalProperty rdf:ID="has_factorialvalue">
            <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
            <rdfs:domain rdf:resource="#Example"/>
            <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
            </owl:FunctionalProperty>
            <owl:FunctionalProperty rdf:ID="has_value">
            <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
            <rdfs:domain rdf:resource="#Example"/>
            <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
            </owl:FunctionalProperty>
            <Example rdf:ID="Example_1">
            <has_value rdf:datatype="http://www.w3.org/2001/XMLSchema#int" >5</has_value>
            </Example>
            <Example rdf:ID="Example_2">
            <has_value rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</has_value>
            </Example>
            </rdf:RDF>


            I have one Class "Example" which has 2 datatype properties : has_value and has_factorial_value, So if I have
            an Example1 as an instance of Example which has_value is 5 then has_factorial_value must be 120.

            So the Rule is

            [exampletestrule1: (?b rdf:type h:Example) (?b h:has_value ?z) myfactorial(?z,?rs) -> (?b h:has_factorialvalue ?rs) ]

            Here for the [source code|http://www.ziddu.com/download/3067325/ExampleTest.zip.html]
            .....

            Now... The problem is how to implement this user defined rule in Oracle db (create our own builtin function then apply it to oracle semantic rule, in this case, myfactorial
            • 3. Re: SWRL in Oracle
              alwu-Oracle
              We don't have direct support for this kind of rule that involves domain specific functions. Filters in user-defined rules are not a good fit for your requirement.

              There may be a workaround for you.

              Can you explicitly define triples for all relevant (?z myfactorial ?rs)?
              Normally you only have a limited number of typed literal values in your domain.

              Of course, you need to use URIs to represent the typed literal value.

              Then the rule can be changed to

              (?b rdf:type h:Example) (?b h:has_value ?z) (?z h:myfactorial ?rs) -> (?b h:has_factorialvalue ?rs)

              Does this sound feasible?

              Thanks,
              Zhe Wu (aka Alan Wu)
              • 4. Re: SWRL in Oracle
                673499
                Hi Alwu, is there a way for me to implement that rule ? maybe using jena adaptor ?
                • 5. Re: SWRL in Oracle
                  alwu-Oracle
                  Jena Adaptor 2.0 supports user defined rule. I guess you need to generate and insert those assertions that reflect the function input/output.

                  Then you can run OWLPrime with user defined rules specified.

                  Cheers.