Skip to content

Instantly share code, notes, and snippets.

@cgueret
Last active December 14, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgueret/5098706 to your computer and use it in GitHub Desktop.
Save cgueret/5098706 to your computer and use it in GitHub Desktop.
Query to get a social network out of DBpedia
SELECT DISTINCT ?Source ?Target ?Label WHERE {
?country1 a <http://dbpedia.org/class/yago/EuropeanCountries>.
?country1 <http://dbpedia.org/ontology/officialLanguage> ?language.
?country2 a <http://dbpedia.org/class/yago/EuropeanCountries>.
?country2 <http://dbpedia.org/ontology/officialLanguage> ?language.
FILTER (?country1 != ?country2)
?country1 <http://www.w3.org/2000/01/rdf-schema#label> ?Source.
?country2 <http://www.w3.org/2000/01/rdf-schema#label> ?Target.
?language <http://www.w3.org/2000/01/rdf-schema#label> ?Label.
FILTER ((LANG(?Source) = "en") && (LANG(?Target) = "en") && (LANG(?Label) = "en"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment