That query doesn't work on neither dbpedia or bibleontology because the information is stored in two different databases and when you run a SPARQL query you basically hit one or the other. This means that you have to you download the data from both databases to put them in a local triple store in order to able to run a SPARQL query like the one you showed. Another option is to use a library that does that for you.
The Semantic Web Client Library will follow all URIs that you have in your SPARQL query and download the RDF data from each resource so that it can join all the triple patterns that appear in you query and give the answers.
You could run your query with some minor changes :
PREFIX bibleontology: <http://bibleontology.com/resource/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
SELECT * WHERE {
bibleontology:Ezra owl:sameAs ?art .
?art dbpedia:abstract ?abstract .
FILTER langMatches( lang(?abstract), "EN" )
}
Explanation of the changes:
- Included
owl
and dbpedia
namespaces
?art dbpedia:abstract ?abstract .
you need to match the dbpedia:abstract
predicate to get the abstract instead of bibleontology:abstract
in order to get the abstract from dbpedia
- I have also included a
filter
to only retrieve abstracts in English, this is of course optional.
Once you download "The Semantic Web Library" and you put your query in a file (i.e: query.sparql) you can run the following command to test your query:
./semwebquery -sparqlfile query.sparql -retrieveduris -maxsteps 5
All the command params are explained in the Semantic Web Client Library documentation.
You would get the following output:
| ?art | ?abstract
| <http://dbpedia.org/resource/Ezra> | "Ezra is a major .... "@en |
Successfully dereferenced URIs:
http://www.w3.org/2002/07/owl
http://bibleontology.com/data/Ezra
http://dbpedia.org/data/Ezra.xml
http://dbpedia.org/data3/abstract.n3
I have omitted the long abstract from dbpedia for simplicity. The list of "Successfully dereferenced URIs" are documents retrieved by the library in order to answer your query. In the documentation of the library you'll see how to run queries programatically in Java.