@shaclmate/shacl-ast 2.0.22 → 2.0.24

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.
@@ -0,0 +1,6 @@
1
+ import type { BlankNode, NamedNode } from "@rdfjs/types";
2
+ /**
3
+ * TypeScript enum corresponding to sh:NodeKind, for simpler manipulation.
4
+ */
5
+ export type IdentifierNodeKind = (BlankNode | NamedNode)["termType"];
6
+ //# sourceMappingURL=IdentifierNodeKind.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IdentifierNodeKind.js.map
@@ -5,13 +5,13 @@ import type { ShapesGraph } from "./ShapesGraph.js";
5
5
  import type * as generated from "./generated.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(generatedShaclCoreNodeShape: Omit<generated.ShaclCoreNodeShape, "$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
13
  private readonly generatedShaclCoreNodeShape;
14
- constructor(generatedShaclCoreNodeShape: Omit<generated.ShaclCoreNodeShape, "type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
14
+ constructor(generatedShaclCoreNodeShape: Omit<generated.ShaclCoreNodeShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
15
15
  get closed(): Maybe<boolean>;
16
16
  get properties(): readonly PropertyShapeT[];
17
17
  }
@@ -3,7 +3,7 @@ import type { OntologyLike } from "./OntologyLike.js";
3
3
  import type * as generated from "./generated.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.OwlOntology, "$type">);
7
7
  get identifier(): BlankNode | NamedNode;
8
8
  toString(): string;
9
9
  }
package/dist/Ontology.js CHANGED
@@ -4,7 +4,7 @@ export class Ontology {
4
4
  this.generatedOntology = generatedOntology;
5
5
  }
6
6
  get identifier() {
7
- return this.generatedOntology.identifier;
7
+ return this.generatedOntology.$identifier;
8
8
  }
9
9
  toString() {
10
10
  return `Ontology(node=${this.identifier.value})`;
@@ -7,7 +7,7 @@ export class PropertyGroup {
7
7
  return this.delegate.comments;
8
8
  }
9
9
  get identifier() {
10
- return this.delegate.identifier;
10
+ return this.delegate.$identifier;
11
11
  }
12
12
  get labels() {
13
13
  return this.delegate.labels;
@@ -1,6 +1,6 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
- import type * as purify from "purify-ts";
3
- import type * as rdfjsResource from "rdfjs-resource";
2
+ import { Either } from "purify-ts";
3
+ import { Resource } from "rdfjs-resource";
4
4
  export interface AlternativePath {
5
5
  readonly kind: "AlternativePath";
6
6
  readonly members: readonly PropertyPath[];
@@ -31,11 +31,11 @@ export interface ZeroOrOnePath {
31
31
  }
32
32
  export type PropertyPath = AlternativePath | InversePath | OneOrMorePath | PredicatePath | SequencePath | ZeroOrMorePath | ZeroOrOnePath;
33
33
  export declare namespace PropertyPath {
34
- function fromRdf({ resource, }: {
34
+ function $fromRdf(resource: Resource, _?: {
35
35
  [_index: string]: any;
36
36
  ignoreRdfType?: boolean;
37
37
  languageIn?: readonly string[];
38
- resource: rdfjsResource.Resource;
39
- }): purify.Either<rdfjsResource.Resource.ValueError, PropertyPath>;
38
+ }): Either<Error, PropertyPath>;
39
+ function $toRdf(_propertyPath: PropertyPath, _options?: any): Resource;
40
40
  }
41
41
  //# sourceMappingURL=PropertyPath.d.ts.map
@@ -3,7 +3,7 @@ import { Either, Left } from "purify-ts";
3
3
  import { Resource } from "rdfjs-resource";
4
4
  export var PropertyPath;
5
5
  (function (PropertyPath) {
6
- function fromRdf({ resource, }) {
6
+ function $fromRdf(resource, _) {
7
7
  // Predicate path
8
8
  // sh:path ex:parent
9
9
  if (resource.identifier.termType === "NamedNode") {
@@ -16,15 +16,9 @@ export var PropertyPath;
16
16
  for (const value of values) {
17
17
  const memberResource = value.toResource().toMaybe();
18
18
  if (memberResource.isNothing()) {
19
- return Left(new Resource.ValueError({
20
- focusResource: resource,
21
- message: "non-identifier in property path list",
22
- predicate: rdf.subject,
23
- }));
19
+ return Left(new Error(`non-identifier in property path list ${Resource.Identifier.toString(listResource.identifier)}`));
24
20
  }
25
- const member = PropertyPath.fromRdf({
26
- resource: memberResource.unsafeCoerce(),
27
- });
21
+ const member = PropertyPath.$fromRdf(memberResource.unsafeCoerce());
28
22
  if (member.isLeft()) {
29
23
  return member;
30
24
  }
@@ -39,11 +33,7 @@ export var PropertyPath;
39
33
  case "NamedNode":
40
34
  break;
41
35
  default:
42
- return Left(new Resource.ValueError({
43
- focusResource: resource,
44
- message: `non-BlankNode/NamedNode property path object on path ${resource.identifier.value}: ${quad.object.termType} ${quad.object.value}`,
45
- predicate: quad.predicate,
46
- }));
36
+ return Left(new Error(`non-BlankNode/NamedNode property path object on path ${Resource.Identifier.toString(resource.identifier)}: ${quad.object.termType} ${quad.object.value}`));
47
37
  }
48
38
  const objectResource = new Resource({
49
39
  dataset: resource.dataset,
@@ -60,14 +50,14 @@ export var PropertyPath;
60
50
  // Inverse path
61
51
  // sh:path: [ sh:inversePath ex:parent ]
62
52
  if (quad.predicate.equals(sh.inversePath)) {
63
- return PropertyPath.fromRdf({ resource: objectResource }).map((path) => ({
53
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
64
54
  kind: "InversePath",
65
55
  path,
66
56
  }));
67
57
  }
68
58
  // One or more path
69
59
  if (quad.predicate.equals(sh.oneOrMorePath)) {
70
- return PropertyPath.fromRdf({ resource: objectResource }).map((path) => ({
60
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
71
61
  kind: "OneOrMorePath",
72
62
  path,
73
63
  }));
@@ -82,24 +72,24 @@ export var PropertyPath;
82
72
  }
83
73
  // Zero or more path
84
74
  if (quad.predicate.equals(sh.zeroOrMorePath)) {
85
- return PropertyPath.fromRdf({ resource: objectResource }).map((path) => ({
75
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
86
76
  kind: "ZeroOrMorePath",
87
77
  path,
88
78
  }));
89
79
  }
90
80
  if (quad.predicate.equals(sh.zeroOrOnePath)) {
91
- return PropertyPath.fromRdf({ resource: objectResource }).map((path) => ({
81
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
92
82
  kind: "ZeroOrOnePath",
93
83
  path,
94
84
  }));
95
85
  }
96
86
  }
97
- return Left(new Resource.ValueError({
98
- focusResource: resource,
99
- message: `unrecognized or ill-formed SHACL property path ${resource.identifier.value}`,
100
- predicate: rdf.subject,
101
- }));
87
+ return Left(new Error(`unrecognized or ill-formed SHACL property path ${Resource.Identifier.toString(resource.identifier)}`));
102
88
  }
103
- PropertyPath.fromRdf = fromRdf;
89
+ PropertyPath.$fromRdf = $fromRdf;
90
+ function $toRdf(_propertyPath, _options) {
91
+ throw new Error("not implemented");
92
+ }
93
+ PropertyPath.$toRdf = $toRdf;
104
94
  })(PropertyPath || (PropertyPath = {}));
105
95
  //# sourceMappingURL=PropertyPath.js.map
@@ -1,4 +1,4 @@
1
- import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
1
+ import type { Literal, NamedNode } from "@rdfjs/types";
2
2
  import type { Maybe } from "purify-ts";
3
3
  import type { OntologyLike } from "./OntologyLike.js";
4
4
  import type { PropertyPath } from "./PropertyPath.js";
@@ -8,8 +8,8 @@ import type * as generated from "./generated.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
9
  private readonly generatedShaclCorePropertyShape;
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>);
12
- get defaultValue(): Maybe<BlankNode | Literal | NamedNode>;
11
+ constructor(generatedShaclCorePropertyShape: Omit<generated.ShaclCorePropertyShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
12
+ get defaultValue(): Maybe<Literal | NamedNode>;
13
13
  get descriptions(): readonly Literal[];
14
14
  get groups(): readonly PropertyGroupT[];
15
15
  get names(): readonly Literal[];
package/dist/Shape.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare abstract class Shape<NodeShapeT extends ShapeT, OntologyT extends
8
8
  private readonly generatedShaclCoreShape;
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(generatedShaclCoreShape: Omit<generated.ShaclCoreShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
12
12
  get comments(): readonly Literal[];
13
13
  get identifier(): BlankNode | NamedNode;
14
14
  get isDefinedBy(): Maybe<OntologyT>;
@@ -18,12 +18,12 @@ export declare namespace Shape {
18
18
  class Constraints<NodeShapeT extends ShapeT, OntologyT extends OntologyLike, PropertyGroupT, PropertyShapeT extends ShapeT, ShapeT> {
19
19
  private readonly generatedShaclCoreShape;
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(generatedShaclCoreShape: Omit<generated.ShaclCoreShape, "$type">, shapesGraph: ShapesGraph<NodeShapeT, OntologyT, PropertyGroupT, PropertyShapeT, ShapeT>);
22
22
  get and(): readonly ShapeT[];
23
23
  get classes(): readonly NamedNode[];
24
24
  get datatype(): Maybe<NamedNode>;
25
- get hasValues(): readonly (BlankNode | Literal | NamedNode)[];
26
- get in_(): readonly (BlankNode | Literal | NamedNode)[];
25
+ get hasValues(): readonly (Literal | NamedNode)[];
26
+ get in_(): readonly (Literal | NamedNode)[];
27
27
  get languageIn(): readonly string[];
28
28
  get maxCount(): Maybe<number>;
29
29
  get maxExclusive(): Maybe<Literal>;
package/dist/Shape.js CHANGED
@@ -10,7 +10,7 @@ export class Shape {
10
10
  return this.generatedShaclCoreShape.comments;
11
11
  }
12
12
  get identifier() {
13
- return this.generatedShaclCoreShape.identifier;
13
+ return this.generatedShaclCoreShape.$identifier;
14
14
  }
15
15
  get isDefinedBy() {
16
16
  if (this.generatedShaclCoreShape.isDefinedBy.isJust()) {
@@ -5,27 +5,23 @@ import { PropertyShape } from "./PropertyShape.js";
5
5
  import * as generated from "./generated.js";
6
6
  export const defaultFactory = {
7
7
  nodeShapeFromRdf({ resource, shapesGraph, }) {
8
- return generated.ShaclCoreNodeShape.fromRdf({
8
+ return generated.ShaclCoreNodeShape.$fromRdf(resource, {
9
9
  ignoreRdfType: true,
10
- resource,
11
10
  }).map((generatedShape) => new NodeShape(generatedShape, shapesGraph));
12
11
  },
13
12
  ontologyFromRdf({ resource, }) {
14
- return generated.OwlOntology.fromRdf({
13
+ return generated.OwlOntology.$fromRdf(resource, {
15
14
  ignoreRdfType: true,
16
- resource,
17
15
  }).map((generatedOntology) => new Ontology(generatedOntology));
18
16
  },
19
17
  propertyGroupFromRdf({ resource, }) {
20
- return generated.ShaclCorePropertyGroup.fromRdf({
18
+ return generated.ShaclCorePropertyGroup.$fromRdf(resource, {
21
19
  ignoreRdfType: true,
22
- resource,
23
20
  }).map((propertyGroup) => new PropertyGroup(propertyGroup));
24
21
  },
25
22
  propertyShapeFromRdf({ resource, shapesGraph, }) {
26
- return generated.ShaclCorePropertyShape.fromRdf({
23
+ return generated.ShaclCorePropertyShape.$fromRdf(resource, {
27
24
  ignoreRdfType: true,
28
- resource,
29
25
  }).map((generatedShape) => new PropertyShape(generatedShape, shapesGraph));
30
26
  },
31
27
  };