Simple example of reification in RDF
Asked Answered
C

4

29

Could anybody be so kind to give me a simple example of reification in RDF? I want to see if I understood it correctly.

For example, I propose the following case

Tolkien -> wrote -> Lord of the rings
           /|\
            |
        Wikipedia said that

How would you write it with and without reification (i.e. as a simple RDF statement with no need for reification)?

Courante answered 21/8, 2009 at 15:42 Comment(1)
it resembles curry: en.wikipedia.org/wiki/CurryingGuv
O
40

"Tolkien wrote Lord of the Rings" can be expressed as a simple statement (subject, predicate, object) like this:

:Tolkien :wrote :LordOfTheRings .

By the way, this is using the Turtle notation for RDF. There are tools online for converting it to RDF/XML.

Using reification, you can have a separate resource representing a statement so you can state additional things about the statement itself, like "Wikipedia said that":

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_:x rdf:type rdf:Statement .
_:x rdf:subject :Tolkien .
_:x rdf:predicate :wrote .
_:x rdf:object :LordOfTheRings .
_:x :said :Wikipedia .

In real life, you would want to use shared vocabularies, so that whoever or whatever is consuming the RDF will know that you are talking about that Tolkien and that LOTR:

http://dbpedia.org/resource/The_Lord_of_the_Rings
http://dbpedia.org/property/author
http://dbpedia.org/resource/dbppedia/J._R._R._Tolkien

Outboard answered 22/8, 2009 at 11:19 Comment(3)
thanks for the answer. If I understand correctly, you have to provide both of them when you perform reification, or just the reification is sufficient to express the reified statement as well ? (apparently it should, but technically what is the best practice?)Courante
The reified version of a statement does not imply the original statement. This is explained in the Reification section of the RDF Semantics document linked above. It is only logical: from "Wikipedia said that Tolkien wrote LOTR" it does not follow that "Tolkien wrote LOTR".Outboard
In practice, if you store reified versions of all your statements, you end up multiplicating the number of triples you have to store. If you only need to record the provenance of your statements, you might want to consider named graphs/quad stores as an alternative.Outboard
D
8

Unfortunately, up to now, relationship instances, that is, what the W3C documents call elements of the extension of the relation, or what in mathematics you would call the pairs, that are the elements of the relation, are not considered to be first class citizens.

The semantic web ecosystem claims the AAA slogan, that anybody can say anything about anything. But this is not true, if the first "anything" here is a single edge of the graph. Even, if RDF itself has the means to express knowledge about a single edge, the W3C RDF semantics document does its best, not to support this expressivity.

Basically, there are 4 approaches to say something about an edge:

  • the unpopular, bloating loosely coupled RDF statements
  • property singletons
  • single statement named graphs (4th element in a quad being a graph ID)
  • association nodes (analoguously to UML association classes)

Property singletons are definitely the simplest solution to the problem, since they don't add anything -- you are just avoiding to make the mistake to [re]use a class-level property identifier for instance edges over and over again. Other modelling ecosystems, which have a clear understanding of meta-modelling (MOF eg.), are much less tempted to make such a mistake. Class-level edges connect class-level nodes and instance-level edges connect instance-level nodes. That's it.

If you do this right (as Vinh and his colleagues propose it), you are on the conflict road wrt reasoners, which are hard-coded along the W3C RDF semantics document.

You can circumvent this temporarily (as long as the W3C has not yet standardised property singletons) by making another design flaw and implement your property singletons as subPropertyOf-s of the class-level property [instead of making them instances of it]. Then a present RDFS reasoner would conclude from a

:my_label_0815 rdfs:subPropertyOf rdfs:label .
:some_node :my_label_0815 "some_string" .

that

:some_node rdfs:label "some_string" .

This is a dirty work-around, since it breaks clear separation of meta-levels.

We have such a lot of terribly designed models out there, just because, we don't have a straightforward way to say something about references (instance-level edges).

Dwelling answered 31/10, 2018 at 17:12 Comment(0)
C
8

As of 2020 you can use RDF* as follows:

<< :Tolkien :wrote :LordOfTheRings >> :said :Wikipedia .

In 2020 many leading triple stores implemented this approach. There are also tools to convert standard reification to RDF* to reduce triple bloat. This approach is efficient in terms of the number of triples and the speed to load data, as reported by Ontotext’s GraphDB Triple store as well as several others.

You can read about the origins of this approach here https://arxiv.org/pdf/1406.3399.pdf

Cincinnati answered 27/8, 2020 at 2:40 Comment(1)
Thank you for this nugget of information! I did not know about this new feature in RDF*Manas
C
7

A better way of doing it, is to use the singleton property approach.

For example, you create a singleton property to represent this statement as:

Tolkien wrote#1 "Lord of the rings" .

wrote#1 rdf:singletonPropertyOf wrote .

wrote#1 asserted_by Wikipedia .

You may want to read more about it in the paper "Don't like RDF Reification? Making statements about statements using singleton property" or its slides at http://www.slideshare.net/ntkimvinh7/www2014-singleton-propertyfinal...

Cahoon answered 14/11, 2014 at 21:9 Comment(5)
I don't believe that this approach scale well (as its also the case for the standardised RDF reification approach (w3.org/TR/rdf-mt/#Reif)), when looking at the query side. I would propose to leave the predicate part as it is right now in RDF and extend the RDF data model to allow statement identifier (see also, e.g., lists.w3.org/Archives/Public/public-rdf-comments/2011Jan/…).Evensong
From the querying aspect, it's not a big deal. We can always optimize the query processing (creating auxiliary indices, views, etc.)Cahoon
I think what is more challenging is, how do you represent the statement identifier in the formal semantics of RDF?Cahoon
I think, the problem with singleton property is that you only associate the meta data with the predicate (if I got it right). That's not in all cases very "semantic". Consider simething like: "<personA> died "830" . We know for sure, that personA died, but let's say Historian B said it was "830". Then I want to associate the meta data (Historian B said...) to the date, that is the object here, not to the predicate. Sometimes it's even the other way round: We know, that someone died 830, but we don't know who. Historian C said, it was personA. Here, the meta data should go with the subject.Nogging
@Evensong regarding the example by your last link, it struck me that this could be addressed at a different level of abstraction with content-addressable RDF: you may no longer need to assign identifiers to statements if you can refer to a statement by its content hash. (Downside is, hashes are opaque without software decoding)Were

© 2022 - 2024 — McMap. All rights reserved.