-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.sparql
35 lines (30 loc) · 1.06 KB
/
example.sparql
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
#example.sparql
#==============
PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX q: <http://qrowd-project.eu/ontology/>
CONSTRUCT {
GRAPH eg:myGraph {
?s
a q:BikeStation ;
q:id ?id ;
rdfs:label ?name ;
wgs:long ?x ;
wgs:lat ?y ;
.
}
}
{
# url:text is a property function that fetches the content of subject URL and
# makes it available as a SPARQL result set row via the object variable
<https://raw.githubusercontent.com/QROWD/QROWD-RDF-Data-Integration/master/datasets/1014-electric-bikesharing-stations/trento-bike-sharing.json> url:text ?src .
BIND(json:parse(?src) AS ?json) .
# Unnest each item of the json array into its own SPARQL result set row
?json json:unnest ?i .
# For each row, craft the values for the CONSTRUCT template
BIND("http://qrowd-project.eu/resource/" AS ?ns)
BIND(json:path(?i, "$.id") AS ?id)
BIND(URI(CONCAT(?ns, ENCODE_FOR_URI(?id))) AS ?s)
BIND(json:path(?i, "$.name") AS ?name)
BIND(json:path(?i, "$.position[0]") AS ?x)
BIND(json:path(?i, "$.position[1]") AS ?y)
}