Skip to content

Conversation

@afs
Copy link
Contributor

@afs afs commented Dec 14, 2025

Replaces #329
Closes #283
Closes #282

This PR breaks test basic-tripleterm-subject.rq.

==== Positive syntax test
====          1         2         3         4
====  12345789_123456789_123456789_123456789_
 1 -- PREFIX : <http://example.com/ns#>
 2 -- 
 3 -- SELECT * {
 4 --     VALUES ?x {
 5 --         <<(:s :p :o )>>
 6 --         <<( <<(:s :p :o )>> :q :z )>>
 7 --     }
 8 --     VALUES (?y ?z) { (<<(:s :p :o )>> 123 )
 9 --                       (123 <<(:s :p :o )>> ) }
10 -- }
====
  64 [F] basic-tripleterm-subject.rq (basic-tripleterm-subject.rq)

Preview | Diff

@afs afs requested review from Tpt, hartig and kasei December 14, 2025 11:06
@afs
Copy link
Contributor Author

afs commented Dec 14, 2025

I am neutral on this change.

SPARQL (all versions) are what is now called symmetric RDF. There must be some way to write literal in the subject position of triple terms.

I do not support keeping TRIPLE as identical to <<( )>>. See #284.

I do not support changing <<( )>> in graph patterns. It is inconsistent with triples in BGPs (where they are property paths).

@Tpt
Copy link
Contributor

Tpt commented Dec 14, 2025

My rational for the change:

Allowing the following queries

SELECT ?t WHERE { VALUES ?s { <<( <<(:s :p :o )>> :q :z )>> } }
SELECT (<<( <<(:s :p :o )>> :q :z )>> AS ?t) WHERE {}

means that:

  1. either they return the solution { ?s -> <<( <<(:s :p :o )>> :q :z )>>. This mean that, in conformant SPARQL implementations, SELECT queries can now return solutions that are not anymore composed of only valid RDF terms but of a generalized flavor of them allowing triple terms and literals as subject of triple terms.
  2. either it return an empty solution/no solution. In this case the <<( <<(:s :p :o )>> :q :z )>> term gets "lost" somewhere in the evaluation and it's confusing to the user.

No variant sounds good to me. I would prefer that the SPARQL 1.2 standard still allow SELECT queries to return only valid RDF terms. This does not prevent implementations supporting generalized RDF to support and return such terms by extending the SPARQL grammar.

Copy link
Contributor

@hartig hartig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am supporting this change.

@afs afs requested a review from hartig December 16, 2025 13:22
<ul>
<li>each of the three elements of the triple term expression can only be
a <a href="#defn_QueryVariable">variable</a>
or a directly written [=RDF terms=], not arbitrary expressions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or a directly written [=RDF terms=], not arbitrary expressions.
or a directly written [=RDF term=], not an arbitrary expression.

Comment on lines +7963 to +7965
the syntax of the subject and predicate positions is limited to an
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> or
<a href="#defn_QueryVariable">variable</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the syntax of the subject and predicate positions is limited to an
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> or
<a href="#defn_QueryVariable">variable</a>.
the syntax of each subject and predicate position is limited
to an <a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> or
a <a href="#defn_QueryVariable">variable</a>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExprTripleTermSubject grammar rule allows to write always invalid expression Consider if TripleTermData rule should allow generalized triple terms

6 participants