Re: Different encoding for RDF-star queries as S-Expressions with Jena

On 23/01/2022 20:32, Daniel Hernandez wrote:
> 
> Andy Seaborne writes:
> 
>> Jena parses and evaluates Daniel's original example - it is using a
>> (triple) as an expression. SPARQL-star TRIPLE.
>>
>> The two expression are not identical - one has quoted triple term <<>>
>> pattern, the other has an expression that evaluates to a quoted triple
>> -the TRIPLE(expr, expr, expr) function in SPARQL-star.
>>
>> So there are three cases:
>>
>> 1 : triple pattern - 3-tuple of RDF-terms/variables.
>> 2 : quoted triple pattern, an RDF term + may have variables
>> 3 : TRIPLE/3 function - arguments are expressions.
>>
>> triple != quoted triple.  strict typing :-)
> 
> I agree with Andy on that these three cases (depending in the type
> system) are not of the same type.  Andy proposed using two words
> (triple) and (qtriple).  Maybe, it is better to use three words, namely
> (triple) for case 1, (qtriple) for case 2, and (ftriple) for case 3.
> This way context is not needed to interpret which of the three meanings
> described by Andy correspond to the expression.

(ftriple) is inconsistent naming whhic is a nuisenace - function names 
are written as their SPARQL function name. (subject) (object) 
(predicate) (istriple), (+) ...


Turns out there are further uses of (triple) in Jena. It is also a 
extension to SPARQL patter operators outside of BGPs with 
OpTriple/OpQuad. Position resolves which is meant.

Also: a basic graph pattern can be triples without the leading "triple" 
symbol "(?s ?p ?o)" and it is in many of the tests.

But the qtriple/TRIPLE distinction is an ambiguity that can't be 
resolved by context in expressions: BIND or FILTER etc

   BIND(<<?s ?p ?o>> AS ?t)     # Term pattern

   BIND(TRIPLE(?s,?p,?o) AS ?t) # Function

these are are different and the distinction is needed to round-triple 
expressions faithly.

   # Function
   BIND(TRIPLE(IRI("http://example/s"),?p,?o)) AS ?t)

   BIND(<<IRI("http://example/s") ?p ?o>> is illegal syntax.

So Jena now has qtriple for <<>> -- it accept both forms, and writes 
(qtriple).

     Andy

> Daniel

Received on Monday, 24 January 2022 17:23:55 UTC