ERDF Tutorial
From Wiki
Contents |
Introduction
Since RDF(S) does not support negation neither rules. Extended RDF (ERDF) comes with negation and rules over RDF(S). In ERDF two types of negation are supported:
- negation-as-failure - also called weak negation, it is intended to decide if is possible to prove a specific ground fact.
- strong negation - is used to explicitly provide negative information in the knowledges base. For example we can explicitly say: "John does not likes smoking" or "the content of the resource X is considered to not be correct".
Classes and Properties
In RDF(S) we have the concept of class (expressed by rdfs:Class) and property (expressed by rdf:Property). In ERDF, new types of classes and properties are added:
- Partial Class and Partial Property - are properties which can be true, false, both true and false, or neither true nor false.
- Total Class and Total Property - are properties and classes which satisfy the totalness. In the case of properties, this means that it has to be true or false, but possible both. Those two classes are considered abstract, therefore we cannot instantiate them. In place, we can instantiate their sub-classes:
- Open Class and Open Property - In order to infer negated statements, for instances of those classes, we can provide negative information along with ordinary (positive) information. This case is underlined as Open World Assumption (OWA).
- Closed Class and Closed Property - in the case of those properties, the entailment of NAF(p(x,y)) allows to derive SNEG(p(x,y)). For classes, this is interpreted as: entailment of NAF(rdf:type(x,c)) allows derivation of SNEG(rdf:type(x,c)). This case is underlined as Closed World Assumption (CWA).
By default, all RDF predicates are considered to be open. The decision if a property (or class) is partial, open or closed depends of the knowledge base owner.
The ERDF namespace is xmlns:erdf="http://www.informatik.tu-cottbus.de/IT/erdf#".
ERDF vocabularies
Using the newly added classes and properties, we can describe the ERDF vocabulary of our facts base.
<rdfs:Class rdf:about="http://example.com/Person" /> <rdf:Property rdf:about="http://example.com/name"> <rdfs:domain rdf:resource="http://example.com/Person" /> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string" /> </rdf:Property> <erdf:PartialProperty rdf:about="http://example.com/interestedIn"> <rdfs:domain rdf:resource="http://example.com/Person"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource" /> </erdf:PartialProperty> <erdf:OpenProperty rdf:about="http://example.com/likes"> <rdfs:domain rdf:resource="http://example.com/Person" /> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource" /> </erdf:OpenProperty> <erdf:ClosedProperty rdf:about="http://example.com/authorOf"> <rdfs:domain rdf:resource="http://example.com/Person" /> <rdfs:range rdf:resource="http://example.com/Book" /> </erdf:ClosedProperty>
In order to express instances of this vocabulary, we use erdf:Description element for expressing instances where properties contains negation. In the rest of the cases, we can use RDF syntax. The negation is expressed by using erdf:negationMode attribute, which can have four possible values:
- None - express that no negation is used. It is the default value and can be omitted;
- Sneg - denotes strong negation (explicit negative triple);
- Naf - express negation-as-failure;
- NafSneg - denotes negation-as-failure over strong negation.
We have to notice that for ground facts, only None and Sneg values are allowed. A new attribute, erdf:about is added. It allows URI references, blank nodes identifiers. In addition to rdf:about property, using erdf:about we can allow also literals in the subject position. In this case, the literal is enclosed in the erdf:about sub-element. Examples of instances for the above defined schema are depicted below:
<erdf:Description erdf:about="#John"> <ex:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">John Smith</name> <ex:interestedIn rdf:resource="urn:topics:SemanticWeb" /> <ex:interestedIn erdf:negationMode="Sneg" rdf:resource="urn:topics:DataBase" /> <ex:authorOf rdf:resource="http://example.com/books/b1457" /> <ex:likes rdf:resource="http://example.com/cars/BMW" /> </erdf:Description> <rdf:Description erdf:about="#Tom"> <ex:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Tom Muller</name> <ex:interestedIn rdf:resource="urn:topics:RDF" /> <ex:authorOf rdf:resource="http://example.com/books/b1287" /> <ex:likes rdf:resource="http://example.com/cars/Opel" /> </rdf:Description> <erdf:Description> <erdf:about rdf:datatype="http://www.w3.org/2001/XMLSchema#string">John Smith</name> <ex:denotationOf rdf:resource="#John" /> </rdf:Description>
ERDF Rules
For ERDF rules, two possible syntaxes are provided:
- an XML based syntax, expressed with the help of R2ML;
- a non-XML syntax, based on Jena Rules syntax, which is extended with support for express negation.
XML Syntax for ERDF Rules
ERDF Terms
ERDF terms are URI references, blank node identifiers, variables or data literals. They are expressed in two ways, depending on their occurrence as subject expressions or as value expressions:
- Terms as subject expressions - are values of the erdf:about' attribute, which may be URI references, blank node identifiers or variables using the
SPARQL syntax for blank node identifiers and variables.
- Terms as value expressions - are expressed either with the help of one of the attributes rdf:resource, rdf:nodeID' or erdf:variable, or as the text
content of the property-value slot element in the case of a data literal.
ERDF Atoms
ERDF atoms are represented by conjunctions and/or dijunctions of Descriptions or DatatypePredicateAtoms. For rules, the value of erdf:negationMode attribute can be any of the four available values: None, Sneg, Naf, NafSneg. Below, we exemplify some possible variants of atoms expressed by using erdf:Description.
<!-- using variables as values of erdf:about and erdf:variables --> <erdf:Description erdf:about="?x"> <ex:interestedIn rdf:resource="urn:topics:SemanticWeb" /> <ex:authorOf rdf:resource="http://example.com/books/b1457" /> <ex:likes erdf:variable="y" /> </erdf:Description> <!-- using variables in combination with negation --> <erdf:Description erdf:about="?x"> <ex:interestedIn rdf:resource="urn:topics:SemanticWeb" /> <ex:interestedIn erdf:negationMode="Sneg" erdf:variable="v" /> <ex:authorOf rdf:resource="http://example.com/books/b1457" /> <ex:likes rdf:resource="http://example.com/cars/Opel" /> </erdf:Description> <!-- using blank nodes (existentially quantified variables) --> <erdf:Description erdf:about="?x"> <ex:interestedIn rdf:resource="urn:topics:SemanticWeb" /> <ex:interestedIn erdf:negationMode="NafSneg" rdf:resource="urn:topics:DataBase" /> <ex:authorOf rdf:resource="http://example.com/books/b1457" /> <ex:likes rdf:nodeID="a" /> </erdf:Description>
A DatatypePredicateAtom is used to express built-ins in rules. It uses erdf:predicate attribute to express the URI reference for the built-in. Predefined sets of built-ins, as SWRL built-ins for example, can be used. The following example express a call to a SWRL built-in expressing the addition math operation.
<erdf:DatatypePredicateAtom erdf:predicate="swrlb:add">
<erdf:arguments>
<erdf:Variable>?sum</erdf:Variable>
<rdfs:Literal rdf:datatype="xs:int">11</rdfs:Literal>
<rdfs:Literal rdf:datatype="xs:int">74</rdfs:Literal>
</erdf:arguments>
</erdf:DatatypePredicateAtom>
ERDF Rule Example
The R2ML provides helpful XML markup needed to express ERDF rules using EDRF atoms.
A person is eligible for attending to the IT working group if he has Semantic Web interests, and he is author in at least one book.
<r2ml:DerivationRule r2ml:ruleID="IT_WorkingGroup">
<r2ml:conditions>
<erdf:Description erdf:about="?x">
<rdf:type rdf:resource="http://example.com/Person"/>
<ex:interestedIn rdf:resource="urn:topics:SemanticWeb" />
<ex:authorOf rdf:nodeId="b" />
</erdf:Description>
</r2ml:conditions>
<r2ml:conclusion>
<erdf:Description erdf:about="?x">
<ex:eligibleFor rdf:resource="http://example.com/groups/IT_WG"/>
</erdf:Description>
</r2ml:conclusion>
</r2ml:DerivationRule>
Non-XML Syntax for ERDF Rules
The non-XML syntax for ERDF rules is an extension of JenaRules syntax, by adding support for expressing strong and weak negation. One of the limitation for this syntax is that it does not allows expressing disjunction. We can still express disjunction, if the respective formula is in disjunctive normal form, by splitting that rule in many rules with the same head. It the formula is not in the disjunctive normal form we have to normalize it before splitting it. The non-XML syntax for ERDF rules uses SPARQL triple patterns. Universal quantified variables are preceded by the '?' symbol in front of the variable name, literals, typed literals, URI's and QNames uses the SPARQL syntax. The types of triples are available:
- positive triples - expressed by three nodes, subject, predicate and object, e.g.(ex:John ex:likes ex:Opel);
- strong negated triples - expressed by using the '-' symbol in front of the predicate (?x -ex:likes ex:BMW);
- weak-negated triples - expressed under the form of a built-in, named naf. It's arguments, are the nodes of the triple, e.g. : naf(?x ex:likes ex:Fiat).
Weak negation over strong negation is expressed by adding the '-' symbol in front of the second argument from the call of naf, named predicate, e.g. naf(?x -ex:likes ?z).
We have to notice that all variables have to be bound before the naf call. The built-in fails if the triple expressed by its parameters is found in the working memory or it can be deduced by using other available rules.
A person is eligible for attending to the IT working group if he has Semantic Web interests, and he is author in at least one book.
[IT_WorkingGroup: (?x ex:eligibleFor ex:IT_WG)
<-
(?x rdf:type ex:Person)
(?x ex:interestedIn ex:SemanticWeb)
(?x ex:authorOf _:a)]
Bibliography
- Gerd Wagner, Adrian Giurca, Ion-Mircea Diaconescu, Grigoris Antoniou and Carlos Viegas Damasio, ERDF Implementation and Evaluation, REWERSE IST 506779 Report I1-D14, March 2008.
- Anastasia Analyti, Grigoris Antoniou, Carlos Viegas Damasio, and Gerd Wagner. Stable Model Theory for Extended RDF Ontologies. In Yolanda Gil, Enrico Motta, V. Richard Benjamins, and Mark A. Musen, editors, Proceedings of the 4th International Semantic Web Conference, volume 3729 of Lecture Notes in Computer Science (LNCS), pages 21–36, Galway, Ireland, 6-10 November 2005. Springer-Verlag.
- Gerd Wagner, Adrian Giurca, and Sergey Lukichev. R2ML: A General Approach for Marking up Rules. In F. Bry, F. Fages, M. Marchiori, and H. Ohlbach, editors, Dagstuhl Seminar Proceedings 05371, Principles and Practices of Semantic Web Reasoning, 2005.
- Anastasia Analyti, Grigoris Antoniou, Carlos Viegas Damasio, and Gerd Wagner. Negation and Negative Information in the W3C Resourse Description Framework. Annals of Mathematics, Computing and Teleinformatics, 1(2):25–34, 2004.
- Gerd Wagner. Web rules need two kinds of negation. In F. Bry, N. Henze, and J. Maluszynski, editors, Principles and Practice of Semantic Web Reasoning, Proceedings of the 1st International Workshop, PPSWR ’03, volume 2901 of Lecture Notes in Computer Science (LNCS), pages 33–50. Springer-Verlag, 2003.
- Heinrich Herre, Jan O. M. Jaspars, and Gerd Wagner. Partial logics with two kinds of negation as a foundation for knowledge-based reasoning. In D.M. Gabbay and H. Wansing, editors, What is Negation? Kluwer Academic Publishers, 1999.
- Gerd Wagner. A database needs two kinds of negation. In B. Talheim and H.D. Gerhardt, editors, 3rd Symposium on Mathematical Fundamentals of Database and KnowledgeBase Systems, volume 495 of Lecture Notes in Computer Science (LNCS), pages 357–371. Springer-Verlag, 1991.


