Search code examples
sparqlanonymousblank-nodes

SPARQL anonymous variable name, for a variable whose value I don't care about


Does SPARQL have "don't care" variables?

Let's say I want all items that have a end time, but I don't care what the end time actually is:

?item wdt:P582 ?iWillNeverNeedThisVariable.

Is there a more elegant way to write this, by not naming this variable?
This would be easier to understand, less verbose, and also prevent don't-care variable names from accidentally overlapping.

I tried writing just ? but a syntax error appears.


Solution

  • In a SPARQL query, blank nodes in the query act in the role of "don't care" variables and they then don't show up in "SELECT *"

    ?item wdt:P582 [] .