August 23rd, 2018
Wouter Beek (wouter@triply.cc)
bind
prefix brt: <http://brt.basisregistraties.overheid.nl/def/top10nl#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?shape ?shapeLabel {
?place1 brt:isBAGwoonplaats true;
geo:hasGeometry/geo:asWKT ?shape;
rdfs:label "Swalmen"^^xsd:string.
service <https://dbpedia.org/sparql> {
?place2 foaf:depiction ?vlag;
rdfs:label "Swalmen"@nl.
}
}
limit 1
service <URL> { A }
means that
subquery A
is executed on a different
SPARQL endpoint. The results are received from that
endpoint, and integrated within the overall query
results.
prefix brt: <http://brt.basisregistraties.overheid.nl/def/top10nl#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?shape ?shapeLabel {
?place1 brt:isBAGwoonplaats true;
geo:hasGeometry/geo:asWKT ?shape;
rdfs:label "Apeldoorn"^^xsd:string.
service <https://dbpedia.org/sparql> {
?place2 rdfs:label "Apeldoorn"@nl.
optional { ?place2 foaf:depiction ?vlag. }
}
}
limit 1
When you query the web, not all information is there all
the time. optional { A }
makes the query
resilient against missing information.
@WGJBeek