w3c / rdf-star

RDF-star specification
https://w3c.github.io/rdf-star/
Other
118 stars 23 forks source link

[Question] RDF-star and Nesting Annotations #276

Closed AdamSobieski closed 1 year ago

AdamSobieski commented 1 year ago

Hello. In a discussion thread, I'm exploring probabilistic n-ary predicate calculus expressions including utilizing Turtle-star/TriG-star.

ex:myPredicate calc:holdsFor (ex:x ex:y ex:z) {| calc:probability "0.95"^^xsd:double |} .

While I was typing that, I thought about: what if there were multiple annotations of probability for an expression, each according to a different source? What would that look like?

The following example intends to express that Alice attributes a 0.95 probability to a predicate calculus expression while Bob attributes a 0.96 probability to it.

ex:myPredicate calc:holdsFor (ex:x ex:y ex:z) {| calc:probability "0.95"^^xsd:double {| o:accordingTo ex:Alice |} ,
                                                                  "0.96"^^xsd:double {| o:accordingTo ex:Bob   |} |} .

Can we nest annotations in Turtle-star/TriG-star, annotating an asserted annotation of an asserted triple?

Perhaps the following example expresses the case better, where the predicate calculus expression would not be asserted and only the probability-related statements would.

<< ex:myPredicate calc:holdsFor (ex:x ex:y ex:z) >> calc:probability "0.95"^^xsd:double {| o:accordingTo ex:Alice |} ,
                                                                     "0.96"^^xsd:double {| o:accordingTo ex:Bob   |} .

Are these syntactically correct?

afs commented 1 year ago

Are these syntactically correct?

The last one isn't. List syntax is not legal in quoted triples.

https://www.w3.org/2021/12/rdf-star.html#turtle-star-grammar

The second one includes: (DATA for the list intent)

<< ex:myPredicate calc:holdsFor ex:DATA >>
        calc:probability  "0.96"^^xsd:double , "0.95"^^xsd:double .

i.e. two probabilities which is may be not what was intended. The fact it also includes

<< << ex:myPredicate calc:holdsFor ex:DATA >> calc:probability "0.95"^^xsd:double >>
        o:accordingTo  ex:Alice .

etc does not modify the underlying data to keep the two probabilities apart.

To have the two as separate sets of triples about the base data, there needs to be an indirection to keep them apart. This can't be written with annotation syntax - annotation syntax is a syntactic shortcut for certain cases, not a complete solution.

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

Sketch:

<< ex:myPredicate calc:holdsFor ex:DATA >> 
    o:observation [ calc:probability "0.95"^^xsd:double ; o:accordingTo ex:Alice ] ;
    o:observation [ calc:probability "0.96"^^xsd:double ; o:accordingTo ex:Bob ] .
AdamSobieski commented 1 year ago

Thank you @afs, I updated that discussion thread with this.