@shaclmate/shacl-ast 2.0.23 → 3.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.
@@ -31,11 +31,10 @@ 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
- languageIn?: readonly string[];
38
- resource: Resource;
37
+ preferredLanguages?: readonly string[];
39
38
  }): Either<Error, PropertyPath>;
40
39
  function $toRdf(_propertyPath: PropertyPath, _options?: any): Resource;
41
40
  }
@@ -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") {
@@ -18,9 +18,7 @@ export var PropertyPath;
18
18
  if (memberResource.isNothing()) {
19
19
  return Left(new Error(`non-identifier in property path list ${Resource.Identifier.toString(listResource.identifier)}`));
20
20
  }
21
- const member = PropertyPath.$fromRdf({
22
- resource: memberResource.unsafeCoerce(),
23
- });
21
+ const member = PropertyPath.$fromRdf(memberResource.unsafeCoerce());
24
22
  if (member.isLeft()) {
25
23
  return member;
26
24
  }
@@ -52,14 +50,14 @@ export var PropertyPath;
52
50
  // Inverse path
53
51
  // sh:path: [ sh:inversePath ex:parent ]
54
52
  if (quad.predicate.equals(sh.inversePath)) {
55
- return PropertyPath.$fromRdf({ resource: objectResource }).map((path) => ({
53
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
56
54
  kind: "InversePath",
57
55
  path,
58
56
  }));
59
57
  }
60
58
  // One or more path
61
59
  if (quad.predicate.equals(sh.oneOrMorePath)) {
62
- return PropertyPath.$fromRdf({ resource: objectResource }).map((path) => ({
60
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
63
61
  kind: "OneOrMorePath",
64
62
  path,
65
63
  }));
@@ -74,13 +72,13 @@ export var PropertyPath;
74
72
  }
75
73
  // Zero or more path
76
74
  if (quad.predicate.equals(sh.zeroOrMorePath)) {
77
- return PropertyPath.$fromRdf({ resource: objectResource }).map((path) => ({
75
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
78
76
  kind: "ZeroOrMorePath",
79
77
  path,
80
78
  }));
81
79
  }
82
80
  if (quad.predicate.equals(sh.zeroOrOnePath)) {
83
- return PropertyPath.$fromRdf({ resource: objectResource }).map((path) => ({
81
+ return PropertyPath.$fromRdf(objectResource).map((path) => ({
84
82
  kind: "ZeroOrOnePath",
85
83
  path,
86
84
  }));
@@ -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
  };
@@ -57,11 +57,17 @@ export declare namespace BaseShaclCoreShapeStatic {
57
57
  const // biome-ignore lint/suspicious/noShadowRestrictedNames:
58
58
  toString: typeof rdfjsResource.Resource.Identifier.toString;
59
59
  }
60
- function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource, ...$context }: {
60
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
61
61
  [_index: string]: any;
62
62
  ignoreRdfType?: boolean;
63
63
  languageIn?: readonly string[];
64
64
  objectSet?: $ObjectSet;
65
+ }): purify.Either<Error, BaseShaclCoreShape>;
66
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource, ...$context }: {
67
+ [_index: string]: any;
68
+ ignoreRdfType: boolean;
69
+ languageIn?: readonly string[];
70
+ objectSet: $ObjectSet;
65
71
  resource: rdfjsResource.Resource;
66
72
  }): purify.Either<Error, {
67
73
  $identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -91,11 +97,10 @@ export declare namespace BaseShaclCoreShapeStatic {
91
97
  patterns: readonly string[];
92
98
  xone: readonly (readonly (rdfjs.BlankNode | rdfjs.NamedNode)[])[];
93
99
  }>;
94
- function $fromRdf(parameters: Parameters<typeof BaseShaclCoreShapeStatic.$propertiesFromRdf>[0]): purify.Either<Error, BaseShaclCoreShape>;
95
- function $toRdf(_baseShaclCoreShape: BaseShaclCoreShape, { mutateGraph, resourceSet, }: {
100
+ function $toRdf(_baseShaclCoreShape: BaseShaclCoreShape, options?: {
96
101
  ignoreRdfType?: boolean;
97
102
  mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
98
- resourceSet: rdfjsResource.MutableResourceSet;
103
+ resourceSet?: rdfjsResource.MutableResourceSet;
99
104
  }): rdfjsResource.MutableResource;
100
105
  const $properties: {
101
106
  and: {
@@ -190,11 +195,17 @@ export declare namespace ShaclCorePropertyShape {
190
195
  const $fromRdfType: rdfjs.NamedNode<string>;
191
196
  type $Identifier = BaseShaclCoreShapeStatic.$Identifier;
192
197
  const $Identifier: typeof BaseShaclCoreShapeStatic.$Identifier;
193
- function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource, ...$context }: {
198
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
194
199
  [_index: string]: any;
195
200
  ignoreRdfType?: boolean;
196
201
  languageIn?: readonly string[];
197
202
  objectSet?: $ObjectSet;
203
+ }): purify.Either<Error, ShaclCorePropertyShape>;
204
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource, ...$context }: {
205
+ [_index: string]: any;
206
+ ignoreRdfType: boolean;
207
+ languageIn?: readonly string[];
208
+ objectSet: $ObjectSet;
198
209
  resource: rdfjsResource.Resource;
199
210
  }): purify.Either<Error, {
200
211
  $identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -207,11 +218,10 @@ export declare namespace ShaclCorePropertyShape {
207
218
  path: PropertyPath;
208
219
  uniqueLang: purify.Maybe<boolean>;
209
220
  } & $UnwrapR<ReturnType<typeof BaseShaclCoreShapeStatic.$propertiesFromRdf>>>;
210
- function $fromRdf(parameters: Parameters<typeof ShaclCorePropertyShape.$propertiesFromRdf>[0]): purify.Either<Error, ShaclCorePropertyShape>;
211
- function $toRdf(_shaclCorePropertyShape: ShaclCorePropertyShape, { ignoreRdfType, mutateGraph, resourceSet, }: {
221
+ function $toRdf(_shaclCorePropertyShape: ShaclCorePropertyShape, options?: {
212
222
  ignoreRdfType?: boolean;
213
223
  mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
214
- resourceSet: rdfjsResource.MutableResourceSet;
224
+ resourceSet?: rdfjsResource.MutableResourceSet;
215
225
  }): rdfjsResource.MutableResource;
216
226
  const $properties: {
217
227
  defaultValue: {
@@ -326,11 +336,17 @@ export declare namespace ShaclCorePropertyGroup {
326
336
  const // biome-ignore lint/suspicious/noShadowRestrictedNames:
327
337
  toString: typeof rdfjsResource.Resource.Identifier.toString;
328
338
  }
329
- function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource, ...$context }: {
339
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
330
340
  [_index: string]: any;
331
341
  ignoreRdfType?: boolean;
332
342
  languageIn?: readonly string[];
333
343
  objectSet?: $ObjectSet;
344
+ }): purify.Either<Error, ShaclCorePropertyGroup>;
345
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource, ...$context }: {
346
+ [_index: string]: any;
347
+ ignoreRdfType: boolean;
348
+ languageIn?: readonly string[];
349
+ objectSet: $ObjectSet;
334
350
  resource: rdfjsResource.Resource;
335
351
  }): purify.Either<Error, {
336
352
  $identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -338,11 +354,10 @@ export declare namespace ShaclCorePropertyGroup {
338
354
  comments: readonly rdfjs.Literal[];
339
355
  labels: readonly rdfjs.Literal[];
340
356
  }>;
341
- function $fromRdf(parameters: Parameters<typeof ShaclCorePropertyGroup.$propertiesFromRdf>[0]): purify.Either<Error, ShaclCorePropertyGroup>;
342
- function $toRdf(_shaclCorePropertyGroup: ShaclCorePropertyGroup, { ignoreRdfType, mutateGraph, resourceSet, }: {
357
+ function $toRdf(_shaclCorePropertyGroup: ShaclCorePropertyGroup, options?: {
343
358
  ignoreRdfType?: boolean;
344
359
  mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
345
- resourceSet: rdfjsResource.MutableResourceSet;
360
+ resourceSet?: rdfjsResource.MutableResourceSet;
346
361
  }): rdfjsResource.MutableResource;
347
362
  const $properties: {
348
363
  comments: {
@@ -364,11 +379,17 @@ export declare namespace ShaclCoreNodeShape {
364
379
  const $fromRdfType: rdfjs.NamedNode<string>;
365
380
  type $Identifier = BaseShaclCoreShapeStatic.$Identifier;
366
381
  const $Identifier: typeof BaseShaclCoreShapeStatic.$Identifier;
367
- function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource, ...$context }: {
382
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
368
383
  [_index: string]: any;
369
384
  ignoreRdfType?: boolean;
370
385
  languageIn?: readonly string[];
371
386
  objectSet?: $ObjectSet;
387
+ }): purify.Either<Error, ShaclCoreNodeShape>;
388
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource, ...$context }: {
389
+ [_index: string]: any;
390
+ ignoreRdfType: boolean;
391
+ languageIn?: readonly string[];
392
+ objectSet: $ObjectSet;
372
393
  resource: rdfjsResource.Resource;
373
394
  }): purify.Either<Error, {
374
395
  $identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -377,11 +398,10 @@ export declare namespace ShaclCoreNodeShape {
377
398
  ignoredProperties: purify.Maybe<readonly rdfjs.NamedNode[]>;
378
399
  properties: readonly (rdfjs.BlankNode | rdfjs.NamedNode)[];
379
400
  } & $UnwrapR<ReturnType<typeof BaseShaclCoreShapeStatic.$propertiesFromRdf>>>;
380
- function $fromRdf(parameters: Parameters<typeof ShaclCoreNodeShape.$propertiesFromRdf>[0]): purify.Either<Error, ShaclCoreNodeShape>;
381
- function $toRdf(_shaclCoreNodeShape: ShaclCoreNodeShape, { ignoreRdfType, mutateGraph, resourceSet, }: {
401
+ function $toRdf(_shaclCoreNodeShape: ShaclCoreNodeShape, options?: {
382
402
  ignoreRdfType?: boolean;
383
403
  mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
384
- resourceSet: rdfjsResource.MutableResourceSet;
404
+ resourceSet?: rdfjsResource.MutableResourceSet;
385
405
  }): rdfjsResource.MutableResource;
386
406
  const $properties: {
387
407
  closed: {
@@ -483,22 +503,27 @@ export declare namespace OwlOntology {
483
503
  const // biome-ignore lint/suspicious/noShadowRestrictedNames:
484
504
  toString: typeof rdfjsResource.Resource.Identifier.toString;
485
505
  }
486
- function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSetParameter, resource: $resource, ...$context }: {
506
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
487
507
  [_index: string]: any;
488
508
  ignoreRdfType?: boolean;
489
509
  languageIn?: readonly string[];
490
510
  objectSet?: $ObjectSet;
511
+ }): purify.Either<Error, OwlOntology>;
512
+ function $propertiesFromRdf({ ignoreRdfType: $ignoreRdfType, languageIn: $languageIn, objectSet: $objectSet, resource: $resource, ...$context }: {
513
+ [_index: string]: any;
514
+ ignoreRdfType: boolean;
515
+ languageIn?: readonly string[];
516
+ objectSet: $ObjectSet;
491
517
  resource: rdfjsResource.Resource;
492
518
  }): purify.Either<Error, {
493
519
  $identifier: rdfjs.BlankNode | rdfjs.NamedNode;
494
520
  $type: "OwlOntology";
495
521
  labels: readonly rdfjs.Literal[];
496
522
  }>;
497
- function $fromRdf(parameters: Parameters<typeof OwlOntology.$propertiesFromRdf>[0]): purify.Either<Error, OwlOntology>;
498
- function $toRdf(_owlOntology: OwlOntology, { ignoreRdfType, mutateGraph, resourceSet, }: {
523
+ function $toRdf(_owlOntology: OwlOntology, options?: {
499
524
  ignoreRdfType?: boolean;
500
525
  mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
501
- resourceSet: rdfjsResource.MutableResourceSet;
526
+ resourceSet?: rdfjsResource.MutableResourceSet;
502
527
  }): rdfjsResource.MutableResource;
503
528
  const $properties: {
504
529
  labels: {
@@ -508,10 +533,11 @@ export declare namespace OwlOntology {
508
533
  }
509
534
  export type ShaclCoreShape = ShaclCoreNodeShape | ShaclCorePropertyShape;
510
535
  export declare namespace ShaclCoreShape {
511
- function $fromRdf({ ignoreRdfType, resource, ...context }: {
536
+ function $fromRdf(resource: rdfjsResource.Resource, options?: {
512
537
  [_index: string]: any;
513
538
  ignoreRdfType?: boolean;
514
- resource: rdfjsResource.Resource;
539
+ languageIn?: readonly string[];
540
+ objectSet?: $ObjectSet;
515
541
  }): purify.Either<Error, ShaclCoreShape>;
516
542
  type $Identifier = rdfjs.BlankNode | rdfjs.NamedNode;
517
543
  namespace $Identifier {
@@ -519,9 +545,9 @@ export declare namespace ShaclCoreShape {
519
545
  const // biome-ignore lint/suspicious/noShadowRestrictedNames:
520
546
  toString: typeof rdfjsResource.Resource.Identifier.toString;
521
547
  }
522
- function $toRdf(_shaclCoreShape: ShaclCoreShape, _parameters: {
523
- mutateGraph: rdfjsResource.MutableResource.MutateGraph;
524
- resourceSet: rdfjsResource.MutableResourceSet;
548
+ function $toRdf(_shaclCoreShape: ShaclCoreShape, _parameters?: {
549
+ mutateGraph?: rdfjsResource.MutableResource.MutateGraph;
550
+ resourceSet?: rdfjsResource.MutableResourceSet;
525
551
  }): rdfjsResource.MutableResource;
526
552
  }
527
553
  export interface $ObjectSet {
@@ -609,48 +635,48 @@ export declare class $RdfjsDatasetObjectSet implements $ObjectSet {
609
635
  protected $objectIdentifiersSync<ObjectT extends {
610
636
  readonly $identifier: ObjectIdentifierT;
611
637
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectType: {
612
- $fromRdf: (parameters: {
613
- resource: rdfjsResource.Resource;
638
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
639
+ objectSet: $ObjectSet;
614
640
  }) => purify.Either<Error, ObjectT>;
615
641
  $fromRdfType?: rdfjs.NamedNode;
616
642
  }, query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, readonly ObjectIdentifierT[]>;
617
643
  protected $objectsSync<ObjectT extends {
618
644
  readonly $identifier: ObjectIdentifierT;
619
645
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectType: {
620
- $fromRdf: (parameters: {
621
- resource: rdfjsResource.Resource;
646
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
647
+ objectSet: $ObjectSet;
622
648
  }) => purify.Either<Error, ObjectT>;
623
649
  $fromRdfType?: rdfjs.NamedNode;
624
650
  }, query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, readonly ObjectT[]>;
625
651
  protected $objectsCountSync<ObjectT extends {
626
652
  readonly $identifier: ObjectIdentifierT;
627
653
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectType: {
628
- $fromRdf: (parameters: {
629
- resource: rdfjsResource.Resource;
654
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
655
+ objectSet: $ObjectSet;
630
656
  }) => purify.Either<Error, ObjectT>;
631
657
  $fromRdfType?: rdfjs.NamedNode;
632
658
  }, query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, number>;
633
659
  protected $objectUnionIdentifiersSync<ObjectT extends {
634
660
  readonly $identifier: ObjectIdentifierT;
635
661
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectTypes: readonly {
636
- $fromRdf: (parameters: {
637
- resource: rdfjsResource.Resource;
662
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
663
+ objectSet: $ObjectSet;
638
664
  }) => purify.Either<Error, ObjectT>;
639
665
  $fromRdfType?: rdfjs.NamedNode;
640
666
  }[], query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, readonly ObjectIdentifierT[]>;
641
667
  protected $objectUnionsSync<ObjectT extends {
642
668
  readonly $identifier: ObjectIdentifierT;
643
669
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectTypes: readonly {
644
- $fromRdf: (parameters: {
645
- resource: rdfjsResource.Resource;
670
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
671
+ objectSet: $ObjectSet;
646
672
  }) => purify.Either<Error, ObjectT>;
647
673
  $fromRdfType?: rdfjs.NamedNode;
648
674
  }[], query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, readonly ObjectT[]>;
649
675
  protected $objectUnionsCountSync<ObjectT extends {
650
676
  readonly $identifier: ObjectIdentifierT;
651
677
  }, ObjectIdentifierT extends rdfjs.BlankNode | rdfjs.NamedNode>(objectTypes: readonly {
652
- $fromRdf: (parameters: {
653
- resource: rdfjsResource.Resource;
678
+ $fromRdf: (resource: rdfjsResource.Resource, options: {
679
+ objectSet: $ObjectSet;
654
680
  }) => purify.Either<Error, ObjectT>;
655
681
  $fromRdfType?: rdfjs.NamedNode;
656
682
  }[], query?: $ObjectSet.Query<ObjectIdentifierT>): purify.Either<Error, number>;