-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevices.rq
36 lines (35 loc) · 1.61 KB
/
devices.rq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xs: <http://www.w3.org/2001/XMLSchema#>
PREFIX default-context: <https://uri.etsi.org/ngsi-ld/default-context/>
PREFIX ex: <https://example.org/>
PREFIX ldes: <https://w3id.org/ldes#>
PREFIX ngsi-ld: <https://uri.etsi.org/ngsi-ld/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX terms: <http://purl.org/dc/terms/>
PREFIX tree: <https://w3id.org/tree#>
PREFIX vocab: <https://purl.org/geojson/vocab#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geoc: <https://opengis.net/def/function/geosparql/custom#>
CONSTRUCT {
?devices rdf:type default-context:Device.
?devices terms:isVersionOf ?devicesversion.
?devices prov:generatedAtTime ?generattime.
?devices geo:asWKT ?wktl.
?devices ex:test ?test
} WHERE {
?devices rdf:type default-context:Device.
?devices terms:isVersionOf ?devicesversion.
?devices prov:generatedAtTime ?generattime.
?devices ngsi-ld:location ?location .
?location ngsi-ld:hasValue ?value.
?value rdf:type ?type.
?value vocab:coordinates (?x ?y).
BIND(SUBSTR(STR(?x), 1, 15) AS ?lon)
BIND(SUBSTR(STR(?y), 1, 15) AS ?lat)
BIND(CONCAT("POINT(", STR(?lon), " ", STR(?lat), ")") AS ?wkt)
BIND(STRDT(?wkt, geo:wktLiteral) AS ?wktl)
BIND (geoc:lastCoordinate(?wkt) as ?test)
}