sparql-examples

A set of SPARQL examples that are used in different AMC resources

View the Project on GitHub AmsterdamUMC/sparql-examples

NGRC_003

TODO

Use at

PREFIX owl:  <http://www.w3.org/2002/07/owl#>
PREFIX geom: <http://geovocab.org/geometry#>
PREFIX ogc:  <http://www.opengis.net/ont/geosparql#>
PREFIX lgdo: <http://linkedgeodata.org/ontology/>
PREFIX bif:  <http://www.openlinksw.com/schemas/bif#> 
    
SELECT (COUNT(?x) AS ?amenityCount)
WHERE{
         ?s
         owl:sameAs <http://dbpedia.org/resource/Leipzig_Hauptbahnhof> ;
         geom:geometry [
         ogc:asWKT ?sg
         ] .

         ?x
         a lgdo:Amenity ;
         rdfs:label ?l ;
         geom:geometry [
         ogc:asWKT ?xg
                   ] .
         Filter(bif:st_intersects (?sg, ?xg, 0.1)) .
         }

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?amenityCount")
  v5("?l")
  v3("?s")
  v1("?sg")
  v4("?x"):::projected 
  v2("?xg")
  a1((" "))
  a2((" "))
  c3([http://dbpedia.org/resource/Leipzig_Hauptbahnhof]):::iri 
  c7([http://linkedgeodata.org/ontology/Amenity]):::iri 
  f0[["http://www.openlinksw.com/schemas/bif#st_intersects(?sg,?xg,'0.1^^xsd:decimal')"]]
  f0 --> v1
  f0 --> v2
  v3 --"owl:sameAs"-->  c3
  a1 --http://www.opengis.net/ont/geosparql#asWKT-->  v1
  v3 --http://geovocab.org/geometry#geometry-->  a1
  v4 --"a"-->  c7
  v4 --"rdfs:label"-->  v5
  a2 --http://www.opengis.net/ont/geosparql#asWKT-->  v2
  v4 --http://geovocab.org/geometry#geometry-->  a2
  bind2[/"count(?x)"/]
  v4 --o bind2
  bind2 --as--o v6