as you will see from the question, I am just beginning to learn about graph databases. I am trying to go through the SPARQL Kit, but as soon as I start writing queries I get nothing.
If I write the return all query like below, I get the results.
SELECT *
WHERE{
?s ?p ?0 .
}
However, any other query does not work, including those from the kit. I am not sure what I am doing wrong, so any help is welcome.
The default namespace is not set correctly for this kit. We're sorry for any confusion that this has caused!
To work through this kit with minimal changes, please navigate to the Databases hub, Namespace tab, change the IRI for the blank prefix from http://api.stardog.com/ to http://stardog.com/tutorial/, and save the change.
Thank you for the quick response Laura
Would it be an issue to elaborate a bit further on the issue, what does the default namespace actually do? Just so I can undestand what is going on behind the scenes, it could help in the future.
Stardog uses namespaces to help reduce the text needed in each query. Namespaces can be considered variables and are pairs of prefixes and IRIs. The prefix is a variable for the full IRI.
So instead of writing,
SELECT ?album
WHERE {
?album rdf:type <http://stardog.com/tutorial/Album> .
}
You can use a namespace so that you don't have to write out http://stardog.com/tutorial/ every time. Stardog includes a few common namespaces by default for each database.
The issue with the kit is that the namespace with the blank prefix was set to http://api.stardog.com/ instead of http://stardog.com/tutorial/. Therefore when you running the query:
SELECT ?album
WHERE {
?album rdf:type :Album .
}
It was interpreted as
SELECT ?album
WHERE {
?album rdf:type <http://api.stardog.com/Album> .
}
And since there are no instances of http://api.stardog.com/Album (only instances of http://stardog.com/tutorial/Album) no results were being returned.
This training also might be helpful for understanding some of the fundamentals of RDF and SPARQL.