4

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.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • `SELECT ?item ?desiredVariable WHERE…` will leave out all other `?undesiredVariables` from the `WHERE` in the result. (Do you need to use `SELECT *`?) – TallTed Oct 13 '16 at 15:39
  • @TallTed: I never use `SELECT *`. My concern is about the code *after* the SELECT. – Nicolas Raoul Oct 14 '16 at 03:02

1 Answers1

9

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 [] .
AndyS
  • 16,345
  • 17
  • 21