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
Copy file name to clipboardExpand all lines: pages/docs/2_modify/advanced/algebra.md
+6-57Lines changed: 6 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,15 @@ correspond to exactly one SPARQL algebra operator type.
17
17
For example, [`@comunica/actor-query-operation-construct`](https://github.com/comunica/comunica/tree/master/packages/actor-query-operation-construct)
18
18
handles algebra operations with type `'construct'`.
19
19
20
-
## SPARQLAlgebra.js
20
+
## Traqula
21
21
22
22
Converting a query string to SPARQL algebra
23
23
happens in the [SPARQL Parse bus](/docs/modify/advanced/buses/#query-parse).
24
24
The [`@comunica/actor-query-parse-sparql`](https://github.com/comunica/comunica/tree/master/packages/actor-query-parse-sparql) actor
25
-
on this bus makes use of the [SPARQLAlgebra.js](https://github.com/joachimvh/SPARQLAlgebra.js) package.
25
+
on this bus makes use of the [Traqula framework](https://github.com/comunica/traqula).
26
26
27
-
Examples on how the conversion between SPARQL query string and SPARQL algebra happens can be found in the tests: https://github.com/joachimvh/SPARQLAlgebra.js/tree/master/test
27
+
Examples on how the conversion between SPARQL query string and SPARQL algebra happens can be found in [the specific SPARQL algebra 1.2 package](https://www.npmjs.com/package/@traqula/algebra-sparql-1-2).
28
+
Example transformations can be found as part of [Traqula's test suite](https://github.com/comunica/traqula/tree/main/packages/test-utils/statics/algebra).
This tool is therefore useful if you want to implement support for a SPARQL operator,
82
83
but you need to find out to what algebra operation this corresponds.
83
84
84
-
## Converting algebra into a SPARQL query
85
-
86
-
You can also apply the reverse transformation from algebra to SPARQL query string,
87
-
for which you will need to globally install [SPARQLAlgebra.js](https://github.com/joachimvh/SPARQLAlgebra.js):
88
-
```bash
89
-
$ npm install -g sparqlalgebrajs
90
-
$ sparqlalgebrajs -q -r '
91
-
{
92
-
"type": "project",
93
-
"input": {
94
-
"type": "bgp",
95
-
"patterns": [
96
-
{
97
-
"type": "pattern",
98
-
"termType": "Quad",
99
-
"value": "",
100
-
"subject": {
101
-
"termType": "Variable",
102
-
"value": "x"
103
-
},
104
-
"predicate": {
105
-
"termType": "Variable",
106
-
"value": "y"
107
-
},
108
-
"object": {
109
-
"termType": "Variable",
110
-
"value": "z"
111
-
},
112
-
"graph": {
113
-
"termType": "DefaultGraph",
114
-
"value": ""
115
-
}
116
-
}
117
-
]
118
-
},
119
-
"variables": [
120
-
{
121
-
"termType": "Variable",
122
-
"value": "x"
123
-
},
124
-
{
125
-
"termType": "Variable",
126
-
"value": "y"
127
-
},
128
-
{
129
-
"termType": "Variable",
130
-
"value": "z"
131
-
}
132
-
]
133
-
}
134
-
'
135
-
136
-
SELECT ?x ?y ?z WHERE { ?x ?y ?z }
137
-
```
85
+
> [!note]
86
+
> Before implementing support for a SPARQL operator, read our tutorial on [contributing an actor](../1_getting_started/5_contribute_actor.md) and [contributing a new operator](../1_getting_started/7_contribute_new_operation.md).
0 commit comments