Reputation: 1
I am trying to retrieve only English values and probably integers from dbpedia. For example, the following SPARQL query
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dbo: <http://dbpedia.org/ontology/>
select distinct ?p ?o where {
dbr:Cristiano_Ronaldo ?p ?o
filter(langMatches(lang(?o),'en'))}
}
It returns properly the English values. However it missed important details such as the date of birth, height, number of caps etc. are being missed because it is integer. How can make an RDF resultset that is consisting of a proper set of information about Cristiano Ronaldo?
Upvotes: 1
Views: 307
Reputation: 8465
PREFIX dbr: <http://dbpedia.org/resource/>
SELECT DISTINCT ?p ?o where {
dbr:Cristiano_Ronaldo ?p ?o
BIND(datatype(?o) as ?dt)
FILTER(IF(isliteral(?o) && !bound(?dt), langMatches(lang(?o),'en'), true))
}
Upvotes: 2