@shaclmate/shacl-ast 3.0.4 → 4.0.0

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.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- export * from "./defaultFactory.js";
2
- export * from "./Factory.js";
3
1
  export * from "./IdentifierNodeKind.js";
4
2
  export * from "./NodeKind.js";
5
- export * from "./PropertyPath.js";
6
3
  export * from "./NodeShape.js";
7
4
  export * from "./Ontology.js";
5
+ export * from "./OntologyLike.js";
8
6
  export * from "./PropertyGroup.js";
9
7
  export * from "./PropertyShape.js";
10
8
  export * from "./Shape.js";
11
- export * from "./RdfjsShapesGraph.js";
9
+ export * from "./ShapesGraph.js";
12
10
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
- export * from "./defaultFactory.js";
2
- export * from "./Factory.js";
3
1
  export * from "./IdentifierNodeKind.js";
4
2
  export * from "./NodeKind.js";
5
- export * from "./PropertyPath.js";
6
3
  export * from "./NodeShape.js";
7
4
  export * from "./Ontology.js";
5
+ export * from "./OntologyLike.js";
8
6
  export * from "./PropertyGroup.js";
9
7
  export * from "./PropertyShape.js";
10
8
  export * from "./Shape.js";
11
- export * from "./RdfjsShapesGraph.js";
9
+ export * from "./ShapesGraph.js";
12
10
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "dependencies": {
3
- "@rdfjs/term-map": "^2.0.2",
4
- "@rdfjs/term-set": "^2.0.3",
5
- "@rdfjs/types": "^1.1.0",
6
- "@tpluscode/rdf-ns-builders": "^4.3.0",
7
- "@types/n3": "^1.26.0",
8
- "@types/rdfjs__term-map": "^2.0.10",
9
- "@types/rdfjs__term-set": "^2.0.9",
10
- "n3": "^1.26.0",
11
- "purify-ts": "^2.1.0",
12
- "rdfjs-resource": "1.0.24"
3
+ "@rdfjs/data-model": "~2.1.1",
4
+ "@rdfjs/dataset": "~2.0.2",
5
+ "@rdfjs/term-map": "~2.0.2",
6
+ "@rdfjs/term-set": "~2.0.3",
7
+ "@rdfjs/types": "~2.0.1",
8
+ "@tpluscode/rdf-ns-builders": "~4.3.0",
9
+ "@types/rdfjs__data-model": "~2.0.9",
10
+ "@types/rdfjs__dataset": "~2.0.7",
11
+ "@types/rdfjs__term-map": "~2.0.10",
12
+ "@types/rdfjs__term-set": "~2.0.9",
13
+ "purify-ts": "~2.1.4",
14
+ "rdfjs-resource": "3.0.6",
15
+ "typescript-memoize": "~1.1.1"
13
16
  },
14
17
  "devDependencies": {
15
- "@biomejs/biome": "1.9.4",
16
- "@tsconfig/node18": "^18.2.4",
17
- "@tsconfig/strictest": "^2.0.5",
18
- "@types/node": "^22",
19
- "depcheck": "^1.4.7",
20
- "rimraf": "^6.0.1",
21
- "typescript": "5.8.2",
22
- "vitest": "^3.2.4",
23
- "@vitest/coverage-v8": "^3.2.4"
18
+ "@tsconfig/node18": "~18.2.4",
19
+ "@tsconfig/strictest": "~2.0.8",
20
+ "@types/n3": "~1.26.0",
21
+ "@types/node": "~18",
22
+ "depcheck": "~1.4.7",
23
+ "n3": "~1.26.0",
24
+ "rimraf": "~6.0.1",
25
+ "ts-invariant": "~0.10.3",
26
+ "typescript": "5.9.3"
24
27
  },
25
28
  "files": [
26
29
  "dist/*.d.ts",
@@ -36,21 +39,14 @@
36
39
  },
37
40
  "scripts": {
38
41
  "build": "tsc -b",
39
- "build:noEmit": "tsc --noEmit",
40
- "check": "biome check",
41
- "check:write": "biome check --write",
42
- "check:write:unsafe": "biome check --write --unsafe",
43
42
  "clean": "rimraf dist",
44
43
  "depcheck": "depcheck .",
45
44
  "dev": "tsc -w --preserveWatchOutput",
46
- "dev:noEmit": "tsc --noEmit -w --preserveWatchOutput",
47
- "link-dependencies": "npm link rdfjs-resource",
48
- "test": "biome check && vitest run",
49
- "test:coverage": "biome check && vitest run --coverage",
50
- "test:watch": "biome check && vitest watch",
51
- "unlink": "npm unlink -g @shaclmate/shacl-ast"
45
+ "dev:tests": "tsc -p __tests__ -w --preserveWatchOutput",
46
+ "typecheck": "tsc --noEmit",
47
+ "typecheck:watch": "tsc --noEmit -w --preserveWatchOutput"
52
48
  },
53
49
  "type": "module",
54
50
  "types": "./dist/index.d.ts",
55
- "version": "3.0.4"
51
+ "version": "4.0.0"
56
52
  }
package/dist/Factory.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import type { Either } from "purify-ts";
2
- import type { Resource } from "rdfjs-resource";
3
- import type { OntologyLike } from "./OntologyLike.js";
4
- import type { ShapesGraph } from "./ShapesGraph.js";
5
- export interface Factory<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> {
6
- nodeShapeFromRdf(parameters: {
7
- resource: Resource;
8
- shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
9
- }): Either<Error, NodeShapeT>;
10
- ontologyFromRdf(parameters: {
11
- resource: Resource;
12
- shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
13
- }): Either<Error, OntologyT>;
14
- propertyGroupFromRdf(parameters: {
15
- resource: Resource;
16
- shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
17
- }): Either<Error, PropertyGroupT>;
18
- propertyShapeFromRdf(parameters: {
19
- resource: Resource;
20
- shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
21
- }): Either<Error, PropertyShapeT>;
22
- }
23
- //# sourceMappingURL=Factory.d.ts.map
package/dist/Factory.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Factory.js.map
@@ -1,41 +0,0 @@
1
- import type { NamedNode } from "@rdfjs/types";
2
- import { Either } from "purify-ts";
3
- import { Resource } from "rdfjs-resource";
4
- export interface AlternativePath {
5
- readonly kind: "AlternativePath";
6
- readonly members: readonly PropertyPath[];
7
- }
8
- export interface InversePath {
9
- readonly kind: "InversePath";
10
- readonly path: PropertyPath;
11
- }
12
- export interface OneOrMorePath {
13
- readonly kind: "OneOrMorePath";
14
- readonly path: PropertyPath;
15
- }
16
- export interface PredicatePath {
17
- readonly iri: NamedNode;
18
- readonly kind: "PredicatePath";
19
- }
20
- export interface SequencePath {
21
- readonly kind: "SequencePath";
22
- readonly members: readonly PropertyPath[];
23
- }
24
- export interface ZeroOrMorePath {
25
- readonly kind: "ZeroOrMorePath";
26
- readonly path: PropertyPath;
27
- }
28
- export interface ZeroOrOnePath {
29
- readonly kind: "ZeroOrOnePath";
30
- readonly path: PropertyPath;
31
- }
32
- export type PropertyPath = AlternativePath | InversePath | OneOrMorePath | PredicatePath | SequencePath | ZeroOrMorePath | ZeroOrOnePath;
33
- export declare namespace PropertyPath {
34
- function $fromRdf(resource: Resource, _?: {
35
- [_index: string]: any;
36
- ignoreRdfType?: boolean;
37
- preferredLanguages?: readonly string[];
38
- }): Either<Error, PropertyPath>;
39
- function $toRdf(_propertyPath: PropertyPath, _options?: any): Resource;
40
- }
41
- //# sourceMappingURL=PropertyPath.d.ts.map
@@ -1,95 +0,0 @@
1
- import { rdf, sh } from "@tpluscode/rdf-ns-builders";
2
- import { Either, Left } from "purify-ts";
3
- import { Resource } from "rdfjs-resource";
4
- export var PropertyPath;
5
- (function (PropertyPath) {
6
- function $fromRdf(resource, _) {
7
- // Predicate path
8
- // sh:path ex:parent
9
- if (resource.identifier.termType === "NamedNode") {
10
- return Either.of({ iri: resource.identifier, kind: "PredicatePath" });
11
- }
12
- // The other property path types are BlankNodes
13
- const getPropertyPathList = (listResource) => {
14
- return listResource.toList().chain((values) => {
15
- const members = [];
16
- for (const value of values) {
17
- const memberResource = value.toResource().toMaybe();
18
- if (memberResource.isNothing()) {
19
- return Left(new Error(`non-identifier in property path list ${Resource.Identifier.toString(listResource.identifier)}`));
20
- }
21
- const member = PropertyPath.$fromRdf(memberResource.unsafeCoerce());
22
- if (member.isLeft()) {
23
- return member;
24
- }
25
- members.push(member.unsafeCoerce());
26
- }
27
- return Either.of(members);
28
- });
29
- };
30
- for (const quad of resource.dataset.match(resource.identifier, null, null, null)) {
31
- switch (quad.object.termType) {
32
- case "BlankNode":
33
- case "NamedNode":
34
- break;
35
- default:
36
- return Left(new Error(`non-BlankNode/NamedNode property path object on path ${Resource.Identifier.toString(resource.identifier)}: ${quad.object.termType} ${quad.object.value}`));
37
- }
38
- const objectResource = new Resource({
39
- dataset: resource.dataset,
40
- identifier: quad.object,
41
- });
42
- // Alternative path
43
- // sh:path: [ sh:alternativePath ( ex:father ex:mother ) ]
44
- if (quad.predicate.equals(sh.alternativePath)) {
45
- return getPropertyPathList(objectResource).map((members) => ({
46
- kind: "AlternativePath",
47
- members,
48
- }));
49
- }
50
- // Inverse path
51
- // sh:path: [ sh:inversePath ex:parent ]
52
- if (quad.predicate.equals(sh.inversePath)) {
53
- return PropertyPath.$fromRdf(objectResource).map((path) => ({
54
- kind: "InversePath",
55
- path,
56
- }));
57
- }
58
- // One or more path
59
- if (quad.predicate.equals(sh.oneOrMorePath)) {
60
- return PropertyPath.$fromRdf(objectResource).map((path) => ({
61
- kind: "OneOrMorePath",
62
- path,
63
- }));
64
- }
65
- // Sequence path
66
- // sh:path ( ex:parent ex:firstName )
67
- if (quad.predicate.equals(rdf.first)) {
68
- return getPropertyPathList(objectResource).map((members) => ({
69
- kind: "SequencePath",
70
- members,
71
- }));
72
- }
73
- // Zero or more path
74
- if (quad.predicate.equals(sh.zeroOrMorePath)) {
75
- return PropertyPath.$fromRdf(objectResource).map((path) => ({
76
- kind: "ZeroOrMorePath",
77
- path,
78
- }));
79
- }
80
- if (quad.predicate.equals(sh.zeroOrOnePath)) {
81
- return PropertyPath.$fromRdf(objectResource).map((path) => ({
82
- kind: "ZeroOrOnePath",
83
- path,
84
- }));
85
- }
86
- }
87
- return Left(new Error(`unrecognized or ill-formed SHACL property path ${Resource.Identifier.toString(resource.identifier)}`));
88
- }
89
- PropertyPath.$fromRdf = $fromRdf;
90
- function $toRdf(_propertyPath, _options) {
91
- throw new Error("not implemented");
92
- }
93
- PropertyPath.$toRdf = $toRdf;
94
- })(PropertyPath || (PropertyPath = {}));
95
- //# sourceMappingURL=PropertyPath.js.map
@@ -1,31 +0,0 @@
1
- import type { BlankNode, DatasetCore, DefaultGraph, NamedNode } from "@rdfjs/types";
2
- import { Maybe } from "purify-ts";
3
- import type { Factory } from "./Factory.js";
4
- import type { OntologyLike } from "./OntologyLike.js";
5
- export declare class RdfjsShapesGraph<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> {
6
- readonly dataset: DatasetCore;
7
- readonly node: BlankNode | DefaultGraph | NamedNode | null;
8
- readonly nodeShapes: readonly NodeShapeT[];
9
- readonly ontologies: readonly OntologyT[];
10
- readonly propertyGroups: readonly PropertyGroupT[];
11
- readonly propertyShapes: readonly PropertyShapeT[];
12
- private readonly nodeShapesByIdentifier;
13
- private readonly ontologiesByIdentifier;
14
- private readonly propertyGroupsByIdentifier;
15
- private readonly propertyShapesByIdentifier;
16
- private readonly resourceSet;
17
- constructor({ dataset, factory, }: {
18
- dataset: DatasetCore;
19
- factory: Factory<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
20
- });
21
- nodeShapeByIdentifier(nodeShapeNode: BlankNode | NamedNode): Maybe<NodeShapeT>;
22
- ontologyByIdentifier(identifier: BlankNode | NamedNode): Maybe<OntologyT>;
23
- propertyGroupByIdentifier(identifier: BlankNode | NamedNode): Maybe<PropertyGroupT>;
24
- propertyShapeByIdentifier(identifier: BlankNode | NamedNode): Maybe<PropertyShapeT>;
25
- shapeByIdentifier(identifier: BlankNode | NamedNode): Maybe<ShapeT>;
26
- private readGraph;
27
- private readOntologies;
28
- private readPropertyGroups;
29
- private readShapes;
30
- }
31
- //# sourceMappingURL=RdfjsShapesGraph.d.ts.map
@@ -1,250 +0,0 @@
1
- import TermMap from "@rdfjs/term-map";
2
- import TermSet from "@rdfjs/term-set";
3
- import { owl, sh } from "@tpluscode/rdf-ns-builders";
4
- import { Maybe } from "purify-ts";
5
- import { ResourceSet } from "rdfjs-resource";
6
- export class RdfjsShapesGraph {
7
- dataset;
8
- node;
9
- nodeShapes;
10
- ontologies;
11
- propertyGroups;
12
- propertyShapes;
13
- nodeShapesByIdentifier;
14
- ontologiesByIdentifier;
15
- propertyGroupsByIdentifier;
16
- propertyShapesByIdentifier;
17
- resourceSet;
18
- constructor({ dataset, factory, }) {
19
- this.dataset = dataset;
20
- this.resourceSet = new ResourceSet({ dataset: this.dataset });
21
- this.node = this.readGraph();
22
- const { nodeShapes, nodeShapesByIdentifier, propertyShapes, propertyShapesByIdentifier, } = this.readShapes(factory);
23
- this.nodeShapes = nodeShapes;
24
- this.nodeShapesByIdentifier = nodeShapesByIdentifier;
25
- this.propertyShapes = propertyShapes;
26
- this.propertyShapesByIdentifier = propertyShapesByIdentifier;
27
- const { ontologies, ontologiesByIdentifier } = this.readOntologies(factory);
28
- this.ontologies = ontologies;
29
- this.ontologiesByIdentifier = ontologiesByIdentifier;
30
- const { propertyGroups, propertyGroupsByIdentifier } = this.readPropertyGroups(factory);
31
- this.propertyGroups = propertyGroups;
32
- this.propertyGroupsByIdentifier = propertyGroupsByIdentifier;
33
- }
34
- nodeShapeByIdentifier(nodeShapeNode) {
35
- return Maybe.fromNullable(this.nodeShapesByIdentifier.get(nodeShapeNode));
36
- }
37
- ontologyByIdentifier(identifier) {
38
- return Maybe.fromNullable(this.ontologiesByIdentifier.get(identifier));
39
- }
40
- propertyGroupByIdentifier(identifier) {
41
- return Maybe.fromNullable(this.propertyGroupsByIdentifier.get(identifier));
42
- }
43
- propertyShapeByIdentifier(identifier) {
44
- return Maybe.fromNullable(this.propertyShapesByIdentifier.get(identifier));
45
- }
46
- shapeByIdentifier(identifier) {
47
- const nodeShape = this.nodeShapeByIdentifier(identifier);
48
- if (nodeShape.isJust()) {
49
- return nodeShape;
50
- }
51
- return this.propertyShapeByIdentifier(identifier);
52
- }
53
- readGraph() {
54
- const graphs = new TermSet();
55
- for (const quad of this.dataset) {
56
- graphs.add(quad.graph);
57
- }
58
- if (graphs.size !== 1) {
59
- return null;
60
- }
61
- const graph = [...graphs.values()][0];
62
- switch (graph.termType) {
63
- case "BlankNode":
64
- case "DefaultGraph":
65
- case "NamedNode":
66
- return graph;
67
- default:
68
- throw new RangeError(`expected NamedNode or default graph, actual ${graph.termType}`);
69
- }
70
- }
71
- readOntologies(factory) {
72
- const ontologies = [];
73
- const ontologiesByIdentifier = new TermMap();
74
- for (const ontologyResource of this.resourceSet.instancesOf(owl.Ontology, {
75
- graph: this.node,
76
- })) {
77
- if (ontologiesByIdentifier.has(ontologyResource.identifier)) {
78
- continue;
79
- }
80
- factory
81
- .ontologyFromRdf({
82
- resource: ontologyResource,
83
- shapesGraph: this,
84
- })
85
- .ifRight((ontology) => {
86
- ontologies.push(ontology);
87
- ontologiesByIdentifier.set(ontologyResource.identifier, ontology);
88
- });
89
- }
90
- return { ontologies, ontologiesByIdentifier };
91
- }
92
- readPropertyGroups(factory) {
93
- const propertyGroups = [];
94
- const propertyGroupsByIdentifier = new TermMap();
95
- for (const propertyGroupResource of this.resourceSet.instancesOf(sh.PropertyGroup, { graph: this.node })) {
96
- if (propertyGroupResource.identifier.termType !== "NamedNode") {
97
- continue;
98
- }
99
- if (propertyGroupsByIdentifier.has(propertyGroupResource.identifier)) {
100
- continue;
101
- }
102
- factory
103
- .propertyGroupFromRdf({
104
- resource: propertyGroupResource,
105
- shapesGraph: this,
106
- })
107
- .ifRight((propertyGroup) => {
108
- propertyGroups.push(propertyGroup);
109
- propertyGroupsByIdentifier.set(propertyGroupResource.identifier, propertyGroup);
110
- });
111
- }
112
- return { propertyGroups, propertyGroupsByIdentifier };
113
- }
114
- readShapes(factory) {
115
- // Collect the shape identifiers in sets
116
- const shapeNodeSet = new TermSet();
117
- // Utility function for doing the collection
118
- const addShapeNode = (shapeNode) => {
119
- switch (shapeNode.termType) {
120
- case "BlankNode":
121
- case "NamedNode":
122
- shapeNodeSet.add(shapeNode);
123
- break;
124
- }
125
- };
126
- // Test each shape condition
127
- // https://www.w3.org/TR/shacl/#shapes
128
- // Subject is a SHACL instance of sh:NodeShape or sh:PropertyShape
129
- for (const rdfType of [sh.NodeShape, sh.PropertyShape]) {
130
- for (const resource of this.resourceSet.instancesOf(rdfType, {
131
- graph: this.node,
132
- })) {
133
- addShapeNode(resource.identifier);
134
- }
135
- }
136
- // Subject of a triple with sh:targetClass, sh:targetNode, sh:targetObjectsOf, or sh:targetSubjectsOf predicate
137
- for (const predicate of [
138
- sh.targetClass,
139
- sh.targetNode,
140
- sh.targetObjectsOf,
141
- sh.targetSubjectsOf,
142
- ]) {
143
- for (const quad of this.dataset.match(null, predicate, null, this.node)) {
144
- addShapeNode(quad.subject);
145
- }
146
- }
147
- // Subject of a triple that has a parameter as predicate
148
- // https://www.w3.org/TR/shacl/#constraints
149
- // https://www.w3.org/TR/shacl/#core-components
150
- for (const predicate of [
151
- sh.class,
152
- sh.datatype,
153
- sh.nodeKind,
154
- sh.minCount,
155
- sh.maxCount,
156
- sh.minExclusive,
157
- sh.minInclusive,
158
- sh.maxExclusive,
159
- sh.maxInclusive,
160
- sh.minLength,
161
- sh.maxLength,
162
- sh.pattern,
163
- sh.languageIn,
164
- sh.uniqueLang,
165
- sh.equals,
166
- sh.disjoint,
167
- sh.lessThan,
168
- sh.lessThanOrEquals,
169
- sh.not,
170
- sh.and,
171
- sh.or,
172
- sh.xone,
173
- sh.node,
174
- sh.property,
175
- sh.qualifiedValueShape,
176
- sh.qualifiedMinCount,
177
- sh.qualifiedMaxCount,
178
- sh.closed,
179
- sh.ignoredProperties,
180
- sh.hasValue,
181
- sh.in,
182
- ]) {
183
- for (const quad of this.dataset.match(null, predicate, null, this.node)) {
184
- addShapeNode(quad.subject);
185
- }
186
- }
187
- // Object of a shape-expecting, non-list-taking parameter such as sh:node
188
- for (const predicate of [sh.node, sh.property]) {
189
- for (const quad of this.dataset.match(null, predicate, null, this.node)) {
190
- addShapeNode(quad.object);
191
- }
192
- }
193
- // Member of a SHACL list that is a value of a shape-expecting and list-taking parameter such as sh:or
194
- for (const predicate of [sh.and, sh.or, sh.xone]) {
195
- for (const quad of this.dataset.match(null, predicate, null, this.node)) {
196
- switch (quad.object.termType) {
197
- case "BlankNode":
198
- case "NamedNode":
199
- break;
200
- default:
201
- continue;
202
- }
203
- for (const value of this.resourceSet
204
- .resource(quad.object)
205
- .toList()
206
- .orDefault([])) {
207
- value.toIdentifier().ifRight(addShapeNode);
208
- }
209
- }
210
- }
211
- // Separate shapes into node and property shapes.
212
- const nodeShapes = [];
213
- const nodeShapesByIdentifier = new TermMap();
214
- const propertyShapes = [];
215
- const propertyShapesByIdentifier = new TermMap();
216
- for (const shapeNode of shapeNodeSet) {
217
- if (this.dataset.match(shapeNode, sh.path, null, this.node).size > 0) {
218
- // A property shape is a shape in the shapes graph that is the subject of a triple that has sh:path as its predicate. A shape has at most one value for sh:path. Each value of sh:path in a shape must be a well-formed SHACL property path. It is recommended, but not required, for a property shape to be declared as a SHACL instance of sh:PropertyShape. SHACL instances of sh:PropertyShape have one value for the property sh:path.
219
- factory
220
- .propertyShapeFromRdf({
221
- resource: this.resourceSet.resource(shapeNode),
222
- shapesGraph: this,
223
- })
224
- .ifRight((propertyShape) => {
225
- propertyShapes.push(propertyShape);
226
- propertyShapesByIdentifier.set(shapeNode, propertyShape);
227
- });
228
- }
229
- else {
230
- // A node shape is a shape in the shapes graph that is not the subject of a triple with sh:path as its predicate. It is recommended, but not required, for a node shape to be declared as a SHACL instance of sh:NodeShape. SHACL instances of sh:NodeShape cannot have a value for the property sh:path.
231
- factory
232
- .nodeShapeFromRdf({
233
- resource: this.resourceSet.resource(shapeNode),
234
- shapesGraph: this,
235
- })
236
- .ifRight((nodeShape) => {
237
- nodeShapes.push(nodeShape);
238
- nodeShapesByIdentifier.set(shapeNode, nodeShape);
239
- });
240
- }
241
- }
242
- return {
243
- nodeShapes,
244
- nodeShapesByIdentifier,
245
- propertyShapes,
246
- propertyShapesByIdentifier,
247
- };
248
- }
249
- }
250
- //# sourceMappingURL=RdfjsShapesGraph.js.map
@@ -1,12 +0,0 @@
1
- import type { Factory } from "./Factory.js";
2
- import { NodeShape } from "./NodeShape.js";
3
- import { Ontology } from "./Ontology.js";
4
- import { PropertyGroup } from "./PropertyGroup.js";
5
- import { PropertyShape } from "./PropertyShape.js";
6
- import type { Shape } from "./Shape.js";
7
- type DefaultNodeShape = NodeShape<any, Ontology, PropertyGroup, DefaultPropertyShape, DefaultShape>;
8
- type DefaultPropertyShape = PropertyShape<DefaultNodeShape, Ontology, PropertyGroup, any, DefaultShape>;
9
- type DefaultShape = Shape<DefaultNodeShape, Ontology, PropertyGroup, DefaultPropertyShape, any>;
10
- export declare const defaultFactory: Factory<DefaultNodeShape, Ontology, PropertyGroup, DefaultPropertyShape, DefaultShape>;
11
- export {};
12
- //# sourceMappingURL=defaultFactory.d.ts.map
@@ -1,28 +0,0 @@
1
- import { NodeShape } from "./NodeShape.js";
2
- import { Ontology } from "./Ontology.js";
3
- import { PropertyGroup } from "./PropertyGroup.js";
4
- import { PropertyShape } from "./PropertyShape.js";
5
- import * as generated from "./generated.js";
6
- export const defaultFactory = {
7
- nodeShapeFromRdf({ resource, shapesGraph, }) {
8
- return generated.ShaclCoreNodeShape.$fromRdf(resource, {
9
- ignoreRdfType: true,
10
- }).map((generatedShape) => new NodeShape(generatedShape, shapesGraph));
11
- },
12
- ontologyFromRdf({ resource, }) {
13
- return generated.OwlOntology.$fromRdf(resource, {
14
- ignoreRdfType: true,
15
- }).map((generatedOntology) => new Ontology(generatedOntology));
16
- },
17
- propertyGroupFromRdf({ resource, }) {
18
- return generated.ShaclCorePropertyGroup.$fromRdf(resource, {
19
- ignoreRdfType: true,
20
- }).map((propertyGroup) => new PropertyGroup(propertyGroup));
21
- },
22
- propertyShapeFromRdf({ resource, shapesGraph, }) {
23
- return generated.ShaclCorePropertyShape.$fromRdf(resource, {
24
- ignoreRdfType: true,
25
- }).map((generatedShape) => new PropertyShape(generatedShape, shapesGraph));
26
- },
27
- };
28
- //# sourceMappingURL=defaultFactory.js.map