-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Currently SPARQL 1.1 states under 4.1.4 Syntax for Blank Nodes "Blank nodes in graph patterns act as variables, not as references to specific blank nodes in the data being queried."
So one can think of blank nodes in graph patterns as locally scoped variables, which are not needed further down in the query evaluation, but instead only for the evaluation of the graph pattern itself.
The advantage here is that the purely local significance of a blank node becomes immediately clear, as it is not part of the solution bindings.
From this, one could conclude that its use in the predicate position is also permissible, but according 19.8 Grammar this is not the case ([78] Verb is restricted to be VarOrIri or a literal 'a'). But why not?
E.g. if I only want to know, which objects are directly reachable in one hop from a known subject, I do not care about the actual predicate, so I could image this syntactilly ill-formed query:
SELECT DISTINCT ?o
WHERE {
?s [] ?o.
}
VALUES ?s <http://www.example.org/subjectOfInterest>
Instead I have to use:
SELECT DISTINC ?o
WHERE {
?s ?p ?o.
}
VALUES ?s <http://www.example.org/subjectOfInterest>
And in that case I can only hope (as I can not explicity state the disposability of variable 'p'), that the query optimizer directly discards the bindings for variable 'p', and is not building first solution bindings with a bound 'p' in it, only to discard it later anyway during the evaluation of the select projection.