OWL2 RL (OWLIM) Zaenal Akbar April 10, 2014 Copyright 2014 STI INNSBRUCK www.sti-innsbruck.at
OWL - Web Ontology Language
OWL is a semantic fragment of FOL 1
OWL exists in different flavorsOWL Lite ⊆ OWL DL ⊆ OWL FullOWL2 EL, OWL2 RL, OWL2 QL ⊆ OWL2 DL ⊆ OWL2 Full
OWL 2 is a very expressive language, hard to implementand work withOWL 2 specifies profiles/fragments/sub-languages→trades some expressive power for the efficiency ofreasoningOWL 2 RL:
Designed to be amenable to implementation usingrule-based technologiesPresenting a partial axiomatization of the OWL 2RDF-Based Semantics
1H. Sack, Semantic Web Technologies - OWL 2, 2012,http://www.slideshare.net/lysander07/10-semantic-web-technologies-owl-2
www.sti-innsbruck.at 3/21
OWLIM
OWLIM is a high-performance semantic repositoryImplemented in Java and packaged as a Storage andInference Layer (SAIL) for the Sesame RDF database [2]
www.sti-innsbruck.at 4/21
OWLIM
Implemented on top of the TRREE (Triple Reasoning andRule Entailment Engine)Performs reasoning based on forward-chaining ofentailment rules over RDF triple patterns with variablesR-Entailment 2
Premises and conclusions are triple patternsVariables allowed in any positionInequality constraintsRules applied directly to RDF graph
2B. Bishop, S. Bojanov, Implementing OWL 2 RL and OWL 2 QL rule-sets for OWLIM, 2011www.sti-innsbruck.at 5/21
OWLIM - Semantics
OWLIM offers several predefined semantics by way ofstandard rule-sets
1. empty: no reasoning, i.e. operates as a plain RDF store2. rdfs: supports standard RDFS semantics3. owl-horst: OWL dialect close to OWL Horst4. owl-max: a combination of most of OWL-Lite with RDFS5. owl2-ql: Conformant OWL2 QL profile6. owl2-rl: Fully conformant OWL2 RL profile, except for
D-Entailment
Can be configured to use custom rule sets with semanticsbetter tuned to the particular domain
www.sti-innsbruck.at 6/21
OWLIM - Reasoner (1)
Prefices {
rdfs : http://www.w3.org/2000/01/rdf-schema#
}
Axioms {
<rdf:type> <rdf:type> <rdf:Property>
<rdf:subject> <rdf:type> <rdf:Property>
}
Rules {
Id: <rule_name>
<premises> <optional_constraints>
-------------------------------
<consequences> <optional_constraints>
}
www.sti-innsbruck.at 7/21
OWLIM - Reasoner (2)
Id: prp_trp
p <rdf:type> <owl:TransitiveProperty>
x p y
y p z
-------------------------------
x p z
Id: prp_key_1
c <owl:hasKey> u
x <rdf:type> c [Constraint x != y]
y <rdf:type> c [Cut]
x u y [Context <onto:_sameKey>]
-------------------------------
x <owl:sameAs> y
www.sti-innsbruck.at 8/21
The Weaver
Bottleneck: serialization/deserializationHow to bring the reasoner closer to the data?
www.sti-innsbruck.at 9/21
RDF Model (1)
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix schema: <http://schema.org/> .
@prefix oc: <http://sti2.at/oc/> .
www.sti-innsbruck.at 10/21
RDF Model (2)
schema:Event a rdfs:Class;
rdfs:label "Event"@en;
rdfs:subClassOf schema:Thing;
rdfs:isDefinedBy <http://schema.org/Event> .
schema:description a rdf:Property; ...
schema:name a rdf:Property; ...
schema:startDate a rdf:Property; ...
schema:endDate a rdf:Property; ...
schema:location a rdf:Property;
rdfs:domain [ ... owl:unionOf(schema:Event ...) ];
rdfs:range [ ... owl:unionOf(schema:Place ...) ];
schema:Place a rdfs:Class; ...
www.sti-innsbruck.at 11/21
RDF Model (3)
oc:Channel a rdfs:Class;
rdfs:label "Channel"@en;
rdfs:isDefinedBy <http://sti2.at/oc/Channel> .
oc:Twitter a rdfs:Class;
rdfs:label "Channel Twitter"@en;
rdfs:subClassOf oc:Channel;
rdfs:isDefinedBy <http://sti2.at/oc/Twitter> .
oc:Blog a rdfs:Class;
rdfs:label "Channel Blog"@en;
rdfs:subClassOf oc:Channel;
rdfs:isDefinedBy <http://sti2.at/oc/Blog> .
www.sti-innsbruck.at 12/21
RDF Model (4)
oc:publish a rdf:Property;
rdfs:label "Publish"@en;
rdfs:comment "Publish a Content to a Channel."@en;
rdfs:domain [ a owl:Class;
owl:unionOf (schema:Event schema:BlogPosting) ];
rdfs:range [ a owl:Class;
owl:unionOf (oc:Twitter oc:Blog) ];
rdfs:isDefinedBy <http://schema.org/Event>;
rdfs:isDefinedBy <http://schema.org/BlogPosting>;
.
www.sti-innsbruck.at 13/21
Rules (1)
Prefices {
schema : http://schema.org/
oc : http://sti2.at/oc/
}
Axioms {
...
<schema:Event> <rdf:type> <rdfs:Class>
<schema:Event> <rdfs:subClassOf> <rdfs:Resource>
<oc:Twitter> <rdf:type> <rdfs:Class>
<oc:Twitter> <rdfs:subClassOf> <rdfs:Resource>
...
<oc:publish> <rdf:type> <rdf:Property>
<oc:publish> <rdfs:domain> <rdfs:Class>
<oc:publish> <rdfs:range> <rdfs:Class>
}
www.sti-innsbruck.at 14/21
Rules (2)
Rules
{
Id: pub_event
x <rdf:type> <schema:Event>
-------------------------------
x <oc:publish> <oc:Twitter>
x <oc:publish> <oc:Blog>
Id: pub_post
x <rdf:type> <schema:BlogPosting>
-------------------------------
x <oc:publish> <oc:Blog>
...
}
www.sti-innsbruck.at 15/21
Instances (1)
oc:3W04 a schema:Place ;
schema:description "Room 3W04" .
oc:M1 a schema:Event ;
schema:name "OC Meeting" ;
schema:location oc:3W04 ;
schema:startDate "2014-04-09T14:30" ;
schema:endDate "2014-04-09T15:30" .
Test> sparql prefix oc:...
insert data { oc:M1 a schema:Event; ... }.
Executing update...
Update executed in 431 ms
www.sti-innsbruck.at 16/21
Instances (2)
Test> sparql
select * where {?s <http://sti2.at/oc/publish> ?o}.
Evaluating query...
+-------------------------+---------------------------+
| s | o |
+-------------------------+---------------------------+
| oc:M1 | oc:Twitter |
| oc:M1 | oc:Blog |
+-------------------------+---------------------------+
2 result(s) (43 ms)
Test>
www.sti-innsbruck.at 17/21
Comparison (1)
OWLIM’s Custom Rule-Sets:Specify the custom rule-set manually via the configurationparameter (-Druleset=/opt/owlim-se-5.3/oc.pie)The rule-set file is processed to create Java source code,then compiled using JDK, used by TRREE during inference
$ tail -f logs/catalina.out
OwlimSchemaRepository: version: 5.3, revision: 6156
Product: OWLIM_SE
Licensee: STI_PlanetData
...
Current file: /opt/owlim-se-5.3/oc.pie
Compiled: ’/opt/owlim-se-5.3/oc.pie’
www.sti-innsbruck.at 18/21
Comparison (2)
OWLIM’s Reasoner:⊕ Compact (no more objects instantiation), Centralized (nomore scattered servers) Less flexible to maintain the Rules Rules filtering still questionableIF (event.location == "Innsbruck") THEN ...
Drools (+Guvnor) Rules Engine:⊕ More flexible on Rules editing, i.e. GUI, DSL, filtering⊕ KB sessions can be created/destroyed dynamically Complex, requires objects instantiation
www.sti-innsbruck.at 19/21
Summary
OWLIM can simplify the complexity of the Weaver, andmore than enough for the most use casesShould we use OWLIM’s Reasoner instead?
www.sti-innsbruck.at 20/21
References
1. OWLIM, http://owlim.ontotext.com2. OpenRDF Sesame, http://www.openrdf.org3. OWL 2 Primer, http://www.w3.org/TR/owl2-primer/4. OWL 2 Profiles, http://www.w3.org/TR/owl2-profiles/5. Schema.org, http://schema.org/6. Drools, http://www.jboss.org/drools/
www.sti-innsbruck.at 21/21