200 likes | 319 Views
Embeddings of Simple Modular Extended RDF. Carlos V. Damásio 1 , Anastasia Analyti 2 , Grigoris Antoniou 2,3 ( cd@di.fct.unl.pt ), ( analyti@ics.forth.gr ), ( antoniou@ics.forth.gr ). 1 CENTRIA, Dept. Informática da Faculdade de Ciências e Tecnologia, Universidade Nova de Lisboa,
E N D
Embeddings of Simple Modular Extended RDF Carlos V. Damásio1, Anastasia Analyti2, Grigoris Antoniou2,3 (cd@di.fct.unl.pt), (analyti@ics.forth.gr), (antoniou@ics.forth.gr) 1 CENTRIA, Dept. Informática da Faculdade de Ciências e Tecnologia, Universidade Nova de Lisboa, 2829-516 Caparica, Portugal. 2 Institute of Computer Science, FORTH-ICS, Crete, Greece. 3 Dept. of Computer Science, Univ. of Crete, Crete, Greece.
Outline • Motivation • Background: MWebandExtended RDF • Simple Modular Extended RDF • Example • Embedding RIF, RDF, RDFS, and ERDF • DirecttranslationintoExtendedLogicProgramming • Evaluation • Conclusions
Motivation • Knowledge in the Semantic Web must be shared and modularly organised. • The MWeb framework provides general mechanisms to specify modular rulebases in the Semantic Web, and has a working implementation supporting some of the Rule Interchange Format (RIF) constructs. Idea: use the MWeb framework to specify a rule-based semantics for interesting fragments of modular ERDF allowing for the integration of both frameworks, with an implementation.
MWeb • Contextualized and global interpretation of arbitrary predicates. • Explicit control of monotonicity and non-monotonicity. • Scoped open and closed world assumptions. • Separate interface and implementation of rulebases with modular and independent compilation and loading. Two semantics have been proposed, MWebWFSand MWebAS, with a solid theory based on the two major semantics of extended logic programming.
Simple Modular Extended RDF • Equips RDF graphs with modularity constructs and declarative rules. • A simple modular ERDF ontology is formed by an interface and logic part [RR 2009]. Interface • Declares exported classes and properties with visibility lists • Declares imported classes and properties with import lists (sources of information) Logic part • An (E)RDF graph which may contain negative triples • Rules whose bodies are combinations of conjunctions, weak negations (naf) and strong negations (neg) of triples • Qualified literals (Lit @ Name) in bodies allow querying of other (remote) ontologies
A glimpse of syntax (interface) :- rulebase 'anne'.:- import('erdf.mw',interface). % Defined and exported predicates:- defines global normal class(mw:Vocabulary).:- defines global normal property(choose) visible to 'peter'. % Used (imported) predicates:- uses normal class(EUCountry) from 'geo'.:- uses normal property(travel), property(visit) from 'pyr', 'agcy'. :- uses normal class(mw:Vocabulary) from 'pyr', 'agcy’, 'geo'. Rulebasename Importsdefinitionof ERDF interface (includingvocabulary) Built-inclassmw:Vocabularycollectstherulebasevocabulary
A glimpse of syntax (rules) :- import('erdf.rb',rulebase). ?Package.[choose ->> ?Ctry ] :- neg ( ?Ctry # EUCountry), ?Package.[travel ->> ?Ctry ] @ 'pyr', ?Package.[visit ->> ?City ] @ 'pyr', nafneg ?Package.[visit ->> ?City]. … Rulesdefiningthesemanticof RIF, RDF, RDFS and ERDF Triple: ?Subject.[?Property ->> ?Object] Qualified literal (remotequery) Weaknegation Strongnegation
Approach followed • The semantics of ERDF is itself declaratively specified in MWebrulebases which must be imported by the translated simple modular ERDF ontologies. The following four MWebrulebases are used: • RIF: specifies membership and subclass predicates, frames and (partially) equality. • RDF: specifies RDF reasoning rules, RDF axiomatic triples and relationship to RIF predefined predicates. • RDFS: axiomatic triples, RDFS closure rules, e.g class and property inheritance. Handles domain and range of properties. • ERDF: Specifies rules defining total and closed classes and properties on top of RDFS. Inheritance of negative extensions.
RIF builtins (logical part) % RIF member relation ?O # ?CL :- ?O # ?SCL, ?SCL ## ?CL. neg ?O # ?SCL :-neg ?O # ?CL, ?SCL ## ?CL. % RIF subclass relation ?C1 ## ?C3 :- ?C1 ## ?C2, ?C2 ## ?C3. % RIF equality theory. ?T = ?T :- ?T # mw:Vocabulary.?T1 = ?T2 :- ?T2 = ?T1.?T1 = ?T3 :- ?T1 = ?T2, ?T2 = ?T3. neg ?T1 = ?T2 :- neg ?T2 = ?T1.neg ?T1 = ?T3 :- ?T1 = ?T2, neg ?T2 = ?T3. % RIF frames obtained by equality reasoning ?O.[?P ->> ?V] :- ?O1.[?P ->> ?V], ?O = ?O1.?O.[?P ->> ?V] :- ?O.[?P1 ->> ?V], ?P = ?P1.?O.[?P ->> ?V] :- ?O.[?P ->> ?V1], ?V = ?V1. MWebclasscollectingallthevocabularyofthe (current) rulebase
RDF embedding (logical part) :- import(rif.rb, rulebase ). % RDF compatibility with RIF % makes # and rdf:type% equivalent ?X # ?Y :- ?X.[ rdf:type ->> ?Y].?X.[ rdf:type ->> ?Y] :- ?X # ?Y. % RDF Entailment rule?Z.[ rdf:type ->> rdf:Property] :- ?_.[?Z ->> ?_]. % RDF Axiomatic triples rdf:type.[rdf:type->>rdf:Property].rdf:subject.[rdf:type>>rdf:Property].(etc…) Previous slide RIF rules are includedinlinehere
RDFS embedding (logicalpart) :- import( 'rdf.rb', rulebase ). % RDFS compatibility in RIF requires % including ## into rdfs:subClassOf ?X.[rdfs:subClassOf ->> ?Y] :- ?X ## ?Y. % Some of RDFS entailment rules ?Z.[ rdf:type ->> ?Y] :- ?X.[rdfs:domain ->> ?Y], ?Z.[?X ->> ?W]. ?W.[ rdf:type ->> ?Y] :- ?X.[rdfs:range ->> ?Y], ?Z.[?X ->> ?W]. ?Z.[ rdf:type ->> ?Y] :- ?X.[rdfs:subClassOf ->> ?Y], ?Z.[rdf:type ->> ?X]. ?X.[rdfs:subClassOf ->> ?X] :- ?X.[rdf:type ->> rdfs:Class]. ?X.[rdfs:subClassOf ->> ?Z] :- ?X.[rdfs:subClassOf ->> ?Y], ?Y.[rdfs:subClassOf ->> ?Z]. % other entailment rules and triples % follow…
ERDF embedding (interface) :- rulebase 'http://erdf.org'.:- prefix erdf='http://erdf.org#'.:- import( 'rdfs.mw', interface ). :- defines internal normal class(erdf:TotalClass),class(erdf:TotalProperty). :- defines internal normalclass(erdf:PositivelyClosedClass), class(erdf:NegativelyClosedClass). class(erdf:PositivelyClosedProperty),class(erdf:NegativelyClosedProperty). :- defines internal normal property(erdf:complementOf). Specificationof total classes andproperties (OWA) Specificationofclosed classes andproperties (CWA) Definingcomplementarypropertieswithoutnegation
ERDF embedding (logicalpart) • Rules to handlestrongnegationextensionsin RIF, RDF and RDFS % Compatibility with RIFneg ?X # ?Y :-neg ?X.[ rdf:type ->> ?Y].neg ?X.[rdf:type ->> ?Y] :-neg ?X # ?Y.neg ?X.[rdfs:subClassOf ->> ?Y] :- neg ?X ## ?Y. % Compatibility with RDF?Z.[rdf:type->>rdf:Property] :-neg ?_.[?Z->>?_]. % Downardpropation of negative information in RDFFneg ?Z.[rdf:type ->> ?X] :- ?X.[rdfs:subClassOf->>?Y], neg ?Z.[rdf:type->>?Y]. neg ?Z1.[?X ->> ?Z2] :- ?X.[rdfs:subPropertyOf->>?Y], neg ?Z1.[?Y->>?Z2].
ERDF embedding(logicalpart) • Total classes neg ?Z.[rdf:type->>?X] :- ?X.[rdf:type ->> erdf:TotalClass], ?Z #mw:Vocabulary, naf ?Z.[rdf:type->>?X].?Z.[rdf:type->>?X] :- ?X.[rdf:type ->> erdf:TotalClass], ?Z #mw:Vocabulary, nafneg ?Z.[rdf:type->>?X]. • Closed classes neg ?Z.[rdf:type->>?X] :- ?X.[rdf:type->>erdf:PositivelyClosedClass], ?Z #mw:Vocabulary, naf ?Z.[rdf:type->>?X].?Z.[rdf:type->>?X] :- ?X.[rdf:type->>erdf:NegativelyClosedClass], ?Z #mw:Vocabulary, nafneg ?Z.[rdf:type->>?X]. Scopedopenworldassumptions Scopedclosedworldassumptions
Translations into ELP • Twotranslationsintoextendedlogicprogramminghavebeendevised. • Thefirst uses MWeb'stransformationintoextendedlogicprogrammingand comes for free. • Thecurrentprototypeimplementsthistranslationbutintroduces some overheadintheexecution. Evensoitis quite efficientwhencompared to existingalternativesystems (seebelow) • A differentalternativepursuedinthepaperisthedefinitionof a directtranslationinto ELP (see ECAI 2010) ofsimple modular ERDF ontologies.
Direct Translation (1) Quad '->'('m',p,s,o) predicate to state that triple s p o is true at MWeb rulebase m. Interface (just use directives are translated) % Class use'->'('anne','rdf:type',?S,'EUCountry') :- '->'('geo','rdf:type',?S, 'EUCountry'). % Property use'->'('anne','travel',?S,?O) :- '->'('pyr','travel', ?S, ?O).'->'('anne','travel',?S,?O) :- '->'('agcy','travel', ?S, ?O). '->'('anne','visit',?S,?O) :- '->'('pyr','visit', ?S, ?O).'->'('anne','visit',?S,?O) :- '->'('agcy','visit', ?S, ?O). % Vocabulary use'->'('anne', 'rdf:type',?S, 'mw:Vocabulary') :- '->'('pyr', 'rdf:type', ?S, 'mw:Vocabulary').'->'('anne', 'rdf:type',?S, 'mw:Vocabulary') :- '->'('agcy', 'rdf:type', ?S, 'mw:Vocabulary').'->'('anne', 'rdf:type',?S, 'mw:Vocabulary') :- '->'('geo', 'rdf:type', ?S, 'mw:Vocabulary').
Direct translation (2) Rules are simpler to translate and basically set the first argument of quads appropriately: '->'('anne', 'choose', ?Package, ?Ctry) :- neg '#'('anne',?Ctry ,'EUCountry'), '->'('pyr', 'travel', ?Package, ?Ctry ), '->'('pyr', 'visit', ?Package, ?City), naf neg '->'('anne','visit', ?Package, ?City ). Therulesoftheimported ERDF module are compiledinthesamewayandeachrulebasehasitscopy. Thusclass/propertyextensions are contextualized. Itisalsopossible to makethe a class/property global sharing thedefinitionsinallrulebases.
Preliminary testing MWebWFS shows superior performance when performing pure RDFS memory-based entailment on the Wine ontology cputime (ms) Fig. 1 – cputime* for extracting all the triples by several rule engines * Mac OS X 10.5.8. 2.93 GHz Intel Core 2 Duo 4Gb 1067 MHz DDR3
Conclusions • MWeb can capture all the constructs of simple modular ERDF ontologies • Semantics of ERDF can be declaratively specified in MWeb • The subset of MWeb necessary to capture simple modular ERDF ontologies can be immediately translated into extended logic programming • Preliminary benchmarking shows promising results when compared to existing memory-based Semantic Web rule engines. • Subsumptive tabling is preferable (10~100 times faster) and equality reasoning introduces substantial overhead.
Download • The MWeb system implementation can be downloaded at http://centria.di.fct.unl.pt/~cd/mweb/ • OWL2 RL support is underway