I'm trying to get details about an artist via DBPedia and the SPARQL query language, however, it seems almost impossible (with my understanding) of how to get certain pieces of information.
I'm trying to get an Artist and pull information such as their Hometown. I'm guessing the query should be something similar to that of:
SELECT ?c WHERE {
?b <http://dbpedia.org/property/Artist> <http://dbpedia.org/resource/Arctic_Monkeys>.
?b <http://www.w3.org/2002/07/owl#ObjectProperty> <http://dbpedia.org/ontology/hometown>.
?b rdfs:label ?c.
}
If anyone could enlighten me to how it should be done, that would be amazing.
I've been trying out the queries at:
http://dbpedia.org/sparql
If you want to find the label of their hometown, try this:
SELECT ?hometownLabel WHERE {
<http://dbpedia.org/resource/Arctic_Monkeys> <http://dbpedia.org/ontology/hometown> ?hometown .
?hometown <http://www.w3.org/2000/01/rdf-schema#label> ?hometownLabel .
}
Maybe you don't have a good understanding of SPARQL syntax. Unlike SQL, SPARQL search results by writing some triples with unknow variables in the WHERE clause. you can try:
prefix dbpedia-owl:<http://dbpedia.org/ontology/>
SELECT ?c
WHERE {
<http://dbpedia.org/resource/Arctic_Monkeys> dbpedia-owl:hometown ?c.
}
With this search, you will get Arctic_Monkeys' hometown.
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