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.
SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns. Implementations for multiple programming languages exist. There exist tools that allow one to connect and semi-automatically construct a SPARQL query for a SPARQL endpoint, for example ViziQuer.
"PREFIX", however (without the "@"), is the SPARQL instruction for a declaration of a namespace prefix. It allows you to write prefixed names in queries instead of having to use full URIs everywhere. So it's a syntax convenience mechanism for shorter, easier to read (and write) queries.
BIND. SPARQL's BIND function allows us to assign a value to a variable.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With