Kristian's answer is right that the property is dbpprop:nationality
that Henrik Ibsen has. You're right that there is a dbpedia-owl:nationality
property, too, but Henrik Ibsen doesn't have a value for it, unfortunately. The value of dbpprop:nationality
that Henrik Ibsen has, though, is a string, which is a literal, and literals cannot be the subjects of triples in RDF, so ?nationality rdfs:label ?nationalityLabel
in your query will never match.
The DBpedia ontology data (dbpedia-owl
) tends to be cleaner than the dbpprop
data, so you might prefer a solution using dbpedia-owl
properties that Henrik Ibsen does have. In this case, you might look to the dbpedia-owl:birthPlace
. Then you could get the name the country of the birth places:
select ?label {
dbpedia:Henrik_Ibsen
dbpedia-owl:birthPlace
[ a dbpedia-owl:Country ;
rdfs:label ?label ]
}
You might want to narrow the permissible languages:
select ?label {
dbpedia:Henrik_Ibsen
dbpedia-owl:birthPlace
[ a dbpedia-owl:Country ;
rdfs:label ?label ]
filter langMatches(lang(?label),"en")
}
Those queries will produce the name of the country, but it wanted the corresponding demonym, you can get the dbpedia-owl:demonym
value of the country, if it's available. It's probably best to make the demonym optional, since a cursory investigation suggests that lots of countries in DBpedia don't have a value for it, so the name of the country may be the only option. E.g.,
select ?name ?demonym {
dbpedia:Henrik_Ibsen dbpedia-owl:birthPlace ?country .
?country a dbpedia-owl:Country ; rdfs:label ?name .
optional { ?country dbpedia-owl:demonym ?demonym }
filter langMatches(lang(?name),"en")
filter langMatches(lang(?demonym),"en")
}