w3c / rdf-star

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

Define comparison operations for RDF-star triples #121

Closed pchampin closed 3 years ago

pchampin commented 3 years ago

As pointed out by @lisp and @jeenbroekstra on the mailling list, we need to define how RDF-star triples are compared with each other and with other terms

afs commented 3 years ago

sameTerm

17.4.1.7 RDFterm-equal defers to RDF Concepts (section 6) for term-equality.

Presumably the definition for RDF-star term equality is sameTerm(<<S1 P1 O1>>, <<S2 P2 O2>>) == sameTerm(S1, S2) && sameTerm(P1, P2) && sameTerm(O1, O2)

This goes in section 2 of the RDF-star report.

value-equality

17.3 Operator Mapping "A = B" is defaults to "sameTerm(A,B)" as it does for URIs.

The question becomes whether to add a dispatch for "=" that is value-sensitive on literals in a embedded triple. True or false: << :s :p 123 >> = <<:s :p 123.0>>.

Because embedded triples are triples, and two triples compare by term-equality in a "set of triples" i.e. a graph, we could leave this as term-equality.

Is there a use case for value-equality? If so, does it merit defining "=" to be value-equality of component terms given that graphs are set-term-equality.

Note: DATATYPE(<<:s :p :o>>) is error, just like DATATYPE(<uri>).

ORDER BY

defines an ordering between term types:

(Lowest) no value assigned to the variable or expression in this solution. Blank nodes IRIs RDF literals

Adding to that list should be done.

Comparision of embedded triple terms

What is << :s :p 123 >> < <<:s :p 456>> (other than hard to write) or ?t1 < ?t2 where ?t1 is << :s :p 123 >> and ?t2 is << :s :p 456 >> ?

This pairs with value-equality.

Proposal

JervenBolleman commented 3 years ago

I believe that embedded triples should sort after RDF literals.

afs commented 3 years ago

Sorry - it's confusing 'Define "=" as sameTerm' - I (think I) meant "in the same style". The earlier text spells out the issue , not has an opinion.

<<S1 P1 O1>> = <<S2 P2 O2>> IFF (S1 = S2) && (P1 = P2) && (O1 = O2)

There are efficiency advantages of if it were only top-level sameTerm but deciding solely on that efficiency argument is suspect.

Another argument is: if we add comparison by value then having value-= is necessary for consistency.