You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the RSP-QL extension of the SPIN modeling vocabulary, which enables RSP-QL queries (see [link](https://github.com/streamreasoning/RSP-QL)) to be represented as RDF. In combination with the provided API queries can be converted to and from RDF, as well as support parameterization of queries into reusable query templates.
3
+
This is the RSP-QL extension of the SPIN modeling vocabulary, which enables RSP-QL queries (see [link](https://github.com/streamreasoning/RSP-QL)) to be represented as RDF. In combination with the provided API queries can be converted to and from RDF, and queries can be parameterized into reusable query templates that support parameter constraints.
4
4
5
5
Below is a sample query demonstrating how an RSP-QL query would be represented as RDF:
Now, let's assume we wish to use this query to create a template that allows us to specify the distance to filter on as a query template parameter. We modify the query slightly, replacing ```FILTER ( ?distance > 2 )``` with ```FILTER ( ?distance > ?limit )``` and to make the template even more flexible let's assume that we also replace the name of the output stream (```:rideCount```) and input stream (```:trips```) with the variables ```?input``` and ```?output```.
59
-
```
60
-
# Modifed query
61
-
# Get the number of taxi rides that exceeded a certain distance in miles in the last hour.
We can now specify a template over the query, and we can instantiate it multiple time with different sets of bindings for the three parameters (```spl:Argument```):
66
+
67
+
Now, let's use define a template over this query allowing us to specify the ```limit``` variable of the query as an integer with a default value, and require that the ```inputStream``` and ```outputStream``` are provided as URIs.
77
68
```
78
69
@prefix : <http://debs2015.org/streams/> .
79
70
@prefix spin: <http://spinrdf.org/spin#> .
@@ -84,7 +75,7 @@ We can now specify a template over the query, and we can instantiate it multiple
84
75
@prefix spl: <http://spinrdf.org/spl#> .
85
76
86
77
:t1 a spin:Template ;
87
-
spin:body :q1 ;
78
+
spin:body <http://example.org/query/1> ;
88
79
spin:constraint [ a spl:Argument ;
89
80
rdfs:comment "Get the taxi rides that exceeded this limit in the last hour." ;
90
81
spl:defaultValue 2 ;
@@ -94,18 +85,17 @@ We can now specify a template over the query, and we can instantiate it multiple
94
85
] ;
95
86
spin:constraint [ a spl:Argument ;
96
87
rdfs:comment "Represents the URI identifier of the input stream." ;
97
-
spl:optional false ;
98
-
spl:predicate arg:input ;
99
-
spl:valueType rdfs:Resource
100
-
] ;
101
-
spin:constraint [ a spl:Argument ;
102
-
rdfs:comment "Represents the URI identifier of the resulting stream." ;
103
-
spl:optional false ;
104
-
spl:predicate arg:output ;
105
-
spl:valueType rdfs:Resource
106
-
] .
88
+
spl:optional false ;
89
+
spl:predicate arg:inputStream ;
90
+
spl:valueType rdfs:Resource
91
+
] ;
92
+
spin:constraint [ a spl:Argument ;
93
+
rdfs:comment "Represents the URI identifier of the resulting stream." ;
94
+
spl:optional false ;
95
+
spl:predicate arg:outputStream ;
96
+
spl:valueType rdfs:Resource
97
+
] .
107
98
```
108
99
109
100
110
101
See <http://spinrdf.org/spin.html> for details about the SPIN Modeling Vocabulary.
0 commit comments