@manta-eu/rdf-lib 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"shacl-shape-query.d.ts","sourceRoot":"","sources":["../src/shacl-shape-query.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAwBrF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA0B1F"}
1
+ {"version":3,"file":"shacl-shape-query.d.ts","sourceRoot":"","sources":["../src/shacl-shape-query.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAwBrF;AAMD,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAiC1F"}
@@ -36,12 +36,17 @@ export function buildShaclPropertyQuery(shapeIri, propertyIri) {
36
36
  }
37
37
  `.build();
38
38
  }
39
+ // The generated sh namespace carries only the terms the shapes currently use, so naming this
40
+ // one directly keeps the query working whether or not a shape declares a default.
41
+ const shaclDefaultValue = `${namespaces.sh}defaultValue`;
39
42
  export function buildShaclShapeSummaryQuery(shapeIri, propertyIri) {
40
43
  const shape = dataFactory.namedNode(shapeIri);
41
44
  const propertyPath = propertyIri
42
45
  ? sparql `?propertyShape ${dataFactory.namedNode(sh.path)} ?path . VALUES ?path { ${dataFactory.namedNode(propertyIri)} }`
43
46
  : sparql `?propertyShape ${dataFactory.namedNode(sh.path)} ?path .`;
44
- return SELECT `DISTINCT ?targetClass ?propertyShape ?path ?name ?description ?minCount ?maxCount ?datatype ?class ?node`
47
+ const rdfFirst = dataFactory.namedNode(`${namespaces.rdf}first`);
48
+ const rdfRest = dataFactory.namedNode(`${namespaces.rdf}rest`);
49
+ return SELECT `DISTINCT ?targetClass ?propertyShape ?path ?name ?description ?minCount ?maxCount ?datatype ?class ?node ?pattern ?message ?hasValue ?defaultValue ?inValue`
45
50
  .WHERE `
46
51
  GRAPH ${dataFactory.namedNode(shaclGraphIri)} {
47
52
  {
@@ -58,6 +63,11 @@ export function buildShaclShapeSummaryQuery(shapeIri, propertyIri) {
58
63
  OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.datatype)} ?datatype . }
59
64
  OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.class)} ?class . }
60
65
  OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.node)} ?node . }
66
+ OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.pattern)} ?pattern . }
67
+ OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.message)} ?message . }
68
+ OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.hasValue)} ?hasValue . }
69
+ OPTIONAL { ?propertyShape ${dataFactory.namedNode(shaclDefaultValue)} ?defaultValue . }
70
+ OPTIONAL { ?propertyShape ${dataFactory.namedNode(sh.in)}/${rdfRest}*/${rdfFirst} ?inValue . }
61
71
  }
62
72
  }
63
73
  `.ORDER_BY `?path`.build();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manta-eu/rdf-lib",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Namespace prefixes, CURIE helpers and JSON-LD types for the Manta knowledge graph",
5
5
  "exports": {
6
6
  "./action-plan-schemas": {
@@ -35,14 +35,14 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "ldkit": "2.8.0",
39
- "@manta-eu/ldo": "0.1.2"
38
+ "ldkit": "^2.8.0",
39
+ "@manta-eu/ldo": "0.1.3"
40
40
  },
41
41
  "devDependencies": {
42
42
  "rimraf": "^6.1.3",
43
43
  "tsc-alias": "^1.9.5",
44
- "typescript": "^5.0.0",
45
- "vitest": "^3.0.0"
44
+ "typescript": "^5.9.3",
45
+ "vitest": "^4.1.8"
46
46
  },
47
47
  "files": [
48
48
  "dist"