Sunday, June 19, 2011

How to Support Property Chain Axiom Using Oracle's OWL Prime

In this article, we will show how to support Property Chain Axiom using OWLPrime rulebase in Oracle Semantic Technologies.
What Oracle Semantic Supports?
Oracle Semantic Technologies support the following rule set (but not limited to these):
  • OWLSIF (OWL with IF semantics)
    • Based on Dr. Horst's pD* vocabulary
  • OWLPrime
  • OWL2RL

If you are using 11.2.0.1, you can find OWl 2 RL support in the following patch on support.oracle.com:

  • Patch Number 9819833 - semantic technologies 11g r2 fix bundle 2

Note that Semantic 11.2.0.2 comes with OWl 2 RL support.

Property Chain Axiom[5]

Table 1 specifies the semantic conditions on property chain axiom:


If
Then
prp-spo2 T(?p, owl:propertyChainAxiom, ?x)
LIST[?x, ?p1, ..., ?pn]
T(?u1, ?p1, ?u2)
T(?u2, ?p2, ?u3)
...
T(?un, ?pn, ?un+1)
T(?u1, ?p, ?un+1)
Property chain axiom allows reasoner to infer the existence of a property from a chain of properties. For example, the following hasContained semantic using property chain axiom :
hasContained(x, "EOS 60D") ^ rdf:type("EOS 60D","Digital SLR Cameras")
-> hasContained(x,"Cameras")

<rdf:description about="hasContained">
<owl:propertychainaxiom parsetype="Collection"/>
<owl:objectproperty about="hasContained"/>
<owl:objectproperty about="&rdf;type">
</owl:propertychainaxiom>
</rdf:description>
to derive the fact that an article is related to the topic "Cameras" if it contains the key words "EOS 60D" because "EOS 60D" is a rdf:type of "Digital SLR Cameras" which is, in turn, a owl:subClassOf of "Cameras". Our camera ontology example looks like this:

Using Oracle's OWLPrime rule set, it doesn't support the above inference directly. What it can infer is just:
rdf:type("EOS 60D", "Digital SLR Cameras") ^
owl:subClassOf("Digital SLR Cameras","Cameras") -> rdf:type("EOS 60D","Cameras")
However, this is different from what we want. To enable Oracle Semantic to support what we want using OWLPrime rule set, we need to:
  • Specify chain definition RDF triples
  • Specify 'CHAIN' for the inf_components_in argument in SEM_APIS.CREATE_ENTAILMENT()
Note that OWL2RL has more rules than OWLPrime does and you can use it to achieve the above task directly. However, the more rules you include in the inference, the slower performance you get. That's the reason why we document the steps here to allow users to use OWLPrime instead of OWL2RL for property chain.

Chain Definition Triples

The first requirement is to insert the necessary chain definition triples for hasContained semantic into your ontology model:

prefix prop:, namespace URI: http://xmlns.oracle.com/rdfctx/property#
prefix owl:, namespace URI: http://www.w3.org/2002/07/owl#
prefix rdf:, namespace URI: http://www.w3.org/1999/02/22-rdf-syntax-ns#
prop:hasContained  owl:propertyChainAxiom _:jA1 .
_:jA1 rdf:first prop:hasContained .
_:jA1 rdf:rest _:jA2.
_:jA2 rdf:first rdf:type .
_:jA2 rdf:rest rdf:nil .
To insert the above chain definition triples, you can use the following INSERT statements:
INSERT INTO ontology_rdf_data VALUES(ONTOLOGY_S1.nextval,
sdo_rdf_triple_s('ontology_model',
'<http://xmlns.oracle.com/rdfctx/property#hasContained>',
'<http://www.w3.org/2002/07/owl#propertyChainAxiom>',
'_:jA1'));

INSERT INTO ontology_rdf_data VALUES(ONTOLOGY_S1.nextval,
sdo_rdf_triple_s('ontology_model','_:jA1',
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>',
'<http://xmlns.oracle.com/rdfctx/property#hasContained>'));

INSERT INTO ontology_rdf_data VALUES(ONTOLOGY_S1.nextval,
sdo_rdf_triple_s('ontology_model',
'_:jA1', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>',
'_:jA2'));

INSERT INTO ontology_rdf_data VALUES(ONTOLOGY_S1.nextval,
sdo_rdf_triple_s('ontology_model','_:jA2',
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#first>',
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'));

INSERT INTO ontology_rdf_data VALUES(ONTOLOGY_S1.nextval,
sdo_rdf_triple_s('ontology_model',
'_:jA2', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>',
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>'));
Note that our ontology_model is created as:
-- create application table
create table ontology_rdf_data (
triple_id NUMBER(18) NOT NULL,
triple SDO_RDF_TRIPLE_S,
CONSTRAINT ontology_rdf_data_pk PRIMARY KEY (triple_id)
);

-- create the RDF Model --
begin
sem_apis.create_rdf_model (model_name => 'ontology_model',
table_name => 'ontology_rdf_data',
column_name => 'triple');
end;
/

SEM_APIS.CREATE_ENTAILMENT

Before you use SEM_MATCH table function to query semantic data, it is required that you create a rules index using SEM_APIS.CREATE_ENTAILMENT. The rules index will contain precomputed triples inferred from RDF model(s) and rulebase(s).

Here we describe how to set up rules index correctly for supporting property chain. First, if you have already created the rules index, drop it first:
BEGIN
SEM_APIS.DROP_ENTAILMENT('rule_index_1');
END;
/

The second step is to run inference on default graph:

exec sem_apis.create_entailment('rule_index_1',sem_models('ontology_model','model_1'),sem_rulebases('owlprime'),inf_components_in => 'CHAIN', include_default_g => sem_models('ontology_model','model_1'));

Finally, you run NG-based (i.e., Name Graph) local inference:

exec sem_apis.create_entailment('rule_index_1',sem_models('ontology_model','model_1'),sem_rulebases('owlprime'), inf_components_in => 'CHAIN', options =>'ENTAIL_ANYWAY=T,LOCAL_NG_INF=T');
commit;

Unless you specify below argument
inf_components_in => 'CHAIN'
the reasoner won't support property chain using OWLPrime rulebase.

Note that there are two RDF models used in the above global and local inference(s):
  • ontology_model (i.e., TBox)
  • model_1 (i.e., ABox)

Global Inference vs. Local Inference
Global inference takes all asserted triples from all the source model(s) provided and applies semantic rules on top of all the asserted triples till an inference closure is reached. Even if the given source models contain one more multiple named graphs, it actually makes no difference to global inference because all assertions, whether part of a named graph or not, are treated the same as if they come from a single graph.

On the other hand, local inference is performed within the boundary of every single named graph combined with the common schema. See Oracle documentation for more details.

References
  1. OWL 2 Web Ontology Language Profiles
  2. Oracle's Support for a Subset of the Web Ontology Language (OWL)
  3. The Fragment of OWL Implemented in Oracle 11g
  4. rdf:type
  5. Property Chains
  6. SKOS (part 4): property chains

1 comment:

Blogger said...

If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you need to watch this video
right away...

(VIDEO) Why your ex will NEVER come back...