You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Laura Morales <la...@mail.com> on 2021/01/03 18:04:33 UTC

[RDF*] How to model multiple uses of relations

In property graphs it's possible to use a relation multiple times, for example

    Foobar -[president_of {from: 1950, to:1954}]-> Japan
    Foobar -[president_of {from: 1962, to:1966}]-> Japan

where "from" and "to" are to properties of the "president_of" relation. This is an old problem that has always remained impossible to translate to RDF. In RDF there is only one relation, one "link" from a node to another. There cannot be 2 different relations with the same name.
I wonder, does RDF* change anything in regard to this behavior? I guess it does not but... I'd still like to ask anyway. For example the following Turtle* will not achieve that, right?

    << :foobar :president_of :japan >> from: 1950 ; to: 1954 .
    << :foobar :president_of :japan >> from: 1962 ; to: 1966 .

:president_of is always the same one relation, correct?


Re: [RDF*] How to model multiple uses of relations

Posted by Andy Seaborne <an...@apache.org>.

On 03/01/2021 18:04, Laura Morales wrote:
> In property graphs it's possible to use a relation multiple times, for example
> 
>      Foobar -[president_of {from: 1950, to:1954}]-> Japan
>      Foobar -[president_of {from: 1962, to:1966}]-> Japan
> 
> where "from" and "to" are to properties of the "president_of" relation. This is an old problem that has always remained impossible to translate to RDF.

It can be expressed in RDF using reification - in fact, it is better 
(more precise) as reification: each reification quad is a "claim" (also 
called a "stating") - it is not a fact (unless the fact is also asserted 
separately).

Two claims, two reifications of a statement that is NOT asserted.

[
    rdf:subject   Foobar
    rdf:predicate president_of
    rdf:object    Japan
    :from 1950
    :to 1954
]

[
    rdf:subject   Foobar
    rdf:predicate president_of
    rdf:object    Japan
    :from 1962
    :to 1966
]

Nowhere is asserting the base fact.

graph.contains(:foobar :president_of :japan) -> no.

In LPG, the statement can be found without qualification, so the app has 
to know to look for the attributes.  To know if something is "true" in 
LPG, you have to look for attributes on every link to make sure they 
don't qualify the link.

Foobar -[president_of]-> Japan

In RDF speak, that makes the statement is true, unqualified.  Oops.

> In RDF there is only one relation, one "link" from a node to another. 
Dodgy ground. This is not the essence where.

An RDF triple in a graph is a fact. It is considered "true". No "ifs", 
no "buts", no "maybe, probablity 0.5".

Not in the graph? Not stated as true.

<< :foobar :president_of :japan >> is an RDF term (like a literal is an 
RDF term of two parts - lexical form and datatype) - a node in the 
graph.  It is not a link in the graph.  It is not "true".

So we have a new kind of RDF term:

URI
Blank node
Literal
Triple-term.

which can go in the subject or object position.

In fact, they are literal like - they self-denote. A literal is a term 
that is completely described by itself.

> There cannot be 2 different relations with the same name.
> I wonder, does RDF* change anything in regard to this behavior? I guess it does not but... I'd still like to ask anyway. For example the following Turtle* will not achieve that, right?
> 
>      << :foobar :president_of :japan >> from: 1950 ; to: 1954 .
>      << :foobar :president_of :japan >> from: 1962 ; to: 1966 .
> 
> :president_of is always the same one relation, correct?

Care needed.

Correct by RDF* the original paper. This is called "PG mode" in the 
discussions : <<>> is a triple RDF term AND it asserts the triple. It 
does two things.

graph.contains(:foobar :president_of :japan) -> yes.

Incorrect by the latest RDF* (RDF-star) specs.

SA mode (SA = "semantic assertion") has <<>> as an RDF term but the 
triple is not asserted as well.

    << :foobar :president_of :japan >>
       :valid [ :from 1950 ; :to 1954 ] ;
       :valid [ :from 1962 ; :to 1966 ] .

graph.contains(:foobar :president_of :japan) -> no.

graph.contains(<<:foobar :president_of :japan>> ?predicate ?object)
   -> yes (it is the subject of a triple)
      ?predicate = :valid
      ?object (twice : 2 blank nodes).

Note adding the modelling ":valid"


See the mailing list (about June 2020 - look for Tim Finin)

https://lists.w3.org/Archives/Public/public-rdf-star/2020Jun/0006.html

and discussion around that.


The RDF* extension is that you can talk about triples without asserting 
them. It is more convenient than reification (and easier to implement) 
but it is not as expressive - you need to do appropriate modelling on top.

Annotation syntax does PG mode: it asserts the triple and makes 
statement about the triple.

  :foobar :president_of :japan {| from: 1950 ; to: 1954 |} .
  :foobar :president_of :japan {| from: 1962 ; to: 1966 |} .

and is better as:

  :foobar :president_of :japan {| :valid [ from: 1950 ; to: 1954 ] |} .
  :foobar :president_of :japan {| :valid [ from: 1962 ; to: 1966 ] |} .

or the same triples can be written as:

  :foobar :president_of :japan {|
          :valid [ from: 1950 ; to: 1954 ] ;
          :valid [ from: 1962 ; to: 1966 ]
           |} .

graph.contains(:foobar :president_of :japan) -> yes.

Annotation syntax is just syntactic sugar, like ";" is syntactic sugar. 
It does not have a separate meaning; it makes writing common cases 
easier. It is not required.

     Andy