Skip to content

Commit 49fe2af

Browse files
authored
build(deps): update RDF/JS packages (#467)
* build(deps): update RDF/JS packages * fix: include NegatedPropertySet * test: NegatedPropertySet
1 parent 5931638 commit 49fe2af

File tree

9 files changed

+158
-120
lines changed

9 files changed

+158
-120
lines changed

.changeset/stupid-doors-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hydrofoil/shape-to-query": patch
3+
---
4+
5+
Update RDF/JS-related packages

package-lock.json

Lines changed: 108 additions & 103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"devDependencies": {
2020
"@changesets/cli": "^2.27.11",
21-
"@rdfjs/types": "^1.1.2",
21+
"@rdfjs/types": "^2",
2222
"@tpluscode/eslint-config": "0.6.4",
2323
"@types/chai-subset": "^1",
2424
"@types/mocha": "^10.0.10",

packages/demo/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"@rdfjs-elements/rdf-editor": "^0.5.10",
1818
"@rdfjs-elements/sparql-editor": "^0.2.2",
1919
"@shoelace-style/shoelace": "^2.20.1",
20-
"@tpluscode/rdf-ns-builders": "^4",
20+
"@tpluscode/rdf-ns-builders": "^5",
2121
"@tpluscode/rdf-string": "^1.3.4",
22-
"@tpluscode/sparql-builder": "^2.0.2",
23-
"@zazuko/env": "^2.5.1",
24-
"@zazuko/env-node": "^2.1.1",
22+
"@tpluscode/sparql-builder": "^3",
23+
"@zazuko/env": "^3",
24+
"@zazuko/env-node": "^3",
2525
"is-graph-pointer": "^2",
2626
"lit": "^3",
2727
"rdf-literal": "^2.0.0",

packages/processor/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ export default abstract class ProcessorImpl<F extends DataFactory = DataFactory>
309309
}
310310

311311
processPropertyPath(path: sparqljs.PropertyPath): sparqljs.PropertyPath {
312+
if (path.pathType === '!') {
313+
return this.processNegatedPropertySet(path)
314+
}
315+
312316
return {
313317
...path,
314318
items: path.items.map(item => match(item)
@@ -318,6 +322,21 @@ export default abstract class ProcessorImpl<F extends DataFactory = DataFactory>
318322
}
319323
}
320324

325+
private processNegatedPropertySet(path: sparqljs.NegatedPropertySet): sparqljs.NegatedPropertySet {
326+
return {
327+
...path,
328+
items: path.items.map(item => match(item)
329+
.with({ type: 'path', pathType: '^' }, ({ items: [term], ...path }) => {
330+
return {
331+
...path,
332+
items: [this.processIriTerm(term)] as [sparqljs.IriTerm],
333+
}
334+
})
335+
.with({ termType: 'NamedNode' }, iri => this.processIriTerm(iri))
336+
.otherwise(() => item)), // other cases are not supported
337+
}
338+
}
339+
321340
processGroup(group: sparqljs.GroupPattern) : sparqljs.Pattern {
322341
return {
323342
...group,

packages/processor/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"devDependencies": {
2222
"@types/rdfjs__environment": "^1.0.0",
2323
"@types/rdfjs__data-model": "^2.0.9",
24-
"@types/rdfjs__term-set": "^2.0.0",
25-
"@zazuko/env": "^2",
24+
"@types/rdfjs__term-set": "^2.0.9",
25+
"@zazuko/env": "^3",
2626
"chai": "^5.2.0",
2727
"glob": "^11.0.2",
2828
"sparqljs": "^3.7.3"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PREFIX schema: <http://schema.org/>
2+
SELECT *
3+
WHERE {
4+
?resource1 (^schema:address|^schema:addressRegion) ?resource5.
5+
}

packages/shape-to-query/lib/PathVisitor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ export default class extends Path.PathVisitor<ShapePatterns, Context> {
146146
}
147147
}
148148

149+
visitNegatedPropertySet({ paths }: Path.NegatedPropertySet, { pathStart, pathEnd = this.variable() }: Context): ShapePatterns {
150+
throw new Error('NegatedPropertySet is not yet supported')
151+
}
152+
149153
private greedyPath({ path }: Path.ZeroOrMorePath | Path.OneOrMorePath, { pathStart, pathEnd = this.variable() }: Context): ShapePatterns {
150154
if (!(path instanceof Path.PredicatePath)) {
151155
throw new Error('Only Predicate Path is supported as child of *OrMorePaths')

packages/shape-to-query/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,36 @@
2828
"@tpluscode/rdf-ns-builders": ">=3.0.2",
2929
"@tpluscode/rdf-string": "^1.3.4",
3030
"@types/sparqljs": "^3.1.11",
31-
"@vocabulary/dash": "^1.0.4",
32-
"@vocabulary/dash-sparql": "^1.0.4",
33-
"@vocabulary/sh": "^1.1.5",
34-
"@zazuko/env": "^2.5.1",
31+
"@vocabulary/dash": "^1.0.5",
32+
"@vocabulary/dash-sparql": "^1.0.5",
33+
"@vocabulary/sh": "^1.1.6",
34+
"@zazuko/env": "^3",
3535
"@zazuko/prefixes": ">=2",
36-
"clownface-shacl-path": "^2.2",
37-
"is-graph-pointer": "^2.0.0",
36+
"clownface-shacl-path": "^2.4.0",
37+
"is-graph-pointer": "^2.2.0",
3838
"rdf-literal": "^2.0.0",
3939
"sparqljs": "^3.6.1",
4040
"ts-pattern": "^5.6.2"
4141
},
4242
"devDependencies": {
43-
"@tpluscode/sparql-builder": "^2.0.3",
43+
"@tpluscode/sparql-builder": "^3.0.1",
4444
"@types/chai": "^5.2.2",
4545
"@types/chai-string": "^1.4.5",
4646
"@types/debug": "^4.1.12",
4747
"@types/n3": "^1.24.2",
4848
"@types/sinon": "^17.0.3",
4949
"@types/sparql-http-client": "^3.0.5",
50-
"@types/sparqljs": "^3.1.10",
50+
"@types/sparqljs": "^3.1.12",
5151
"@types/wait-on": "^5.3.4",
52-
"@zazuko/env-node": "^2.1.3",
52+
"@zazuko/env-node": "^3",
5353
"assertion-error": "^2.0.1",
5454
"chai": "^5.2.0",
5555
"chai-string": "^1.5.0",
5656
"debug": "^4.4.0",
5757
"docker-compose": "^1.2.0",
5858
"glob": "^11.0.1",
5959
"mocha-chai-jest-snapshot": "^1.1.7",
60-
"mocha-chai-rdf": "^0.1.6",
60+
"mocha-chai-rdf": "^0.1.10",
6161
"n3": "^1.25.1",
6262
"oxigraph": "^0.4.9",
6363
"sinon": "^19.0.2",

0 commit comments

Comments
 (0)