Blank nodes are basically pronouns.
They're used when you know an entity exists, and you can say some things about it, but you don't know its absolute identifier, its URI, its name, so you use a pronoun to reference it.
In your example query, you're not really using a blank node, as the []
is just taking the place of the common ?s
or any other variable. A better example of a blank node would be here --
:Fred :hasThing [ :hasColor :Blue ]
We don't know anything else about the "Thing", so we refer to it obliquely.
Added --
Also note that in your query, the PREFIX
declarations are pointless, as the declared prefixes appear nowhere in your query. They do not cause inclusion of listed datasets (because they're not lists of datasets, in this context; they're just syntactic sugar to make other URIs in the query easier to write as prefixed-URIs, like foaf:Person
, rather than fully-qualified URIs, like <http://xmlns.com/foaf/0.1/Person>
), nor exclusion of others.
(Tangentially -- your foaf:
prefix is incorrect, as it has a hyphen, "-
", where it should have a dot, ".
".)
This query is identical to yours --
SELECT DISTINCT ?class
WHERE { ?s a ?class }