Skip to content

Instantly share code, notes, and snippets.

@earthquakesan
Created November 9, 2017 09:06
Show Gist options
  • Select an option

  • Save earthquakesan/96bf3859874b886963e430018474b725 to your computer and use it in GitHub Desktop.

Select an option

Save earthquakesan/96bf3859874b886963e430018474b725 to your computer and use it in GitHub Desktop.
Example queries for DBpedia 2016-10

Washington population

PREFIX  dc:   <http://purl.org/dc/elements/1.1/>
PREFIX  dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX  geo:  <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX  foaf: <http://xmlns.com/foaf/0.1/>
PREFIX  dbpedia-prop: <http://dbpedia.org/property/>
PREFIX  yago: <http://dbpedia.org/class/yago/>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  umbel-sc: <http://umbel.org/umbel/sc/>
PREFIX  dbpedia: <http://dbpedia.org/>
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  skos: <http://www.w3.org/2004/02/skos/core#>

SELECT DISTINCT *
WHERE
{ 
  {   
    { ?place  rdfs:label  "Washington"@en .}
      UNION
    { ?place  rdfs:label  "Washington, United States"@en .}
      UNION
    { ?place  dbpedia-prop:officialName  "Washington"@en .}
      UNION
    { ?place  dbpedia-prop:name  "Washington"@en .}
      UNION
    { ?place  foaf:name  "Washington"@en .}
      UNION
    { ?place  owl:sameAs  <http://rdf.freebase.com/ns/guid.9202a8c04000641f80000000000bbcd1> .}
  }
  {   
    { 
      ?place rdf:type <http://dbpedia.org/ontology/Place> .
      ?place <http://dbpedia.org/ontology/populationTotal> ?population .
    }
  }
}

SKOS Broader

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT * 
WHERE { 
  ?category skos:broader <http://dbpedia.org/resource/Category:Volcanism_of_Zealandia> .
}

Populated Place

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
SELECT *
WHERE { 
  ?s rdfs:label ?label .
  ?s wgs84_pos:lat ?lat .
  ?s wgs84_pos:long ?long .
  ?s rdf:type dbpedia:Place .
  ?s dbpedia:populationTotal ?population .
}
limit 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment