@shaclmate/shacl-ast 2.0.17 → 2.0.18

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.
@@ -2,6 +2,7 @@ import type * as rdfjs from "@rdfjs/types";
2
2
  import * as purify from "purify-ts";
3
3
  import * as rdfjsResource from "rdfjs-resource";
4
4
  import { PropertyPath } from "./PropertyPath.js";
5
+ type UnwrapR<T> = T extends purify.Either<any, infer R> ? R : never;
5
6
  export interface BaseShaclCoreShape {
6
7
  readonly and: readonly (readonly (rdfjs.BlankNode | rdfjs.NamedNode)[])[];
7
8
  readonly classes: readonly rdfjs.NamedNode[];
@@ -32,7 +33,7 @@ export interface BaseShaclCoreShape {
32
33
  readonly xone: readonly (readonly (rdfjs.BlankNode | rdfjs.NamedNode)[])[];
33
34
  }
34
35
  export declare namespace BaseShaclCoreShape {
35
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
36
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
36
37
  [_index: string]: any;
37
38
  ignoreRdfType?: boolean;
38
39
  languageIn?: readonly string[];
@@ -78,12 +79,24 @@ export interface ShaclCorePropertyShape extends BaseShaclCoreShape {
78
79
  readonly uniqueLang: purify.Maybe<boolean>;
79
80
  }
80
81
  export declare namespace ShaclCorePropertyShape {
81
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
82
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
82
83
  [_index: string]: any;
83
84
  ignoreRdfType?: boolean;
84
85
  languageIn?: readonly string[];
85
86
  resource: rdfjsResource.Resource;
86
- }): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyShape>;
87
+ }): purify.Either<rdfjsResource.Resource.ValueError, {
88
+ defaultValue: purify.Maybe<rdfjs.BlankNode | rdfjs.NamedNode | rdfjs.Literal>;
89
+ descriptions: readonly rdfjs.Literal[];
90
+ groups: readonly (rdfjs.BlankNode | rdfjs.NamedNode)[];
91
+ identifier: rdfjs.BlankNode | rdfjs.NamedNode;
92
+ names: readonly rdfjs.Literal[];
93
+ order: purify.Maybe<number>;
94
+ path: PropertyPath;
95
+ type: "ShaclCorePropertyShape";
96
+ uniqueLang: purify.Maybe<boolean>;
97
+ } & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
98
+ function fromRdf(parameters: Parameters<typeof ShaclCorePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyShape>;
99
+ const fromRdfType: rdfjs.NamedNode<string>;
87
100
  }
88
101
  export interface ShaclCorePropertyGroup {
89
102
  readonly comments: readonly rdfjs.Literal[];
@@ -92,12 +105,19 @@ export interface ShaclCorePropertyGroup {
92
105
  readonly type: "ShaclCorePropertyGroup";
93
106
  }
94
107
  export declare namespace ShaclCorePropertyGroup {
95
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
108
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
96
109
  [_index: string]: any;
97
110
  ignoreRdfType?: boolean;
98
111
  languageIn?: readonly string[];
99
112
  resource: rdfjsResource.Resource;
100
- }): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyGroup>;
113
+ }): purify.Either<rdfjsResource.Resource.ValueError, {
114
+ comments: readonly rdfjs.Literal[];
115
+ identifier: rdfjs.BlankNode | rdfjs.NamedNode;
116
+ labels: readonly rdfjs.Literal[];
117
+ type: "ShaclCorePropertyGroup";
118
+ }>;
119
+ function fromRdf(parameters: Parameters<typeof ShaclCorePropertyGroup.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyGroup>;
120
+ const fromRdfType: rdfjs.NamedNode<string>;
101
121
  }
102
122
  export interface ShaclCoreNodeShape extends BaseShaclCoreShape {
103
123
  readonly closed: purify.Maybe<boolean>;
@@ -107,12 +127,20 @@ export interface ShaclCoreNodeShape extends BaseShaclCoreShape {
107
127
  readonly type: "ShaclCoreNodeShape";
108
128
  }
109
129
  export declare namespace ShaclCoreNodeShape {
110
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
130
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
111
131
  [_index: string]: any;
112
132
  ignoreRdfType?: boolean;
113
133
  languageIn?: readonly string[];
114
134
  resource: rdfjsResource.Resource;
115
- }): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreNodeShape>;
135
+ }): purify.Either<rdfjsResource.Resource.ValueError, {
136
+ closed: purify.Maybe<boolean>;
137
+ identifier: rdfjs.BlankNode | rdfjs.NamedNode;
138
+ ignoredProperties: purify.Maybe<readonly rdfjs.NamedNode[]>;
139
+ properties: readonly (rdfjs.BlankNode | rdfjs.NamedNode)[];
140
+ type: "ShaclCoreNodeShape";
141
+ } & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
142
+ function fromRdf(parameters: Parameters<typeof ShaclCoreNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreNodeShape>;
143
+ const fromRdfType: rdfjs.NamedNode<string>;
116
144
  }
117
145
  export interface OwlOntology {
118
146
  readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -120,19 +148,26 @@ export interface OwlOntology {
120
148
  readonly type: "OwlOntology";
121
149
  }
122
150
  export declare namespace OwlOntology {
123
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
151
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource, ..._context }: {
124
152
  [_index: string]: any;
125
153
  ignoreRdfType?: boolean;
126
154
  languageIn?: readonly string[];
127
155
  resource: rdfjsResource.Resource;
128
- }): purify.Either<rdfjsResource.Resource.ValueError, OwlOntology>;
156
+ }): purify.Either<rdfjsResource.Resource.ValueError, {
157
+ identifier: rdfjs.BlankNode | rdfjs.NamedNode;
158
+ labels: readonly rdfjs.Literal[];
159
+ type: "OwlOntology";
160
+ }>;
161
+ function fromRdf(parameters: Parameters<typeof OwlOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, OwlOntology>;
162
+ const fromRdfType: rdfjs.NamedNode<string>;
129
163
  }
130
164
  export type ShaclCoreShape = ShaclCoreNodeShape | ShaclCorePropertyShape;
131
165
  export declare namespace ShaclCoreShape {
132
- function fromRdf(parameters: {
166
+ function fromRdf({ ignoreRdfType, resource, ...context }: {
133
167
  [_index: string]: any;
134
168
  ignoreRdfType?: boolean;
135
169
  resource: rdfjsResource.Resource;
136
170
  }): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreShape>;
137
171
  }
172
+ export {};
138
173
  //# sourceMappingURL=generated.d.ts.map
package/dist/generated.js CHANGED
@@ -4,7 +4,7 @@ import * as rdfjsResource from "rdfjs-resource";
4
4
  import { PropertyPath } from "./PropertyPath.js";
5
5
  export var BaseShaclCoreShape;
6
6
  (function (BaseShaclCoreShape) {
7
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
7
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
8
8
  // @ts-ignore
9
9
  ..._context }) {
10
10
  const _andEither = purify.Either.of([
@@ -467,185 +467,169 @@ export var BaseShaclCoreShape;
467
467
  xone,
468
468
  });
469
469
  }
470
- BaseShaclCoreShape.fromRdf = fromRdf;
470
+ BaseShaclCoreShape.propertiesFromRdf = propertiesFromRdf;
471
471
  })(BaseShaclCoreShape || (BaseShaclCoreShape = {}));
472
472
  export var ShaclCorePropertyShape;
473
473
  (function (ShaclCorePropertyShape) {
474
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
474
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
475
475
  // @ts-ignore
476
476
  ..._context }) {
477
- return BaseShaclCoreShape.fromRdf({
477
+ const _super0Either = BaseShaclCoreShape.propertiesFromRdf({
478
478
  ..._context,
479
479
  ignoreRdfType: true,
480
480
  languageIn: _languageIn,
481
481
  resource: _resource,
482
- }).chain((_super) => {
483
- if (!_ignoreRdfType &&
484
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"))) {
485
- return purify.Left(new rdfjsResource.Resource.ValueError({
486
- focusResource: _resource,
487
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
488
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
489
- }));
490
- }
491
- const _defaultValueEither = purify.Either.of(_resource
492
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), { unique: true })
482
+ });
483
+ if (_super0Either.isLeft()) {
484
+ return _super0Either;
485
+ }
486
+ const _super0 = _super0Either.unsafeCoerce();
487
+ if (!_ignoreRdfType &&
488
+ !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"))) {
489
+ return purify.Left(new rdfjsResource.Resource.ValueError({
490
+ focusResource: _resource,
491
+ message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
492
+ predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
493
+ }));
494
+ }
495
+ const _defaultValueEither = purify.Either.of(_resource
496
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), { unique: true })
497
+ .head()
498
+ .chain((_value) => purify.Either.of(_value.toTerm()))
499
+ .toMaybe());
500
+ if (_defaultValueEither.isLeft()) {
501
+ return _defaultValueEither;
502
+ }
503
+ const defaultValue = _defaultValueEither.unsafeCoerce();
504
+ const _descriptionsEither = purify.Either.of([
505
+ ..._resource
506
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), { unique: true })
507
+ .flatMap((_item) => _item
508
+ .toValues()
509
+ .filter((_value) => {
510
+ const _languageInOrDefault = _languageIn ?? [];
511
+ if (_languageInOrDefault.length === 0) {
512
+ return true;
513
+ }
514
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
515
+ if (typeof _valueLiteral === "undefined") {
516
+ return false;
517
+ }
518
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
519
+ })
493
520
  .head()
494
- .chain((_value) => purify.Either.of(_value.toTerm()))
495
- .toMaybe());
496
- if (_defaultValueEither.isLeft()) {
497
- return _defaultValueEither;
498
- }
499
- const defaultValue = _defaultValueEither.unsafeCoerce();
500
- const _descriptionsEither = purify.Either.of([
501
- ..._resource
502
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), { unique: true })
503
- .flatMap((_item) => _item
504
- .toValues()
505
- .filter((_value) => {
506
- const _languageInOrDefault = _languageIn ?? [];
507
- if (_languageInOrDefault.length === 0) {
508
- return true;
509
- }
510
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
511
- if (typeof _valueLiteral === "undefined") {
512
- return false;
513
- }
514
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
515
- })
516
- .head()
517
- .chain((_value) => _value.toLiteral())
518
- .toMaybe()
519
- .toList()),
520
- ]);
521
- if (_descriptionsEither.isLeft()) {
522
- return _descriptionsEither;
523
- }
524
- const descriptions = _descriptionsEither.unsafeCoerce();
525
- const _groupsEither = purify.Either.of([
526
- ..._resource
527
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), {
528
- unique: true,
529
- })
530
- .flatMap((_item) => _item
531
- .toValues()
532
- .head()
533
- .chain((_value) => _value.toIdentifier())
534
- .toMaybe()
535
- .toList()),
536
- ]);
537
- if (_groupsEither.isLeft()) {
538
- return _groupsEither;
539
- }
540
- const groups = _groupsEither.unsafeCoerce();
541
- const identifier = _resource.identifier;
542
- const _namesEither = purify.Either.of([
543
- ..._resource
544
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), {
545
- unique: true,
546
- })
547
- .flatMap((_item) => _item
548
- .toValues()
549
- .filter((_value) => {
550
- const _languageInOrDefault = _languageIn ?? [];
551
- if (_languageInOrDefault.length === 0) {
552
- return true;
553
- }
554
- const _valueLiteral = _value.toLiteral().toMaybe().extract();
555
- if (typeof _valueLiteral === "undefined") {
556
- return false;
557
- }
558
- return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
559
- })
560
- .head()
561
- .chain((_value) => _value.toLiteral())
562
- .toMaybe()
563
- .toList()),
564
- ]);
565
- if (_namesEither.isLeft()) {
566
- return _namesEither;
567
- }
568
- const names = _namesEither.unsafeCoerce();
569
- const _orderEither = purify.Either.of(_resource
570
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), {
521
+ .chain((_value) => _value.toLiteral())
522
+ .toMaybe()
523
+ .toList()),
524
+ ]);
525
+ if (_descriptionsEither.isLeft()) {
526
+ return _descriptionsEither;
527
+ }
528
+ const descriptions = _descriptionsEither.unsafeCoerce();
529
+ const _groupsEither = purify.Either.of([
530
+ ..._resource
531
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), {
571
532
  unique: true,
572
533
  })
534
+ .flatMap((_item) => _item
535
+ .toValues()
573
536
  .head()
574
- .chain((_value) => _value.toNumber())
575
- .toMaybe());
576
- if (_orderEither.isLeft()) {
577
- return _orderEither;
578
- }
579
- const order = _orderEither.unsafeCoerce();
580
- const _pathEither = _resource
581
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), {
537
+ .chain((_value) => _value.toIdentifier())
538
+ .toMaybe()
539
+ .toList()),
540
+ ]);
541
+ if (_groupsEither.isLeft()) {
542
+ return _groupsEither;
543
+ }
544
+ const groups = _groupsEither.unsafeCoerce();
545
+ const identifier = _resource.identifier;
546
+ const _namesEither = purify.Either.of([
547
+ ..._resource
548
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), {
582
549
  unique: true,
550
+ })
551
+ .flatMap((_item) => _item
552
+ .toValues()
553
+ .filter((_value) => {
554
+ const _languageInOrDefault = _languageIn ?? [];
555
+ if (_languageInOrDefault.length === 0) {
556
+ return true;
557
+ }
558
+ const _valueLiteral = _value.toLiteral().toMaybe().extract();
559
+ if (typeof _valueLiteral === "undefined") {
560
+ return false;
561
+ }
562
+ return _languageInOrDefault.some((_languageIn) => _languageIn === _valueLiteral.language);
583
563
  })
584
564
  .head()
585
- .chain((value) => value.toResource())
586
- .chain((_resource) => PropertyPath.fromRdf({
587
- ..._context,
588
- ignoreRdfType: true,
589
- languageIn: _languageIn,
590
- resource: _resource,
591
- }));
592
- if (_pathEither.isLeft()) {
593
- return _pathEither;
594
- }
595
- const path = _pathEither.unsafeCoerce();
596
- const type = "ShaclCorePropertyShape";
597
- const _uniqueLangEither = purify.Either.of(_resource
598
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), { unique: true })
599
- .head()
600
- .chain((_value) => _value.toBoolean())
601
- .toMaybe());
602
- if (_uniqueLangEither.isLeft()) {
603
- return _uniqueLangEither;
604
- }
605
- const uniqueLang = _uniqueLangEither.unsafeCoerce();
606
- return purify.Either.of({
607
- and: _super.and,
608
- classes: _super.classes,
609
- comments: _super.comments,
610
- datatype: _super.datatype,
611
- deactivated: _super.deactivated,
612
- flags: _super.flags,
613
- hasValues: _super.hasValues,
614
- identifier,
615
- in_: _super.in_,
616
- isDefinedBy: _super.isDefinedBy,
617
- labels: _super.labels,
618
- languageIn: _super.languageIn,
619
- maxCount: _super.maxCount,
620
- maxExclusive: _super.maxExclusive,
621
- maxInclusive: _super.maxInclusive,
622
- maxLength: _super.maxLength,
623
- minCount: _super.minCount,
624
- minExclusive: _super.minExclusive,
625
- minInclusive: _super.minInclusive,
626
- minLength: _super.minLength,
627
- nodeKind: _super.nodeKind,
628
- nodes: _super.nodes,
629
- not: _super.not,
630
- or: _super.or,
631
- patterns: _super.patterns,
632
- xone: _super.xone,
633
- defaultValue,
634
- descriptions,
635
- groups,
636
- names,
637
- order,
638
- path,
639
- type,
640
- uniqueLang,
641
- });
565
+ .chain((_value) => _value.toLiteral())
566
+ .toMaybe()
567
+ .toList()),
568
+ ]);
569
+ if (_namesEither.isLeft()) {
570
+ return _namesEither;
571
+ }
572
+ const names = _namesEither.unsafeCoerce();
573
+ const _orderEither = purify.Either.of(_resource
574
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#order"), {
575
+ unique: true,
576
+ })
577
+ .head()
578
+ .chain((_value) => _value.toNumber())
579
+ .toMaybe());
580
+ if (_orderEither.isLeft()) {
581
+ return _orderEither;
582
+ }
583
+ const order = _orderEither.unsafeCoerce();
584
+ const _pathEither = _resource
585
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#path"), {
586
+ unique: true,
587
+ })
588
+ .head()
589
+ .chain((value) => value.toResource())
590
+ .chain((_resource) => PropertyPath.fromRdf({
591
+ ..._context,
592
+ ignoreRdfType: true,
593
+ languageIn: _languageIn,
594
+ resource: _resource,
595
+ }));
596
+ if (_pathEither.isLeft()) {
597
+ return _pathEither;
598
+ }
599
+ const path = _pathEither.unsafeCoerce();
600
+ const type = "ShaclCorePropertyShape";
601
+ const _uniqueLangEither = purify.Either.of(_resource
602
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"), { unique: true })
603
+ .head()
604
+ .chain((_value) => _value.toBoolean())
605
+ .toMaybe());
606
+ if (_uniqueLangEither.isLeft()) {
607
+ return _uniqueLangEither;
608
+ }
609
+ const uniqueLang = _uniqueLangEither.unsafeCoerce();
610
+ return purify.Either.of({
611
+ ..._super0,
612
+ defaultValue,
613
+ descriptions,
614
+ groups,
615
+ identifier,
616
+ names,
617
+ order,
618
+ path,
619
+ type,
620
+ uniqueLang,
642
621
  });
643
622
  }
623
+ ShaclCorePropertyShape.propertiesFromRdf = propertiesFromRdf;
624
+ function fromRdf(parameters) {
625
+ return ShaclCorePropertyShape.propertiesFromRdf(parameters);
626
+ }
644
627
  ShaclCorePropertyShape.fromRdf = fromRdf;
628
+ ShaclCorePropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
645
629
  })(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
646
630
  export var ShaclCorePropertyGroup;
647
631
  (function (ShaclCorePropertyGroup) {
648
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
632
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
649
633
  // @ts-ignore
650
634
  ..._context }) {
651
635
  if (!_ignoreRdfType &&
@@ -710,108 +694,99 @@ export var ShaclCorePropertyGroup;
710
694
  const type = "ShaclCorePropertyGroup";
711
695
  return purify.Either.of({ comments, identifier, labels, type });
712
696
  }
697
+ ShaclCorePropertyGroup.propertiesFromRdf = propertiesFromRdf;
698
+ function fromRdf(parameters) {
699
+ return ShaclCorePropertyGroup.propertiesFromRdf(parameters);
700
+ }
713
701
  ShaclCorePropertyGroup.fromRdf = fromRdf;
702
+ ShaclCorePropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
714
703
  })(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
715
704
  export var ShaclCoreNodeShape;
716
705
  (function (ShaclCoreNodeShape) {
717
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
706
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
718
707
  // @ts-ignore
719
708
  ..._context }) {
720
- return BaseShaclCoreShape.fromRdf({
709
+ const _super0Either = BaseShaclCoreShape.propertiesFromRdf({
721
710
  ..._context,
722
711
  ignoreRdfType: true,
723
712
  languageIn: _languageIn,
724
713
  resource: _resource,
725
- }).chain((_super) => {
726
- if (!_ignoreRdfType &&
727
- !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
728
- return purify.Left(new rdfjsResource.Resource.ValueError({
729
- focusResource: _resource,
730
- message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
731
- predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
732
- }));
733
- }
734
- const _closedEither = purify.Either.of(_resource
735
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), {
714
+ });
715
+ if (_super0Either.isLeft()) {
716
+ return _super0Either;
717
+ }
718
+ const _super0 = _super0Either.unsafeCoerce();
719
+ if (!_ignoreRdfType &&
720
+ !_resource.isInstanceOf(dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"))) {
721
+ return purify.Left(new rdfjsResource.Resource.ValueError({
722
+ focusResource: _resource,
723
+ message: `${rdfjsResource.Resource.Identifier.toString(_resource.identifier)} has unexpected RDF type`,
724
+ predicate: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
725
+ }));
726
+ }
727
+ const _closedEither = purify.Either.of(_resource
728
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"), {
729
+ unique: true,
730
+ })
731
+ .head()
732
+ .chain((_value) => _value.toBoolean())
733
+ .toMaybe());
734
+ if (_closedEither.isLeft()) {
735
+ return _closedEither;
736
+ }
737
+ const closed = _closedEither.unsafeCoerce();
738
+ const identifier = _resource.identifier;
739
+ const _ignoredPropertiesEither = purify.Either.of(_resource
740
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), { unique: true })
741
+ .head()
742
+ .chain((value) => value.toList())
743
+ .map((values) => values.flatMap((_value) => _value
744
+ .toValues()
745
+ .head()
746
+ .chain((_value) => _value.toIri())
747
+ .toMaybe()
748
+ .toList()))
749
+ .toMaybe());
750
+ if (_ignoredPropertiesEither.isLeft()) {
751
+ return _ignoredPropertiesEither;
752
+ }
753
+ const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
754
+ const _propertiesEither = purify.Either.of([
755
+ ..._resource
756
+ .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), {
736
757
  unique: true,
737
758
  })
738
- .head()
739
- .chain((_value) => _value.toBoolean())
740
- .toMaybe());
741
- if (_closedEither.isLeft()) {
742
- return _closedEither;
743
- }
744
- const closed = _closedEither.unsafeCoerce();
745
- const identifier = _resource.identifier;
746
- const _ignoredPropertiesEither = purify.Either.of(_resource
747
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#ignoredProperties"), { unique: true })
748
- .head()
749
- .chain((value) => value.toList())
750
- .map((values) => values.flatMap((_value) => _value
759
+ .flatMap((_item) => _item
751
760
  .toValues()
752
761
  .head()
753
- .chain((_value) => _value.toIri())
762
+ .chain((_value) => _value.toIdentifier())
754
763
  .toMaybe()
755
- .toList()))
756
- .toMaybe());
757
- if (_ignoredPropertiesEither.isLeft()) {
758
- return _ignoredPropertiesEither;
759
- }
760
- const ignoredProperties = _ignoredPropertiesEither.unsafeCoerce();
761
- const _propertiesEither = purify.Either.of([
762
- ..._resource
763
- .values(dataFactory.namedNode("http://www.w3.org/ns/shacl#property"), { unique: true })
764
- .flatMap((_item) => _item
765
- .toValues()
766
- .head()
767
- .chain((_value) => _value.toIdentifier())
768
- .toMaybe()
769
- .toList()),
770
- ]);
771
- if (_propertiesEither.isLeft()) {
772
- return _propertiesEither;
773
- }
774
- const properties = _propertiesEither.unsafeCoerce();
775
- const type = "ShaclCoreNodeShape";
776
- return purify.Either.of({
777
- and: _super.and,
778
- classes: _super.classes,
779
- comments: _super.comments,
780
- datatype: _super.datatype,
781
- deactivated: _super.deactivated,
782
- flags: _super.flags,
783
- hasValues: _super.hasValues,
784
- identifier,
785
- in_: _super.in_,
786
- isDefinedBy: _super.isDefinedBy,
787
- labels: _super.labels,
788
- languageIn: _super.languageIn,
789
- maxCount: _super.maxCount,
790
- maxExclusive: _super.maxExclusive,
791
- maxInclusive: _super.maxInclusive,
792
- maxLength: _super.maxLength,
793
- minCount: _super.minCount,
794
- minExclusive: _super.minExclusive,
795
- minInclusive: _super.minInclusive,
796
- minLength: _super.minLength,
797
- nodeKind: _super.nodeKind,
798
- nodes: _super.nodes,
799
- not: _super.not,
800
- or: _super.or,
801
- patterns: _super.patterns,
802
- xone: _super.xone,
803
- closed,
804
- ignoredProperties,
805
- properties,
806
- type,
807
- });
764
+ .toList()),
765
+ ]);
766
+ if (_propertiesEither.isLeft()) {
767
+ return _propertiesEither;
768
+ }
769
+ const properties = _propertiesEither.unsafeCoerce();
770
+ const type = "ShaclCoreNodeShape";
771
+ return purify.Either.of({
772
+ ..._super0,
773
+ closed,
774
+ identifier,
775
+ ignoredProperties,
776
+ properties,
777
+ type,
808
778
  });
809
779
  }
780
+ ShaclCoreNodeShape.propertiesFromRdf = propertiesFromRdf;
781
+ function fromRdf(parameters) {
782
+ return ShaclCoreNodeShape.propertiesFromRdf(parameters);
783
+ }
810
784
  ShaclCoreNodeShape.fromRdf = fromRdf;
785
+ ShaclCoreNodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
811
786
  })(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
812
787
  export var OwlOntology;
813
788
  (function (OwlOntology) {
814
- function fromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
789
+ function propertiesFromRdf({ ignoreRdfType: _ignoreRdfType, languageIn: _languageIn, resource: _resource,
815
790
  // @ts-ignore
816
791
  ..._context }) {
817
792
  if (!_ignoreRdfType &&
@@ -851,12 +826,20 @@ export var OwlOntology;
851
826
  const type = "OwlOntology";
852
827
  return purify.Either.of({ identifier, labels, type });
853
828
  }
829
+ OwlOntology.propertiesFromRdf = propertiesFromRdf;
830
+ function fromRdf(parameters) {
831
+ return OwlOntology.propertiesFromRdf(parameters);
832
+ }
854
833
  OwlOntology.fromRdf = fromRdf;
834
+ OwlOntology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
855
835
  })(OwlOntology || (OwlOntology = {}));
856
836
  export var ShaclCoreShape;
857
837
  (function (ShaclCoreShape) {
858
- function fromRdf(parameters) {
859
- return ShaclCoreNodeShape.fromRdf(parameters).altLazy(() => ShaclCorePropertyShape.fromRdf(parameters));
838
+ function fromRdf({ ignoreRdfType, resource, ...context }) {
839
+ return ShaclCoreNodeShape.fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShape.fromRdf({
840
+ ...context,
841
+ resource,
842
+ }));
860
843
  }
861
844
  ShaclCoreShape.fromRdf = fromRdf;
862
845
  })(ShaclCoreShape || (ShaclCoreShape = {}));
package/package.json CHANGED
@@ -51,5 +51,5 @@
51
51
  "url": "git+https://github.com/minorg/shaclmate"
52
52
  },
53
53
  "type": "module",
54
- "version": "2.0.17"
54
+ "version": "2.0.18"
55
55
  }