问题
I just read about the concept of entailment for RDF (Resource Description Framework).Can anyone tell me an example of entailment for two RDF graphs and explain them a bit.
Thanks
回答1:
Suppose you have the following :
ex:book1 rdf:type ex:Publication .
ex:book2 rdf:type ex:Article .
So a Sparql query like SELECT ?s { ?s rdf:type ex:Publication } will return only ex:book1
If you add the fact (or a graph in your data set with the fact) that states :
ex:Article rdfs:subClassOf ex:Publication
If your sparql engine processes entailments, it should deduce that a ex:Article is also a ex:Publication
so SELECT ?s { ?s rdf:type ex:Publication } would return both ex:book1 AND ex:book2
PS: for more information, the example comes from http://www.w3.org/TR/2009/WD-sparql11-entailment-20091022/
回答2:
There's another answer about RDFS entailment, which is important, and a valuable part of day-to-day work with RDF, but RDFS entailment is not the same as RDF entailment. RDF entailment is a relationship between entire RDF graphs, and gives a way of saying "If RDF graph x holds, then so does RDF graph y." The simple entailment section of the RDF Semantics documents describes basic entailment:
Following conventional terminology, I satisfies E if I(E)=true, and a set S of RDF graphs (simply) entails a graph E if every interpretation which satisfies every member of S also satisfies E. In later sections these notions will be adapted to other classes of interpretations, but throughout this section 'entailment' should be interpreted as meaning simple entailment.
This presumes an understanding of the interpretation of graph E, denoted I(E). An interpretation maps each property to a set of pairs. E.g., an interpretation should map the property rdfs:subClassOf
to the set of pairs {[x, y] : x is a subclass of y}. For an interpretation to satisfy a graph, then the set of pairs that an interpretation maps a property to must contain at least those pairs that are actually observed in the graph. For instance, if the graph contains
a likes b.
b likes c.
then an interpretation satisfies the graph if and only if I(likes) contains the pairs [a,b] and [b,c]. A graph G1 entails graph G2 if and only if every interpretation that satisfies G1 also satisfies G2. If there are no blank nodes in the graph, this is pretty simple.
The linked section from the RDF Semantics document lists some simple results of this:
- Every graph entails the empty graph.
- Every graph entails each of its subgraphs.
Things get more complicated when there are blank nodes in an RDF graph, because blank nodes are interpreted as existential variables. For instance, consider the graph with just one triple (where _:z
is a blank node):
a likes _:z
Since _:z
is an existential variable, this means that an interpretation satisfies the graph if and only if there exists an individual x such that the interpretation of likes contains a pair [a,x]. If a graph has blank nodes, then replacing those blank nodes with actual terms produces an instance of that graph. For instance,
a likes b
is an instance of the graph
a likes _:z
The linked document also mentions the entailment relation that
- Every instance of a graph entails the graph
This is easy to see: if an interpretation satisfies a likes b
, then its interpretation of likes must contain [a,b], so there certainly is an x (namely b) such that it contains [a,x], so it also satisfies a likes _:z
.
These are just a few simple examples of RDF graph entailment. I don't know that this type of entailment actually gets used much in day-to-day work with RDF. Much more common is RDFS-entailment (described in another answer), OWL entailment, and rule-based reasoning.
来源:https://stackoverflow.com/questions/16561033/rdf-graph-entailment