0
votes

I'm making first steps in querying DBPedia - sorry for my lack of experience. I'm trying to get a list of Polish Kings, with Virtuoso SPARQL Query Editor (http://dbpedia.org/sparql). The ontology is listed here:

http://dbpedia.org/ontology/PolishKing

But I cannot get this query working.

I've tried below three, without success:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?label
WHERE { <http://dbpedia.org/resource/PolishKing> rdfs:label ?label }

-

select ?type {
   ?type a owl:PolishKing .
}

-

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT DISTINCT ?person {
    { ?person a dbpedia-owl:PolishKing }
}

Can You please help with my first query to DBPedia ? Thank You

1

1 Answers

0
votes

I found the solution. Unfortunately this ontology I mentioned above is empty, and it was a reason why my queries didn't work. I didn't know that. But,

This query (to a 'Person' in general) makes the job:

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbprop: <http://dbpedia.org/property/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT SAMPLE(?name) WHERE {
        ?person foaf:name ?name .
    ?person rdf:type dbo:Person .
    ?person dbprop:title :List_of_Polish_monarchs . 
        ?person dc:description ?description
        FILTER regex(?description, "King")
}
GROUP BY ?person