## Find Optician with 5km radius of Paris
## Endpoint: http://linkedgeodata.org/sparql
Prefix lgd:
Prefix lgdo:
describe ?optician from {
?paris owl:sameAs .
?paris geo:geometry ?parisgeo .
?optician a lgdo:Optician .
OPTIONAL {?optician rdfs:label ?name . }
?optician geo:geometry ?opticiangeo .
Filter(bif:st_intersects(?parisgeo, ?opticiangeo, 5))
}
## Find Places of Worship within close proximity of Cafe's in Paris
prefix rdftb:
construct {
?cafe rdfs:label ?cafename;
geo:geometry ?cafegeo;
rdftb:useMarker 'coffee'.
?church rdfs:label ?churchlabel;
rdftb:useMarker 'star';
geo:geometry ?churchgeo.
}
WHERE
{
?church a lgv:place_of_worship .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
?cafe a lgv:cafe .
?cafe lgv:name ?cafename .
?cafe geo:geometry ?cafegeo .
FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498,48.853 ) ,5 ) && bif:st_intersects ( ?cafegeo, ?churchgeo, 0.9 ) )
}
LIMIT 50
## Any Data Object with Latitude or Longitude
SELECT DISTINCT *
WHERE {?s ?p ?o.
?o geo:lat ?lat.
?o geo:long ?long.
?s a ?type}
limit 100
# Generic Query for iPhone and other devices that share Geo Coordinates
# with host applications and services.
# Quest: Find me 100 or less things within 2KM
# Radius of my current location.
# Note: a Macro Enhancement to SPARQL is used to grab
# and incorporate Geo Coordinates.
PREFIX foaf:
PREFIX lgv:
CONSTRUCT {
?thing rdfs:type ?type;
geo:geometry ?geo;
foaf:name ?name}
WHERE {
?thing geo:geometry ?geo .
?thing lgv:name ?name .
?thing a ?type.
FILTER (bif:st_intersects (?geo, bif:st_point (__P_LON__, __P_LAT__), 2))
}
ORDER BY ASC (bif:st_distance (?geo, bif:st_point (__P_LON__, __P_LAT__)))
LIMIT 100
## Find Things around Trafalgar Square
##
PREFIX foaf:
PREFIX lgv:
construct {?thing a ?type;
geo:geometry ?geo;
foaf:name ?name}
where {
?thing geo:geometry ?geo .
?thing lgv:name ?name .
?thing a ?type.
FILTER (bif:st_intersects (?geo, bif:st_point (-0.128056, 51.508057), 2))
}
LIMIT 100
## Optimized access to 100 GeoSpatial Entities via SELECT
##
SELECT DISTINCT ?s ( bif:round ( ?lat ) ) AS ?lat ( bif:round ( ?long ) ) AS ?long WHERE
{
{
SELECT ?g ?s WHERE
{
graph ?g
{
?s geo:geometry ?geo
}
}
LIMIT 100
}
graph ?g
{
?s geo:lat ?lat .
?s geo:long ?long .
}
FILTER ( datatype ( ?lat ) IN ( xsd:integer, xsd:float, xsd:double ) ) .
FILTER ( datatype ( ?long ) IN ( xsd:integer, xsd:float, xsd:double ) ) .
FILTER ( ?lat < -80.000 && ?long > -140.000 )
}
LIMIT 100
## 100 GeoSpatial Entities via SELECT
SELECT DISTINCT ?s (bif:round(?lat)) as ?lat (bif:round(?long)) as ?long
WHERE {
?s geo:geometry ?geo .
?s geo:lat ?lat.
?s geo:long ?long.}
LIMIT 100
## 100 GeoSpatial Entities
DESCRIBE ?s
WHERE {
?s geo:geometry ?geo .
?s geo:lat ?lat.
?s geo:long ?long.}
LIMIT 100
##
PREFIX lgv:
PREFIX rtb:
CONSTRUCT { ?s geo:geometry ?geo;
rtb:useMarker '01';
geo:lat ?lat;
geo:long ?long. }
WHERE { ?s geo:geometry ?geo .
?s geo:lat ?lat.
?s geo:long ?long.}
## Places of worship, within 5 km of Paris, that have cafes in close proximity(0.2 km)
PREFIX lgv:
SELECT DISTINCT ?cafe ?lat ?long ?cafename ?churchname (bif:round(bif:st_distance (?churchgeo, ?cafegeo)))
WHERE { ?church a lgv:place_of_worship .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
?cafe a lgv:cafe .
?cafe lgv:name ?cafename .
?cafe geo:geometry ?cafegeo .
?cafe geo:lat ?lat.
?cafe geo:long ?long.
FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
bif:st_intersects (?cafegeo, ?churchgeo, 0.2)) }
LIMIT 100
## describe places of worship, within 5 km of Paris, with cafes in close proximity(0.2 km)
PREFIX lgv:
DESCRIBE ?cafe ?church
WHERE { ?church a lgv:place_of_worship .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
?cafe a lgv:cafe .
?cafe lgv:name ?cafename .
?cafe geo:geometry ?cafegeo .
?cafe geo:lat ?lat.
?cafe geo:long ?long.
FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
bif:st_intersects (?cafegeo, ?churchgeo, 0.2)) }
LIMIT 100
### construct a custom Linked Data Mesh (graph) about:
### places of worship, within 5 km of Paris, that have cafes in close proximity(0.2 km)
### Note: we have distinct pin colors that identify for places of worship distinct from cafes
PREFIX lgv:
PREFIX rtb:
CONSTRUCT { ?cafe geo:geometry ?cafegeo ;
rtb:useMarker '01' ;
lgv:name ?cafename .
?church geo:geometry ?churchgeo ;
lgv:religion ?religion;
rtb:useMarker '02' ;
lgv:name ?churchname. }
WHERE { ?church a lgv:place_of_worship .
?church geo:geometry ?churchgeo ;
lgv:name ?churchname;
lgv:religion ?religion.
?cafe a lgv:cafe .
?cafe geo:geometry ?cafegeo .
?cafe lgv:name ?cafename .
FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
bif:st_intersects (?cafegeo, ?churchgeo, 0.2)) }
### Things within 10 km proximity of place of worship
PREFIX lgv:
SELECT ?c COUNT (*)
WHERE {
?s a ?c .
?s a lgv:place_of_worship .
?s geo:geometry ?geo .
filter (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 10))
}
GROUP BY ?c order by desc 2 LIMIT 200
###Stuff around Notre Dame de Paris
PREFIX lgv:
SELECT ?s ?cn ?lat ?long
WHERE {
?s lgv:name ?cn .
?s geo:geometry ?geo .
?s geo:lat ?lat.
?s geo:long ?long.
filter (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3)) }
LIMIT 20
###Stuff around Notre Dame de Paris
PREFIX lgv:
DESCRIBE ?s
WHERE {
?s lgv:name ?cn .
?s geo:geometry ?geo .
?s geo:lat ?lat.
?s geo:long ?long.
filter (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3)) }
LIMIT 20
## Cities within 30 km proximity of London
SELECT ?m (bif:round(bif:st_distance (?geo, ?gm)))
WHERE { geo:geometry ?gm .
?m geo:geometry ?geo .
?m a .
filter (bif:st_intersects (?geo, ?gm, 30))}
ORDER BY DESC 2
LIMIT 20
###
select ?s (sql:num_or_null (?p)) count (*) where
{ ?s ?p .
filter ( sql:num_or_null (?p) > 6000000) . ?s geo:geometry ?geo .
filter (bif:st_intersects (?pt, ?geo,2)) . ?xx geo:geometry ?pt }
group by ?s (sql:num_or_null (?p))
order by desc 3 limit 20
##Places of Worship close to Cafes near Paris.
PREFIX lgv:
PREFIX rtb:
construct { ?cafe geo:geometry ?cafegeo ;
rtb:useMarker '01' ;
lgv:name ?cafename .
?church geo:geometry ?churchgeo ;
rtb:useMarker '02' ;
lgv:name ?churchname}
WHERE { ?church a lgv:place_of_worship .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
?cafe a lgv:cafe .
?cafe geo:geometry ?cafegeo .
?cafe lgv:name ?cafename .
FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
bif:st_intersects (?cafegeo, ?churchgeo, 0.2)) }
### Motorways across England & Scotland from DBpedia
## Pictures Property Added
PREFIX rdfs:
PREFIX dbpprop:
PREFIX yago:
SELECT ?road ?services ?name ?lat ?long ?pics
WHERE {
{
?services dbpprop:road ?road .
?road a yago:MotorwaysInEngland .
?services dbpprop:lat ?lat;
dbpprop:long ?long;
dbpprop:name ?name;
dbpprop:hasPhotoCollection ?pics .
} UNION {
?services dbpprop:road ?road .
?road a yago:MotorwaysInScotland .
?services dbpprop:lat ?lat;
dbpprop:long ?long;
dbpprop:name ?name;
dbpprop:hasPhotoCollection ?pics .
}
}
### Motorways across England & Scotland from DBpedia
PREFIX rdfs:
PREFIX dbpprop:
PREFIX yago:
SELECT ?road ?services ?lat ?long
WHERE {
{
?services dbpprop:road ?road .
?road a yago:MotorwaysInEngland .
?services dbpprop:lat ?lat .
?services dbpprop:long ?long .
} UNION {
?services dbpprop:road ?road .
?road a yago:MotorwaysInScotland .
?services dbpprop:lat ?lat .
?services dbpprop:long ?long .
}
}
limit 20
### To be enhanced
PREFIX rdfs:
PREFIX dbpprop:
PREFIX yago:
PREFIX geo:
DESCRIBE ?services
WHERE {
{
?services dbpprop:road ?road .
?road a yago:MotorwaysInEngland .
?services dbpprop:lat ?lat .
?services dbpprop:long ?long .
} UNION {
?services dbpprop:road ?road .
?road a yago:MotorwaysInScotland .
?services dbpprop:lat ?lat .
?services dbpprop:long ?long .
}
}
limit 20