Do you know about DBpedia? It’s a project that lets you perform complex queries on the content of wikipedia. I’ve been playing with it a bit and want to share some examples. Try to come up with cool queries!
To query DBpedia, there is convenient form. Queries are performed in SPARQL. SPARQL is a query language that takes some getting used to. So I’ll start with a few simple examples.
A query for all articles with an image:
SELECT ?a, ?b WHERE {
?a foaf:img ?b
}
A list of all drugs:
SELECT ?a WHERE {
?a skos:subject <http://dbpedia.org/resource/Category:Drugs>
}
Everything with an LGPL license:
SELECT ?a WHERE {
?a dbpedia2:license "LGPL"@en
}
SELECT ?a WHERE {
:Chair rdfs:label ?a
}
All carnivors that had their name stolen:
SELECT ?a, ?b WHERE {
?a dbpedia2:disambiguates ?b .
?a dbpedia2:ordo :Carnivora
}
SELECT ?a, ?b WHERE {
?a skos:subject <http://dbpedia.org/resource/Category:Linux_kernel_hackers> .
?a dbpedia2:spouse ?b
}
All pages that redirect to a plant:
SELECT ?a, ?b WHERE {
?a dbpedia2:redirect ?b .
?b dbpedia2:regnum :Plant
}
A query for all green plants:
SELECT ?a WHERE {
?a dbpedia2:regnum :Plant .
?a dbpedia2:color "green"@en
}
Comments
Post a comment