This is a technical documentation on how to customize SPARQL queries over the Databus SPARQL API, so you can query exactly the download links that you need. Other useful pages:
https://databus.dbpedia.org/dbpedia/$group
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/generic> .
?dataset rdfs:comment ?comment . ?dataset dct:description ?description .
to queries.http://dbpedia.org/property
or http://$lang.dbpedia.org/property
as well as other standard vocabularies, such as foaf
, rdfs:label
, skos
, wgs84
. They have the broadest coverage and decent quality.
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dataid-cv: <http://dataid.dbpedia.org/ns/cv#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
# Get all latest English files of generic extraction
SELECT DISTINCT ?file ?shasum WHERE {
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/generic> .
?dataset dcat:distribution ?distribution .
?distribution dataid-cv:lang "en"^^xsd:string .
?dataset dct:hasVersion ?latestVersion .
{
SELECT (max(?version) as ?latestVersion) WHERE {
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/generic> .
?dataset dct:hasVersion ?version .
}
}
?distribution dcat:downloadURL ?file .
?distribution dataid:sha256sum ?shasum .
# debug will be removed in a while
FILTER NOT EXISTS {?distribution dataid-cv:tag 'debug'^^xsd:string} .
}
http://dbpedia.org/ontology/
predicates. They have a higher quality, but are fewer. They are an improved complement of the generic
module. Also ontology types using rdf:type
are in this module.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dataid-cv: <http://dataid.dbpedia.org/ns/cv#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
# Show all content variants of mappings, grouped by artifact
SELECT DISTINCT ?artifact ?cvproperty (group_concat(?cvtmp;separator=",") as ?cv) WHERE {
{
SELECT DISTINCT ?artifact ?cvproperty ?cvtmp {
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/mappings> .
?dataset dataid:artifact ?artifact .
?dataset dcat:distribution ?distribution .
?cvproperty rdfs:subPropertyOf dataid:contentVariant .
?distribution ?cvproperty ?cvtmp .
}
}
} GROUP BY ?artifact ?cvproperty
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dataid-cv: <http://dataid.dbpedia.org/ns/cv#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
# Get the 4 most popular mappings artifact, english only
SELECT DISTINCT ?file WHERE {
?dataset dcat:distribution ?distribution .
?dataset dct:hasVersion ?latestVersion .
?distribution dcat:downloadURL ?file .
# english
?distribution dataid:contentVariant "en"^^xsd:string .
{
?dataset dataid:artifact ?artifact .
FILTER (?artifact in (
<https://databus.dbpedia.org/dbpedia/mappings/mappingbased-literals>,
<https://databus.dbpedia.org/dbpedia/mappings/geo-coordinates-mappingbased>
)) .
} UNION {
?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/mappings/instance-types> .
# pre-calculated transitive closure overrdf:type
?distribution dataid:contentVariant "transitive"^^xsd:string .
} UNION {
?dataset dataid:artifact <https://databus.dbpedia.org/dbpedia/mappings/mappingbased-objects> .
?dataset dcat:distribution ?distribution .
# removes debugging info about disjoint domain and ranges
FILTER NOT EXISTS {?distribution dataid-cv:tag ?tag . }
}
{
SELECT (max(?version) as ?latestVersion) WHERE {
?dataset dataid:artifact ?artifact .
?dataset dct:hasVersion ?version .
FILTER (?artifact in (
<https://databus.dbpedia.org/dbpedia/mappings/instance-types>,
<https://databus.dbpedia.org/dbpedia/mappings/mappingbased-objects>,
<https://databus.dbpedia.org/dbpedia/mappings/mappingbased-literals>,
<https://databus.dbpedia.org/dbpedia/mappings/geo-coordinates-mappingbased>
)) .
}
}
}
generic
and mappings
. Uses http://wikidata.dbpedia.org/resource/Q[0-9+]
as subject. Also has configurable Mappings Extractor to map P[0-9]+
to http://dbpedia.org/ontology
and other standard vocabularies.PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
# Get all latest files of wikidata extraction
SELECT DISTINCT ?file ?shasum WHERE {
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/wikidata> .
?dataset dcat:distribution ?distribution .
?dataset dct:hasVersion ?latestVersion .
{
SELECT (max(?version) as ?latestVersion) WHERE {
?dataset dataid:group <https://databus.dbpedia.org/dbpedia/wikidata> .
?dataset dct:hasVersion ?version .
}
}
?distribution dcat:downloadURL ?file .
?distribution dataid:sha256sum ?shasum .
# debug will be removed in a while
FILTER NOT EXISTS {?distribution <http://dataid.dbpedia.org/ns/cv#tag> 'debug'^^<http://www.w3.org/2001/XMLSchema#string>} .
}
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
SELECT distinct ?file ?latestVersion ?mediatype WHERE {
?dataset dataid:artifact <https://databus.dbpedia.org/denis/ontology/dbo-snapshots> .
?dataset dcat:distribution ?distribution .
?distribution dcat:downloadURL ?file ;
dct:hasVersion ?latestVersion ;
# see all available mediatypes with
# dcat:mediaType ?mediaType .
dcat:mediaType <http://dataid.dbpedia.org/ns/mt#TextTurtle> .
{
SELECT (?version as ?latestVersion) WHERE {
?dataset dataid:artifact <https://databus.dbpedia.org/denis/ontology/dbo-snapshots> .
?dataset dct:hasVersion ?version .
} ORDER BY DESC (?version) LIMIT 1
}
}
Please read the docu at the databus: