@shaclmate/shacl-ast 4.0.6 → 4.0.8

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.
@@ -5,13 +5,13 @@ import { Shape } from "./Shape.js";
5
5
  import type { ShapesGraph } from "./ShapesGraph.js";
6
6
  export declare class NodeShape<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> extends Shape<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT> {
7
7
  readonly constraints: NodeShape.Constraints<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
8
- constructor(generatedShaclCoreNodeShape: Omit<generated.ShaclCoreNodeShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
8
+ constructor(generatedNodeShape: Omit<generated.NodeShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
9
9
  toString(): string;
10
10
  }
11
11
  export declare namespace NodeShape {
12
12
  class Constraints<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> extends Shape.Constraints<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT> {
13
- private readonly generatedShaclCoreNodeShape;
14
- constructor(generatedShaclCoreNodeShape: Omit<generated.ShaclCoreNodeShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
13
+ private readonly generatedNodeShape;
14
+ constructor(generatedNodeShape: Omit<generated.NodeShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
15
15
  get closed(): Maybe<boolean>;
16
16
  get properties(): Either<Error, readonly PropertyShapeT[]>;
17
17
  }
package/dist/NodeShape.js CHANGED
@@ -10,9 +10,9 @@ import { Memoize } from "typescript-memoize";
10
10
  import { Shape } from "./Shape.js";
11
11
  export class NodeShape extends Shape {
12
12
  constraints;
13
- constructor(generatedShaclCoreNodeShape, shapesGraph) {
14
- super(generatedShaclCoreNodeShape, shapesGraph);
15
- this.constraints = new NodeShape.Constraints(generatedShaclCoreNodeShape, shapesGraph);
13
+ constructor(generatedNodeShape, shapesGraph) {
14
+ super(generatedNodeShape, shapesGraph);
15
+ this.constraints = new NodeShape.Constraints(generatedNodeShape, shapesGraph);
16
16
  }
17
17
  toString() {
18
18
  return `NodeShape(identifier=${Resource.Identifier.toString(this.identifier)})`;
@@ -23,16 +23,16 @@ __decorate([
23
23
  ], NodeShape.prototype, "toString", null);
24
24
  (function (NodeShape) {
25
25
  class Constraints extends Shape.Constraints {
26
- generatedShaclCoreNodeShape;
27
- constructor(generatedShaclCoreNodeShape, shapesGraph) {
28
- super(generatedShaclCoreNodeShape, shapesGraph);
29
- this.generatedShaclCoreNodeShape = generatedShaclCoreNodeShape;
26
+ generatedNodeShape;
27
+ constructor(generatedNodeShape, shapesGraph) {
28
+ super(generatedNodeShape, shapesGraph);
29
+ this.generatedNodeShape = generatedNodeShape;
30
30
  }
31
31
  get closed() {
32
- return this.generatedShaclCoreNodeShape.closed;
32
+ return this.generatedNodeShape.closed;
33
33
  }
34
34
  get properties() {
35
- return Either.sequence(this.generatedShaclCoreNodeShape.properties.map((identifier) => this.shapesGraph.propertyShapeByIdentifier(identifier)));
35
+ return Either.sequence(this.generatedNodeShape.properties.map((identifier) => this.shapesGraph.propertyShapeByIdentifier(identifier)));
36
36
  }
37
37
  }
38
38
  __decorate([
@@ -3,7 +3,7 @@ import type * as generated from "./generated.js";
3
3
  import type { OntologyLike } from "./OntologyLike.js";
4
4
  export declare class Ontology implements OntologyLike {
5
5
  private readonly generatedOntology;
6
- constructor(generatedOntology: Omit<generated.OwlOntology, "$type">);
6
+ constructor(generatedOntology: Omit<generated.Ontology, "$type">);
7
7
  get identifier(): BlankNode | NamedNode;
8
8
  toString(): string;
9
9
  }
@@ -2,7 +2,7 @@ import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import type * as generated from "./generated.js";
3
3
  export declare class PropertyGroup {
4
4
  private readonly delegate;
5
- constructor(delegate: generated.ShaclCorePropertyGroup);
5
+ constructor(delegate: generated.PropertyGroup);
6
6
  get comments(): readonly string[];
7
7
  get identifier(): BlankNode | NamedNode;
8
8
  get labels(): readonly string[];
@@ -6,9 +6,9 @@ import type { OntologyLike } from "./OntologyLike.js";
6
6
  import { Shape } from "./Shape.js";
7
7
  import type { ShapesGraph } from "./ShapesGraph.js";
8
8
  export declare class PropertyShape<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> extends Shape<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT> {
9
- private readonly generatedShaclCorePropertyShape;
9
+ private readonly generatedPropertyShape;
10
10
  readonly constraints: Shape.Constraints<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
11
- constructor(generatedShaclCorePropertyShape: Omit<generated.ShaclCorePropertyShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
11
+ constructor(generatedPropertyShape: Omit<generated.PropertyShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
12
12
  get defaultValue(): Maybe<Literal | NamedNode>;
13
13
  get descriptions(): readonly string[];
14
14
  get groups(): Either<Error, readonly PropertyGroupT[]>;
@@ -9,30 +9,30 @@ import { PropertyPath, Resource } from "rdfjs-resource";
9
9
  import { Memoize } from "typescript-memoize";
10
10
  import { Shape } from "./Shape.js";
11
11
  export class PropertyShape extends Shape {
12
- generatedShaclCorePropertyShape;
12
+ generatedPropertyShape;
13
13
  constraints;
14
- constructor(generatedShaclCorePropertyShape, shapesGraph) {
15
- super(generatedShaclCorePropertyShape, shapesGraph);
16
- this.generatedShaclCorePropertyShape = generatedShaclCorePropertyShape;
17
- this.constraints = new Shape.Constraints(generatedShaclCorePropertyShape, shapesGraph);
14
+ constructor(generatedPropertyShape, shapesGraph) {
15
+ super(generatedPropertyShape, shapesGraph);
16
+ this.generatedPropertyShape = generatedPropertyShape;
17
+ this.constraints = new Shape.Constraints(generatedPropertyShape, shapesGraph);
18
18
  }
19
19
  get defaultValue() {
20
- return this.generatedShaclCorePropertyShape.defaultValue;
20
+ return this.generatedPropertyShape.defaultValue;
21
21
  }
22
22
  get descriptions() {
23
- return this.generatedShaclCorePropertyShape.descriptions;
23
+ return this.generatedPropertyShape.descriptions;
24
24
  }
25
25
  get groups() {
26
- return Either.sequence(this.generatedShaclCorePropertyShape.groups.map((identifier) => this.shapesGraph.propertyGroupByIdentifier(identifier)));
26
+ return Either.sequence(this.generatedPropertyShape.groups.map((identifier) => this.shapesGraph.propertyGroupByIdentifier(identifier)));
27
27
  }
28
28
  get names() {
29
- return this.generatedShaclCorePropertyShape.names;
29
+ return this.generatedPropertyShape.names;
30
30
  }
31
31
  get order() {
32
- return this.generatedShaclCorePropertyShape.order;
32
+ return this.generatedPropertyShape.order;
33
33
  }
34
34
  get path() {
35
- return this.generatedShaclCorePropertyShape.path;
35
+ return this.generatedPropertyShape.path;
36
36
  }
37
37
  toString() {
38
38
  return `PropertyShape(${[
package/dist/Shape.d.ts CHANGED
@@ -5,10 +5,10 @@ import type { NodeKind } from "./NodeKind.js";
5
5
  import type { OntologyLike } from "./OntologyLike.js";
6
6
  import type { ShapesGraph } from "./ShapesGraph.js";
7
7
  export declare abstract class Shape<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> {
8
- private readonly generatedShaclCoreShape;
8
+ private readonly generatedShape;
9
9
  protected readonly shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
10
10
  abstract readonly constraints: Shape.Constraints<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
11
- constructor(generatedShaclCoreShape: Omit<generated.ShaclCoreShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
11
+ constructor(generatedShape: Omit<generated.Shape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
12
12
  get comments(): readonly string[];
13
13
  get identifier(): BlankNode | NamedNode;
14
14
  get isDefinedBy(): Either<Error, Maybe<OntologyT>>;
@@ -16,9 +16,9 @@ export declare abstract class Shape<NodeShapeT extends ShapeT, OntologyT extends
16
16
  }
17
17
  export declare namespace Shape {
18
18
  class Constraints<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> {
19
- private readonly generatedShaclCoreShape;
19
+ private readonly generatedShape;
20
20
  protected readonly shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>;
21
- constructor(generatedShaclCoreShape: Omit<generated.ShaclCoreShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
21
+ constructor(generatedShape: Omit<generated.Shape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
22
22
  get and(): Either<Error, readonly ShapeT[]>;
23
23
  get classes(): readonly NamedNode[];
24
24
  get datatype(): Maybe<NamedNode>;
package/dist/Shape.js CHANGED
@@ -7,23 +7,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Either, Maybe } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  export class Shape {
10
- generatedShaclCoreShape;
10
+ generatedShape;
11
11
  shapesGraph;
12
- constructor(generatedShaclCoreShape, shapesGraph) {
13
- this.generatedShaclCoreShape = generatedShaclCoreShape;
12
+ constructor(generatedShape, shapesGraph) {
13
+ this.generatedShape = generatedShape;
14
14
  this.shapesGraph = shapesGraph;
15
15
  }
16
16
  get comments() {
17
- return this.generatedShaclCoreShape.comments;
17
+ return this.generatedShape.comments;
18
18
  }
19
19
  get identifier() {
20
- return this.generatedShaclCoreShape.$identifier;
20
+ return this.generatedShape.$identifier;
21
21
  }
22
22
  get isDefinedBy() {
23
- if (this.generatedShaclCoreShape.isDefinedBy.isJust()) {
23
+ if (this.generatedShape.isDefinedBy.isJust()) {
24
24
  // If there's an rdfs:isDefinedBy statement on the shape then don't fall back to anything else
25
25
  return this.shapesGraph
26
- .ontologyByIdentifier(this.generatedShaclCoreShape.isDefinedBy.unsafeCoerce())
26
+ .ontologyByIdentifier(this.generatedShape.isDefinedBy.unsafeCoerce())
27
27
  .map(Maybe.of);
28
28
  }
29
29
  // No rdfs:isDefinedBy statement on the shape
@@ -43,7 +43,7 @@ export class Shape {
43
43
  return Either.of(Maybe.empty());
44
44
  }
45
45
  get labels() {
46
- return this.generatedShaclCoreShape.labels;
46
+ return this.generatedShape.labels;
47
47
  }
48
48
  }
49
49
  __decorate([
@@ -51,50 +51,50 @@ __decorate([
51
51
  ], Shape.prototype, "isDefinedBy", null);
52
52
  (function (Shape) {
53
53
  class Constraints {
54
- generatedShaclCoreShape;
54
+ generatedShape;
55
55
  shapesGraph;
56
- constructor(generatedShaclCoreShape, shapesGraph) {
57
- this.generatedShaclCoreShape = generatedShaclCoreShape;
56
+ constructor(generatedShape, shapesGraph) {
57
+ this.generatedShape = generatedShape;
58
58
  this.shapesGraph = shapesGraph;
59
59
  }
60
60
  get and() {
61
- return this.shapeListTakingConstraint(this.generatedShaclCoreShape.and);
61
+ return this.shapeListTakingConstraint(this.generatedShape.and);
62
62
  }
63
63
  get classes() {
64
- return this.generatedShaclCoreShape.classes;
64
+ return this.generatedShape.classes;
65
65
  }
66
66
  get datatype() {
67
- return this.generatedShaclCoreShape.datatype;
67
+ return this.generatedShape.datatype;
68
68
  }
69
69
  get hasValues() {
70
- return this.generatedShaclCoreShape.hasValues;
70
+ return this.generatedShape.hasValues;
71
71
  }
72
72
  get in_() {
73
- return this.generatedShaclCoreShape.in_.orDefault([]);
73
+ return this.generatedShape.in_.orDefault([]);
74
74
  }
75
75
  get languageIn() {
76
- return this.generatedShaclCoreShape.languageIn.orDefault([]);
76
+ return this.generatedShape.languageIn.orDefault([]);
77
77
  }
78
78
  get maxCount() {
79
- return this.generatedShaclCoreShape.maxCount;
79
+ return this.generatedShape.maxCount;
80
80
  }
81
81
  get maxExclusive() {
82
- return this.generatedShaclCoreShape.maxExclusive;
82
+ return this.generatedShape.maxExclusive;
83
83
  }
84
84
  get maxInclusive() {
85
- return this.generatedShaclCoreShape.maxInclusive;
85
+ return this.generatedShape.maxInclusive;
86
86
  }
87
87
  get minCount() {
88
- return this.generatedShaclCoreShape.minCount;
88
+ return this.generatedShape.minCount;
89
89
  }
90
90
  get minExclusive() {
91
- return this.generatedShaclCoreShape.minExclusive;
91
+ return this.generatedShape.minExclusive;
92
92
  }
93
93
  get minInclusive() {
94
- return this.generatedShaclCoreShape.minInclusive;
94
+ return this.generatedShape.minInclusive;
95
95
  }
96
96
  get nodeKinds() {
97
- return this.generatedShaclCoreShape.nodeKind
97
+ return this.generatedShape.nodeKind
98
98
  .map((iri) => {
99
99
  const nodeKinds = new Set();
100
100
  switch (iri.value) {
@@ -125,16 +125,16 @@ __decorate([
125
125
  .orDefault(new Set([]));
126
126
  }
127
127
  get nodes() {
128
- return Either.sequence(this.generatedShaclCoreShape.nodes.map((identifier) => this.shapesGraph.nodeShapeByIdentifier(identifier)));
128
+ return Either.sequence(this.generatedShape.nodes.map((identifier) => this.shapesGraph.nodeShapeByIdentifier(identifier)));
129
129
  }
130
130
  get not() {
131
- return Either.sequence(this.generatedShaclCoreShape.not.map((identifier) => this.shapesGraph.shapeByIdentifier(identifier)));
131
+ return Either.sequence(this.generatedShape.not.map((identifier) => this.shapesGraph.shapeByIdentifier(identifier)));
132
132
  }
133
133
  get or() {
134
- return this.shapeListTakingConstraint(this.generatedShaclCoreShape.or);
134
+ return this.shapeListTakingConstraint(this.generatedShape.or);
135
135
  }
136
136
  get xone() {
137
- return this.shapeListTakingConstraint(this.generatedShaclCoreShape.xone);
137
+ return this.shapeListTakingConstraint(this.generatedShape.xone);
138
138
  }
139
139
  shapeListTakingConstraint(identifiers) {
140
140
  return Either.sequence(identifiers.flatMap((identifiers) => identifiers.map((identifier) => this.shapesGraph.shapeByIdentifier(identifier))));
@@ -279,25 +279,25 @@ __decorate([
279
279
  ShapesGraph.Factory = Factory;
280
280
  class DefaultFactory extends Factory {
281
281
  createNodeShape({ resource, shapesGraph, }) {
282
- return generated.ShaclCoreNodeShape.$fromRdf(resource, {
282
+ return generated.NodeShape.$fromRdf(resource, {
283
283
  ignoreRdfType: true,
284
284
  preferredLanguages: this.preferredLanguages,
285
285
  }).map((generatedShape) => new NodeShape(generatedShape, shapesGraph));
286
286
  }
287
287
  createOntology({ resource, }) {
288
- return generated.OwlOntology.$fromRdf(resource, {
288
+ return generated.Ontology.$fromRdf(resource, {
289
289
  ignoreRdfType: true,
290
290
  preferredLanguages: this.preferredLanguages,
291
291
  }).map((generatedOntology) => new Ontology(generatedOntology));
292
292
  }
293
293
  createPropertyGroup({ resource, }) {
294
- return generated.ShaclCorePropertyGroup.$fromRdf(resource, {
294
+ return generated.PropertyGroup.$fromRdf(resource, {
295
295
  ignoreRdfType: true,
296
296
  preferredLanguages: this.preferredLanguages,
297
297
  }).map((propertyGroup) => new PropertyGroup(propertyGroup));
298
298
  }
299
299
  createPropertyShape({ resource, shapesGraph, }) {
300
- return generated.ShaclCorePropertyShape.$fromRdf(resource, {
300
+ return generated.PropertyShape.$fromRdf(resource, {
301
301
  ignoreRdfType: true,
302
302
  preferredLanguages: this.preferredLanguages,
303
303
  }).map((generatedShape) => new PropertyShape(generatedShape, shapesGraph));