0

I've been learning about sparql lately and confuse about blank nodes. Is blank nodes can be used to linked data from multiple dataset ? Or it is just used for one dataset? then what is the specific usage of this blank nodes?

PREFIX dbo: <http://dbpedia.org/ontology/>    
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0-1/>


SELECT DISTINCT ?class
WHERE {[] a ?class}

does query above already using different dataset or multiple datasets?

1 Answers1

2

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 }
TallTed
  • 9,069
  • 2
  • 22
  • 37
  • @SintaAnjelina - Please [accept my answer](http://stackoverflow.com/help/accepted-answer), if it was satisfactory. – TallTed Jun 05 '19 at 18:38