1

What I want from my sparql query is to not only get a list of all the European countries, but I want all the info they have. For instance, their capital, currency, areaKM and so on. The end goal is to use the datasets I aquired in protege. The query I have tried looked like this:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX yago: <http://dbpedia.org/class/yago/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX db: <http://dbpedia.org/>
PREFIX dbp: <http://dbpedia.org/property/>

SELECT DISTINCT ?country ?capital ?area ?currency ?wealth

WHERE {

?country rdf:type yago:EuropeanCountries;
    dbo:capital ?capital;
    dbp:areaKm ?area;
    dbp:currencyCode ?currency;
    dbp:gdpPppPerCapita ?wealth .
}

This seemed to work at first, but as of yesterday it won't anymore. So my question is, how do i get all european countries and their properties given by dbpedia using sparql.

Thanks in advance!

David
  • 2,987
  • 1
  • 29
  • 35

1 Answers1

3

Since yesterday, DBpedia 2016-04 is loaded into http://dbpedia.org/sparql and as far as I can see, the YAGO data isn't loaded (yet?)

At least, this simplified query already doesn't return any result:

PREFIX yago: <http://dbpedia.org/class/yago/>
SELECT DISTINCT * WHERE {
   ?country a yago:EuropeanCountries    
}

Alternative query using the DBpedia categories (and your YAGO type is more or less the same):

PREFIX  dbo:  <http://dbpedia.org/ontology/>
PREFIX  yago: <http://dbpedia.org/class/yago/>
PREFIX  dbp:  <http://dbpedia.org/property/>
PREFIX  dct:  <http://purl.org/dc/terms/>

SELECT DISTINCT  *
WHERE
  { ?country  dct:subject  <http://dbpedia.org/resource/Category:Countries_in_Europe> ;
              dbo:capital  ?capital
    OPTIONAL
      { ?country  dbp:areaKm  ?area }
    OPTIONAL
      { ?country  dbp:currencyCode  ?currency }
    OPTIONAL
      { ?country  dbp:gdpPppPerCapita  ?wealth }
  }

Note, that I put some properties into an OPTIONAL as at least for dbp:currencyCode and dbp:gdpPppPerCapita there is no data (anymore?).

UninformedUser
  • 8,397
  • 1
  • 14
  • 23