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
{{ message }}
Repository navigation
Commit 32b44b1
Browse filesBrowse the repository at this point in the historyBrowse files
You can declare and consume query parameters inside `.rq` files using the RDF property/function identified by `https://sparqlc.described.at/param` (IRI). Use a prefix for convenience:
82
+
You can declare and consume query parameters inside `.rq` files using the SPARQL function identified by `https://sparqlc.described.at/param` (IRI). Use a prefix for convenience:
83
83
84
84
```sparql
85
85
PREFIX sparqlc: <https://sparqlc.described.at/>
86
86
```
87
87
88
-
-(Recommended) Function style: `sparqlc:param("name")`
88
+
-Parameter function: `sparqlc:param("name")` or `sparqlc:param(prefix:name)`
89
89
- Can be easily inlined in `BIND`, `FILTER`, or anywhere an expression is allowed.
90
+
- String literal keys: `BIND(sparqlc:param("minAge") AS ?minAge)`
91
+
- NamedNode / IRI keys: `BIND(sparqlc:param(schema:mainEntity) AS ?entity)`
- `Map<Term, Term | Term[]>` to use NamedNode parameter names
126
113
- Values are RDFJS `Term`s. For typed literals, construct them via your RDF environment (e.g., `@zazuko/env`).
127
114
128
115
Notes
129
116
- The parameter IRI is exactly `https://sparqlc.described.at/param`.
130
-
- Use `PREFIX sparqlc: <https://sparqlc.described.at/>` so `sparqlc:param` expands to that IRI in both triple and function forms.
117
+
- Use `PREFIX sparqlc: <https://sparqlc.described.at/>` so `sparqlc:param` expands to that IRI.
131
118
- Arrays (`Term[]`) are supported by the runtime API for positions that accept multiple terms (e.g., via custom processors). Your usage may vary depending on processors you apply.
Queries can declare variables to be bound at execution time. Provide a map of RDF terms as the first argument. Keys may be full variable names or well‑known IRIs (helpful with `@zazuko/env`).
67
+
Queries can declare variables and placeholders to be bound at execution time using the `sparqlc:param` SPARQL function.
BIND(IRI(sparqlc:param(schema:mainEntity)) AS ?fruit)
104
+
105
+
?fruit rdfs:label ?label .
106
+
}
107
+
```
108
+
109
+
-**In `FILTER` expressions**:
110
+
```sparql
111
+
PREFIX sparqlc: <https://sparqlc.described.at/>
112
+
113
+
SELECT ?s ?val WHERE {
114
+
?s ?p ?val .
115
+
FILTER(?val = sparqlc:param("expected"))
116
+
}
117
+
```
118
+
119
+
-**Scoped evaluation**: `sparqlc:param` can be used inside `GRAPH`, `OPTIONAL`, `SERVICE`, `MINUS`, unions, sub-selects, and update operations (`INSERT`, `DELETE`). Parameter values are injected into the query via appropriately scoped `VALUES` clauses according to SPARQL bottom-up evaluation semantics.
120
+
121
+
##### Passing parameters at execution time
122
+
123
+
Pass parameter values as the first argument(s) to the imported query function. `sparqlc` supports several formats:
0 commit comments