15

Can I write comments in a query, so that only God but also me remember what I was doing?

I just started learning SPARQL, so forgive my ignorance.

For example:

SELECT ?names
WHERE {
  ?names dbo:award :Turing_Award // get names that won Turing award
}

that throws a parsing error.

A negative answer will also be accepted!

I am using SPARQL endpoint over the DBpedia data set at http://dbpedia.org/sparql.

gsamaras
  • 66,800
  • 33
  • 152
  • 256

1 Answers1

26

The SPARQL 1.1 specification says:

Comments in SPARQL queries take the form of '#', outside an IRI or string, and continue to the end of line (marked by characters 0x0D or 0x0A) or end of file if there is no end of line after the comment marker. Comments are treated as white space.

Hence, your example SPARQL fragment should read:

    SELECT ?names
    WHERE {
      ?names dbo:award :Turing_Award # get names that won Turing award
    }
Hugolpz
  • 14,637
  • 24
  • 85
  • 173
O. R. Mapper
  • 18,591
  • 9
  • 58
  • 102