@shaclmate/compiler 2.0.15 → 2.0.16

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.
Files changed (32) hide show
  1. package/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +5 -3
  2. package/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +2 -2
  3. package/ast/ListType.d.ts +2 -2
  4. package/ast/ObjectType.d.ts +18 -12
  5. package/enums/IdentifierMintingStrategy.d.ts +5 -0
  6. package/enums/IdentifierMintingStrategy.js +2 -0
  7. package/enums/index.d.ts +1 -1
  8. package/enums/index.js +1 -1
  9. package/generators/json/AstJsonGenerator.js +5 -1
  10. package/generators/ts/IdentifierType.d.ts +2 -0
  11. package/generators/ts/IdentifierType.js +11 -0
  12. package/generators/ts/ListType.d.ts +2 -2
  13. package/generators/ts/ListType.js +10 -7
  14. package/generators/ts/ObjectType.d.ts +3 -3
  15. package/generators/ts/ObjectType.js +1 -0
  16. package/generators/ts/ObjectUnionType.js +8 -7
  17. package/generators/ts/TypeFactory.js +4 -4
  18. package/generators/ts/_ObjectType/IdentifierProperty.d.ts +5 -5
  19. package/generators/ts/_ObjectType/IdentifierProperty.js +84 -19
  20. package/generators/ts/_ObjectType/fromRdfTypeVariableStatement.d.ts +5 -0
  21. package/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +25 -0
  22. package/generators/ts/_ObjectType/index.d.ts +1 -0
  23. package/generators/ts/_ObjectType/index.js +1 -0
  24. package/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +3 -3
  25. package/input/NodeShape.d.ts +2 -2
  26. package/input/generated.d.ts +17 -10
  27. package/input/generated.js +41 -12
  28. package/input/tsFeatures.d.ts +1 -1
  29. package/input/tsFeatures.js +4 -0
  30. package/package.json +3 -3
  31. package/enums/MintingStrategy.d.ts +0 -5
  32. package/enums/MintingStrategy.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { rdf } from "@tpluscode/rdf-ns-builders";
2
- import { Either, Left } from "purify-ts";
2
+ import { Either, Left, Maybe } from "purify-ts";
3
3
  import { invariant } from "ts-invariant";
4
4
  import { TsFeature } from "../enums/index.js";
5
5
  import * as input from "../input/index.js";
@@ -125,6 +125,7 @@ export function transformNodeShapeToAstType(nodeShape) {
125
125
  }
126
126
  return Either.of(compositeType);
127
127
  }
128
+ const identifierIn = nodeShape.constraints.in_.filter((term) => term.termType === "NamedNode");
128
129
  // Put a placeholder in the cache to deal with cyclic references
129
130
  // If this node shape's properties (directly or indirectly) refer to the node shape itself,
130
131
  // we'll return this placeholder.
@@ -139,9 +140,10 @@ export function transformNodeShapeToAstType(nodeShape) {
139
140
  fromRdfType: nodeShape.fromRdfType,
140
141
  label: pickLiteral(nodeShape.labels).map((literal) => literal.value),
141
142
  kind: "ObjectType",
142
- mintingStrategy: nodeShape.mintingStrategy,
143
+ identifierIn,
144
+ identifierMintingStrategy: identifierIn.length === 0 ? nodeShape.mintingStrategy : Maybe.empty(),
145
+ identifierKinds: identifierIn.length === 0 ? nodeShape.nodeKinds : new Set(["NamedNode"]),
143
146
  name: this.shapeAstName(nodeShape),
144
- nodeKinds: nodeShape.nodeKinds,
145
147
  properties: [], // This is mutable, we'll populate it below.
146
148
  parentObjectTypes: [], // This is mutable, we'll populate it below
147
149
  toRdfTypes: nodeShape.toRdfTypes,
@@ -27,13 +27,13 @@ export function transformPropertyShapeToAstCompositeType(shape, inherited) {
27
27
  nodeKinds.add(astType.identifierNodeKind);
28
28
  break;
29
29
  case "ObjectType":
30
- nodeKinds = astType.nodeKinds;
30
+ nodeKinds = astType.identifierKinds;
31
31
  break;
32
32
  case "ObjectIntersectionType":
33
33
  case "ObjectUnionType":
34
34
  nodeKinds = new Set();
35
35
  for (const memberType of astType.memberTypes) {
36
- for (const nodeKind of memberType.nodeKinds) {
36
+ for (const nodeKind of memberType.identifierKinds) {
37
37
  nodeKinds.add(nodeKind);
38
38
  }
39
39
  }
package/ast/ListType.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import type { Maybe } from "purify-ts";
3
- import type { MintingStrategy } from "../enums/MintingStrategy.js";
3
+ import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
4
4
  import type { Name } from "./Name.js";
5
5
  import type { Type } from "./Type.js";
6
6
  /**
@@ -33,7 +33,7 @@ export interface ListType {
33
33
  /**
34
34
  * Strategy for minting new list and sub-list identifiers.
35
35
  */
36
- readonly mintingStrategy: Maybe<MintingStrategy>;
36
+ readonly mintingStrategy: Maybe<IdentifierMintingStrategy>;
37
37
  /**
38
38
  * The list should be mutable in generated code.
39
39
  */
@@ -1,7 +1,7 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
- import type { PredicatePath } from "@shaclmate/shacl-ast";
2
+ import type { NodeKind, PredicatePath } from "@shaclmate/shacl-ast";
3
3
  import type { Maybe } from "purify-ts";
4
- import type { MintingStrategy, PropertyVisibility, TsFeature, TsObjectDeclarationType } from "../enums/index.js";
4
+ import type { IdentifierMintingStrategy, PropertyVisibility, TsFeature, TsObjectDeclarationType } from "../enums/index.js";
5
5
  import type { Name } from "./Name.js";
6
6
  import type { Type } from "./Type.js";
7
7
  export interface ObjectType {
@@ -52,6 +52,22 @@ export interface ObjectType {
52
52
  * class targets).
53
53
  */
54
54
  readonly fromRdfType: Maybe<NamedNode>;
55
+ /**
56
+ * Instances of this ObjectType must have explicit identifiers and the identifiers must be in this list of IRIs.
57
+ *
58
+ * Mutually exclusive with minting strategies
59
+ */
60
+ readonly identifierIn: readonly NamedNode[];
61
+ /**
62
+ * The RDF node kinds this ObjectType may be identified by.
63
+ *
64
+ * Used to associate instances with an RDF identifier.
65
+ */
66
+ readonly identifierKinds: Set<Exclude<NodeKind, "Literal">>;
67
+ /**
68
+ * Strategy for minting new object identifiers.
69
+ */
70
+ readonly identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
55
71
  /**
56
72
  * Type discriminator.
57
73
  */
@@ -60,20 +76,10 @@ export interface ObjectType {
60
76
  * Human-readable label from rdfs:label.
61
77
  */
62
78
  readonly label: Maybe<string>;
63
- /**
64
- * Strategy for minting new object identifiers.
65
- */
66
- readonly mintingStrategy: Maybe<MintingStrategy>;
67
79
  /**
68
80
  * Name of this type, usually derived from sh:name or shaclmate:name.
69
81
  */
70
82
  readonly name: Name;
71
- /**
72
- * The RDF node kinds this ObjectType may be identified by.
73
- *
74
- * Used to associate instances with an RDF identifier.
75
- */
76
- readonly nodeKinds: Set<"BlankNode" | "NamedNode">;
77
83
  /**
78
84
  * Immediate parent ObjectTypes of this Object types.
79
85
  *
@@ -0,0 +1,5 @@
1
+ /**
2
+ * TypeScript enum corresponding to shaclmate:mintingStrategy, for simpler manipulation.
3
+ */
4
+ export type IdentifierMintingStrategy = "sha256" | "uuidv4";
5
+ //# sourceMappingURL=IdentifierMintingStrategy.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IdentifierMintingStrategy.js.map
package/enums/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./MintingStrategy.js";
1
+ export * from "./IdentifierMintingStrategy.js";
2
2
  export * from "./PropertyVisibility.js";
3
3
  export * from "./TsFeature.js";
4
4
  export * from "./TsObjectDeclarationType.js";
package/enums/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./MintingStrategy.js";
1
+ export * from "./IdentifierMintingStrategy.js";
2
2
  export * from "./PropertyVisibility.js";
3
3
  export * from "./TsFeature.js";
4
4
  export * from "./TsObjectDeclarationType.js";
@@ -70,7 +70,11 @@ function typeToJson(type) {
70
70
  parentObjectTypes: type.parentObjectTypes.length > 0
71
71
  ? type.parentObjectTypes.map((type) => nameToJson(type.name))
72
72
  : undefined,
73
- nodeKinds: [...type.nodeKinds],
73
+ identifierIn: type.identifierIn.length > 0
74
+ ? type.identifierIn.map(termToJson)
75
+ : undefined,
76
+ identifierKinds: [...type.identifierKinds],
77
+ identifierMintingStrategy: type.identifierMintingStrategy.extract(),
74
78
  toRdfTypes: type.toRdfTypes.length > 0
75
79
  ? type.toRdfTypes.map(termToJson)
76
80
  : undefined,
@@ -1,7 +1,9 @@
1
1
  import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import { TermType } from "./TermType.js";
3
+ import type { Type } from "./Type.js";
3
4
  export declare class IdentifierType extends TermType<BlankNode | NamedNode> {
4
5
  readonly kind = "IdentifierType";
6
+ get conversions(): readonly Type.Conversion[];
5
7
  get isNamedNodeKind(): boolean;
6
8
  get jsonName(): string;
7
9
  get name(): string;
@@ -11,6 +11,17 @@ export class IdentifierType extends TermType {
11
11
  super(...arguments);
12
12
  this.kind = "IdentifierType";
13
13
  }
14
+ get conversions() {
15
+ return super.conversions.concat([
16
+ {
17
+ conversionExpression: (value) => `${this.dataFactoryVariable}.namedNode(${value})`,
18
+ sourceTypeCheckExpression: (value) => `typeof ${value} === "string"`,
19
+ sourceTypeName: this.in_.length > 0
20
+ ? this.in_.map((iri) => `"${iri.value}"`).join(" | ")
21
+ : "string",
22
+ },
23
+ ]);
24
+ }
14
25
  get isNamedNodeKind() {
15
26
  return this.nodeKinds.size === 1 && this.nodeKinds.has("NamedNode");
16
27
  }
@@ -1,6 +1,6 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
- import type { MintingStrategy, TsFeature } from "../../enums/index.js";
3
+ import type { IdentifierMintingStrategy, TsFeature } from "../../enums/index.js";
4
4
  import { Import } from "./Import.js";
5
5
  import { Type } from "./Type.js";
6
6
  export declare class ListType extends Type {
@@ -13,7 +13,7 @@ export declare class ListType extends Type {
13
13
  constructor({ identifierNodeKind, itemType, mintingStrategy, mutable, toRdfTypes, ...superParameters }: {
14
14
  identifierNodeKind: ListType["identifierNodeKind"];
15
15
  itemType: Type;
16
- mintingStrategy: Maybe<MintingStrategy>;
16
+ mintingStrategy: Maybe<IdentifierMintingStrategy>;
17
17
  mutable: boolean;
18
18
  toRdfTypes: readonly NamedNode[];
19
19
  } & ConstructorParameters<typeof Type>[0]);
@@ -124,6 +124,10 @@ export class ListType extends Type {
124
124
  }
125
125
  }
126
126
  sparqlWherePatterns({ variables, context, }) {
127
+ // Need to handle two cases:
128
+ // (1) (?s, ?p, ?list) where ?list binds to rdf:nil
129
+ // (2) (?s, ?p, ?list) (?list, rdf:first, "element") (?list, rdf:rest, rdf:nil) etc. where list binds to the head of a list
130
+ // Case (2) is case (1) with OPTIONAL graph patterns to handle actual list elements.
127
131
  switch (context) {
128
132
  case "property":
129
133
  return super.sparqlWherePatterns({ context, variables });
@@ -186,7 +190,8 @@ export class ListType extends Type {
186
190
  object: variable("RestNBasic"),
187
191
  })}] }`);
188
192
  patterns.push(`{ type: "optional", patterns: [${optionalPatterns.join(", ")}] }`);
189
- return patterns;
193
+ // Having an optional around everything handles the rdf:nil case
194
+ return [`{ type: "optional", patterns: [${patterns.join(", ")}] }`];
190
195
  }
191
196
  }
192
197
  }
@@ -236,12 +241,11 @@ export class ListType extends Type {
236
241
  break;
237
242
  }
238
243
  }
239
- return `${variables.value}.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
244
+ return `${variables.value}.length > 0 ? ${variables.value}.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
240
245
  if (itemIndex === 0) {
241
246
  currentSubListResource = listResource;
242
247
  } else {
243
- const newSubListResource = ${variables.resourceSet}.${resourceSetMethodName}(${objectInitializer({
244
- identifier: subListIdentifier,
248
+ const newSubListResource = ${variables.resourceSet}.${resourceSetMethodName}(${subListIdentifier}, ${objectInitializer({
245
249
  mutateGraph: variables.mutateGraph,
246
250
  })});
247
251
  currentSubListResource!.add(dataFactory.namedNode("${rdf.rest.value}"), newSubListResource.identifier);
@@ -260,15 +264,14 @@ export class ListType extends Type {
260
264
  },
261
265
  {
262
266
  currentSubListResource: null,
263
- listResource: resourceSet.${resourceSetMethodName}(${objectInitializer({
264
- identifier: listIdentifier,
267
+ listResource: resourceSet.${resourceSetMethodName}(${listIdentifier}, ${objectInitializer({
265
268
  mutateGraph: variables.mutateGraph,
266
269
  })}),
267
270
  } as {
268
271
  currentSubListResource: ${mutableResourceTypeName} | null;
269
272
  listResource: ${mutableResourceTypeName};
270
273
  },
271
- ).listResource.identifier`;
274
+ ).listResource.identifier : dataFactory.namedNode("${rdf.nil.value}")`;
272
275
  }
273
276
  useImports(features) {
274
277
  const imports = this.itemType.useImports(features).concat();
@@ -1,7 +1,7 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { type ClassDeclarationStructure, type InterfaceDeclarationStructure, type ModuleDeclarationStructure } from "ts-morph";
4
- import type { MintingStrategy, TsFeature, TsObjectDeclarationType } from "../../enums/index.js";
4
+ import type { IdentifierMintingStrategy, TsFeature, TsObjectDeclarationType } from "../../enums/index.js";
5
5
  import { DeclaredType } from "./DeclaredType.js";
6
6
  import type { IdentifierType } from "./IdentifierType.js";
7
7
  import { Import } from "./Import.js";
@@ -15,7 +15,7 @@ export declare class ObjectType extends DeclaredType {
15
15
  protected readonly extern: boolean;
16
16
  protected readonly fromRdfType: Maybe<NamedNode>;
17
17
  protected readonly label: Maybe<string>;
18
- protected readonly mintingStrategy: Maybe<MintingStrategy>;
18
+ protected readonly mintingStrategy: Maybe<IdentifierMintingStrategy>;
19
19
  protected readonly toRdfTypes: readonly NamedNode[];
20
20
  private readonly imports;
21
21
  private readonly lazyAncestorObjectTypes;
@@ -34,7 +34,7 @@ export declare class ObjectType extends DeclaredType {
34
34
  lazyDescendantObjectTypes: () => readonly ObjectType[];
35
35
  lazyParentObjectTypes: () => readonly ObjectType[];
36
36
  lazyProperties: () => readonly ObjectType.Property[];
37
- mintingStrategy: Maybe<MintingStrategy>;
37
+ mintingStrategy: Maybe<IdentifierMintingStrategy>;
38
38
  toRdfTypes: readonly NamedNode[];
39
39
  } & ConstructorParameters<typeof DeclaredType>[0]);
40
40
  get _discriminatorProperty(): Type.DiscriminatorProperty;
@@ -84,6 +84,7 @@ export class ObjectType extends DeclaredType {
84
84
  ..._ObjectType.equalsFunctionDeclaration.bind(this)().toList(),
85
85
  ..._ObjectType.fromJsonFunctionDeclarations.bind(this)(),
86
86
  ..._ObjectType.fromRdfFunctionDeclarations.bind(this)(),
87
+ ..._ObjectType.fromRdfTypeVariableDeclaration.bind(this)().toList(),
87
88
  ..._ObjectType.jsonSchemaFunctionDeclaration.bind(this)().toList(),
88
89
  ..._ObjectType.jsonUiSchemaFunctionDeclaration.bind(this)().toList(),
89
90
  ..._ObjectType.jsonZodSchemaFunctionDeclaration.bind(this)().toList(),
@@ -170,14 +170,14 @@ return strictEquals(left.type, right.type).chain(() => {
170
170
  name: "fromRdf",
171
171
  parameters: [
172
172
  {
173
- name: "parameters",
173
+ name: "{ ignoreRdfType, resource, ...context }",
174
174
  type: `{ [_index: string]: any; ignoreRdfType?: boolean; resource: ${this.rdfjsResourceType().name}; }`,
175
175
  },
176
176
  ],
177
177
  returnType: `purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>`,
178
178
  statements: [
179
179
  `return ${this.memberTypes.reduce((expression, memberType) => {
180
- const memberTypeExpression = `(${memberType.name}.fromRdf(parameters) as purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>)`;
180
+ const memberTypeExpression = `(${memberType.name}.fromRdf({ ...context, resource }) as purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>)`;
181
181
  return expression.length > 0
182
182
  ? `${expression}.altLazy(() => ${memberTypeExpression})`
183
183
  : memberTypeExpression;
@@ -249,6 +249,7 @@ return strictEquals(left.type, right.type).chain(() => {
249
249
  isExported: true,
250
250
  kind: StructureKind.Function,
251
251
  name: "sparqlConstructTemplateTriples",
252
+ // Accept ignoreRdfType in order to reuse code but don't pass it through, since deserialization may depend on it
252
253
  parameters: [
253
254
  {
254
255
  name: "parameters",
@@ -258,7 +259,7 @@ return strictEquals(left.type, right.type).chain(() => {
258
259
  returnType: "readonly sparqljs.Triple[]",
259
260
  statements: [
260
261
  `return [${this.memberTypes
261
- .map((memberType) => `...${memberType.name}.sparqlConstructTemplateTriples({ ignoreRdfType: parameters?.ignoreRdfType, subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`)
262
+ .map((memberType) => `...${memberType.name}.sparqlConstructTemplateTriples({ subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`)
262
263
  .join(", ")}];`,
263
264
  ],
264
265
  },
@@ -266,6 +267,7 @@ return strictEquals(left.type, right.type).chain(() => {
266
267
  isExported: true,
267
268
  kind: StructureKind.Function,
268
269
  name: "sparqlWherePatterns",
270
+ // Accept ignoreRdfType in order to reuse code but don't pass it through, since deserialization may depend on it
269
271
  parameters: [
270
272
  {
271
273
  name: "parameters",
@@ -276,7 +278,7 @@ return strictEquals(left.type, right.type).chain(() => {
276
278
  statements: [
277
279
  `return [{ patterns: [${this.memberTypes
278
280
  .map((memberType) => objectInitializer({
279
- patterns: `${memberType.name}.sparqlWherePatterns({ ignoreRdfType: parameters?.ignoreRdfType, subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`,
281
+ patterns: `${memberType.name}.sparqlWherePatterns({ subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`,
280
282
  type: '"group"',
281
283
  }))
282
284
  .join(", ")}], type: "union" }];`,
@@ -363,7 +365,8 @@ return strictEquals(left.type, right.type).chain(() => {
363
365
  return `${this.name}.fromJson(${variables.value}).unsafeCoerce()`;
364
366
  }
365
367
  fromRdfExpression({ variables, }) {
366
- return `${variables.resourceValues}.head().chain(value => value.to${this.rdfjsResourceType().named ? "Named" : ""}Resource()).chain(_resource => ${this.name}.fromRdf({ ...${variables.context}, resource: _resource }))`;
368
+ // Don't ignoreRdfType, we may need it to distinguish the union members
369
+ return `${variables.resourceValues}.head().chain(value => value.to${this.rdfjsResourceType().named ? "Named" : ""}Resource()).chain(_resource => ${this.name}.fromRdf({ ...${variables.context}, languageIn: ${variables.languageIn}, resource: _resource }))`;
367
370
  }
368
371
  hashStatements({ variables, }) {
369
372
  switch (this.memberTypes[0].declarationType) {
@@ -383,7 +386,6 @@ return strictEquals(left.type, right.type).chain(() => {
383
386
  case "type":
384
387
  return [
385
388
  `...${this.name}.sparqlConstructTemplateTriples(${objectInitializer({
386
- ignoreRdfType: true,
387
389
  subject: variables.subject,
388
390
  variablePrefix: variables.variablePrefix,
389
391
  })})`,
@@ -397,7 +399,6 @@ return strictEquals(left.type, right.type).chain(() => {
397
399
  case "type":
398
400
  return [
399
401
  `...${this.name}.sparqlWherePatterns(${objectInitializer({
400
- ignoreRdfType: true,
401
402
  subject: variables.subject,
402
403
  variablePrefix: variables.variablePrefix,
403
404
  })})`,
@@ -214,8 +214,8 @@ export class TypeFactory {
214
214
  dataFactoryVariable: this.dataFactoryVariable,
215
215
  defaultValue: Maybe.empty(),
216
216
  hasValues: [],
217
- in_: [],
218
- nodeKinds: astType.nodeKinds,
217
+ in_: astType.identifierIn,
218
+ nodeKinds: astType.identifierKinds,
219
219
  });
220
220
  const objectType = new ObjectType({
221
221
  abstract: astType.abstract,
@@ -253,7 +253,7 @@ export class TypeFactory {
253
253
  abstract: astType.abstract,
254
254
  classDeclarationVisibility: identifierPropertyClassDeclarationVisibility,
255
255
  dataFactoryVariable: this.dataFactoryVariable,
256
- mintingStrategy: astType.mintingStrategy,
256
+ identifierMintingStrategy: astType.identifierMintingStrategy,
257
257
  name: astType.tsIdentifierPropertyName,
258
258
  lazyObjectTypeMutable: () => properties.some((property) => property.mutable || property.type.mutable),
259
259
  objectType: {
@@ -295,7 +295,7 @@ export class TypeFactory {
295
295
  }
296
296
  return properties.sort((left, right) => left.name.localeCompare(right.name));
297
297
  },
298
- mintingStrategy: astType.mintingStrategy,
298
+ mintingStrategy: astType.identifierMintingStrategy,
299
299
  name: tsName(astType.name),
300
300
  toRdfTypes: astType.toRdfTypes,
301
301
  });
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import type { GetAccessorDeclarationStructure, OptionalKind, PropertyDeclarationStructure, PropertySignatureStructure } from "ts-morph";
3
- import type { MintingStrategy, PropertyVisibility } from "../../../enums/index.js";
3
+ import type { IdentifierMintingStrategy, PropertyVisibility } from "../../../enums/index.js";
4
4
  import type { IdentifierType } from "../IdentifierType.js";
5
5
  import { Import } from "../Import.js";
6
6
  import { Property } from "./Property.js";
@@ -9,14 +9,14 @@ export declare class IdentifierProperty extends Property<IdentifierType> {
9
9
  readonly equalsFunction = "booleanEquals";
10
10
  readonly mutable = false;
11
11
  private readonly classDeclarationVisibility;
12
+ private readonly identifierMintingStrategy;
12
13
  private readonly lazyObjectTypeMutable;
13
- private readonly mintingStrategy;
14
14
  private readonly override;
15
- constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, mintingStrategy, override, ...superParameters }: {
15
+ constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, identifierMintingStrategy, override, ...superParameters }: {
16
16
  abstract: boolean;
17
17
  classDeclarationVisibility: Maybe<PropertyVisibility>;
18
18
  lazyObjectTypeMutable: () => boolean;
19
- mintingStrategy: Maybe<MintingStrategy>;
19
+ identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
20
20
  override: boolean;
21
21
  type: IdentifierType;
22
22
  } & ConstructorParameters<typeof Property>[0]);
@@ -30,7 +30,7 @@ export declare class IdentifierProperty extends Property<IdentifierType> {
30
30
  classConstructorStatements({ variables, }: Parameters<Property<IdentifierType>["classConstructorStatements"]>[0]): readonly string[];
31
31
  fromJsonStatements({ variables, }: Parameters<Property<IdentifierType>["fromJsonStatements"]>[0]): readonly string[];
32
32
  fromRdfStatements({ variables, }: Parameters<Property<IdentifierType>["fromRdfStatements"]>[0]): readonly string[];
33
- hashStatements(): readonly string[];
33
+ hashStatements({ variables, }: Parameters<Property<IdentifierType>["hashStatements"]>[0]): readonly string[];
34
34
  interfaceConstructorStatements({ variables, }: Parameters<Property<IdentifierType>["interfaceConstructorStatements"]>[0]): readonly string[];
35
35
  jsonUiSchemaElement({ variables, }: Parameters<Property<IdentifierType>["jsonUiSchemaElement"]>[0]): Maybe<string>;
36
36
  jsonZodSchema({ variables, }: Parameters<Property<IdentifierType>["jsonZodSchema"]>[0]): ReturnType<Property<IdentifierType>["jsonZodSchema"]>;
@@ -1,24 +1,25 @@
1
+ import { rdf } from "@tpluscode/rdf-ns-builders";
1
2
  import { Maybe } from "purify-ts";
2
3
  import { invariant } from "ts-invariant";
3
4
  import { Import } from "../Import.js";
4
5
  import { SnippetDeclarations } from "../SnippetDeclarations.js";
5
6
  import { Property } from "./Property.js";
6
7
  export class IdentifierProperty extends Property {
7
- constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, mintingStrategy, override, ...superParameters }) {
8
+ constructor({ abstract, classDeclarationVisibility, lazyObjectTypeMutable, identifierMintingStrategy, override, ...superParameters }) {
8
9
  super(superParameters);
9
10
  this.equalsFunction = "booleanEquals";
10
11
  this.mutable = false;
11
12
  invariant(this.visibility === "public");
12
13
  this.abstract = abstract;
13
14
  this.classDeclarationVisibility = classDeclarationVisibility;
14
- if (mintingStrategy.isJust()) {
15
- this.mintingStrategy = mintingStrategy.unsafeCoerce();
15
+ if (identifierMintingStrategy.isJust()) {
16
+ this.identifierMintingStrategy = identifierMintingStrategy.unsafeCoerce();
16
17
  }
17
18
  else if (this.type.nodeKinds.has("BlankNode")) {
18
- this.mintingStrategy = "blankNode";
19
+ this.identifierMintingStrategy = "blankNode";
19
20
  }
20
21
  else {
21
- this.mintingStrategy = "none";
22
+ this.identifierMintingStrategy = "none";
22
23
  }
23
24
  this.lazyObjectTypeMutable = lazyObjectTypeMutable;
24
25
  this.override = override;
@@ -28,7 +29,7 @@ export class IdentifierProperty extends Property {
28
29
  return Maybe.empty();
29
30
  }
30
31
  let mintIdentifier;
31
- switch (this.mintingStrategy) {
32
+ switch (this.identifierMintingStrategy) {
32
33
  case "blankNode":
33
34
  mintIdentifier = "dataFactory.blankNode()";
34
35
  break;
@@ -72,7 +73,7 @@ export class IdentifierProperty extends Property {
72
73
  if (!this.classDeclarationVisibility.isJust()) {
73
74
  return Maybe.empty();
74
75
  }
75
- switch (this.mintingStrategy) {
76
+ switch (this.identifierMintingStrategy) {
76
77
  case "none":
77
78
  // Immutable, public identifier property, no getter
78
79
  return Maybe.of({
@@ -95,19 +96,25 @@ export class IdentifierProperty extends Property {
95
96
  if (this.objectType.declarationType === "class" && this.abstract) {
96
97
  return Maybe.empty();
97
98
  }
99
+ const typeNames = new Set(); // Remove duplicates with a set
100
+ for (const conversion of this.type.conversions) {
101
+ if (conversion.sourceTypeName !== "undefined") {
102
+ typeNames.add(conversion.sourceTypeName);
103
+ }
104
+ }
98
105
  return Maybe.of({
99
106
  hasQuestionToken: this.objectType.declarationType === "class" &&
100
- this.mintingStrategy !== "none",
107
+ this.identifierMintingStrategy !== "none",
101
108
  isReadonly: true,
102
109
  name: this.name,
103
- type: this.type.name,
110
+ type: [...typeNames].sort().join(" | "),
104
111
  });
105
112
  }
106
113
  get declarationImports() {
107
114
  const imports = this.type.useImports().concat();
108
115
  if (this.objectType.features.has("hash") &&
109
116
  this.objectType.declarationType === "class") {
110
- switch (this.mintingStrategy) {
117
+ switch (this.identifierMintingStrategy) {
111
118
  case "sha256":
112
119
  imports.push(Import.SHA256);
113
120
  break;
@@ -143,11 +150,27 @@ export class IdentifierProperty extends Property {
143
150
  if (this.abstract) {
144
151
  return [];
145
152
  }
146
- return this.classPropertyDeclaration
147
- .map((classPropertyDeclaration) => [
148
- `this.${classPropertyDeclaration.name} = ${variables.parameter};`,
149
- ])
150
- .orDefault([]);
153
+ if (this.classPropertyDeclaration.isNothing()) {
154
+ return [];
155
+ }
156
+ const classPropertyDeclaration = this.classPropertyDeclaration.unsafeCoerce();
157
+ const typeConversions = this.type.conversions;
158
+ if (typeConversions.length === 1) {
159
+ return [
160
+ `this.${classPropertyDeclaration.name} = ${variables.parameter};`,
161
+ ];
162
+ }
163
+ const statements = [];
164
+ for (const conversion of this.type.conversions) {
165
+ if (conversion.sourceTypeName !== "undefined") {
166
+ statements.push(`if (${conversion.sourceTypeCheckExpression(variables.parameter)}) { this.${classPropertyDeclaration.name} = ${conversion.conversionExpression(variables.parameter)}; }`);
167
+ }
168
+ }
169
+ if (!classPropertyDeclaration.hasQuestionToken) {
170
+ // We shouldn't need this else, since the parameter now has the never type, but have to add it to appease the TypeScript compiler
171
+ statements.push(`{ this.${classPropertyDeclaration.name} =( ${variables.parameter}) as never;\n }`);
172
+ }
173
+ return [statements.join(" else ")];
151
174
  }
152
175
  fromJsonStatements({ variables, }) {
153
176
  return [
@@ -155,21 +178,63 @@ export class IdentifierProperty extends Property {
155
178
  ];
156
179
  }
157
180
  fromRdfStatements({ variables, }) {
181
+ if (this.type.in_.length > 0 && this.type.isNamedNodeKind) {
182
+ // Treat sh:in as a union of the IRIs
183
+ // rdfjs.NamedNode<"http://example.com/1" | "http://example.com/2">
184
+ return [
185
+ `let ${this.name}: ${this.type.name};`,
186
+ `switch (${variables.resource}.identifier.value) { ${this.type.in_.map((iri) => `case "${iri.value}": ${this.name} = ${this.rdfjsTermExpression(iri)}; break;`).join(" ")} default: return purify.Left(new rdfjsResource.Resource.MistypedValueError({ actualValue: ${variables.resource}.identifier, expectedValueType: ${JSON.stringify(this.type.name)}, focusResource: ${variables.resource}, predicate: ${this.rdfjsTermExpression(rdf.subject)} })); }`,
187
+ ];
188
+ }
158
189
  return [`const ${this.name} = ${variables.resource}.identifier`];
159
190
  }
160
- hashStatements() {
161
- return [];
191
+ hashStatements({ variables, }) {
192
+ if (this.abstract) {
193
+ // Identifier will only be hashed by a concrete class.
194
+ return [];
195
+ }
196
+ switch (this.identifierMintingStrategy) {
197
+ case "blankNode":
198
+ case "none":
199
+ case "uuidv4":
200
+ // The identifier minting won't call hash, so we should hash the identifier.
201
+ return [`${variables.hasher}.update(${variables.value}.value);`];
202
+ case "sha256":
203
+ // The identifier minting will call hash, so we can't hash the identifier.
204
+ return [];
205
+ }
162
206
  }
163
207
  interfaceConstructorStatements({ variables, }) {
164
- return [`const ${this.name} = ${variables.parameter}`];
208
+ const typeConversions = this.type.conversions;
209
+ if (typeConversions.length === 1) {
210
+ return [`const ${this.name} = ${variables.parameter};`];
211
+ }
212
+ const statements = [`let ${this.name}: ${this.type.name};`];
213
+ const conversionBranches = [];
214
+ for (const conversion of this.type.conversions) {
215
+ conversionBranches.push(`if (${conversion.sourceTypeCheckExpression(variables.parameter)}) { ${this.name} = ${conversion.conversionExpression(variables.parameter)}; }`);
216
+ }
217
+ // We shouldn't need this else, since the parameter now has the never type, but have to add it to appease the TypeScript compiler
218
+ conversionBranches.push(`{ ${this.name} =( ${variables.parameter}) as never;\n }`);
219
+ statements.push(conversionBranches.join(" else "));
220
+ return statements;
165
221
  }
166
222
  jsonUiSchemaElement({ variables, }) {
167
223
  return Maybe.of(`{ label: "Identifier", scope: \`\${${variables.scopePrefix}}/properties/${this.jsonPropertySignature.name}\`, type: "Control" }`);
168
224
  }
169
225
  jsonZodSchema({ variables, }) {
226
+ let schema;
227
+ if (this.type.in_.length > 0 && this.type.isNamedNodeKind) {
228
+ // Treat sh:in as a union of the IRIs
229
+ // rdfjs.NamedNode<"http://example.com/1" | "http://example.com/2">
230
+ schema = `${variables.zod}.enum(${JSON.stringify(this.type.in_.map((iri) => iri.value))})`;
231
+ }
232
+ else {
233
+ schema = `${variables.zod}.string().min(1)`;
234
+ }
170
235
  return {
171
236
  key: this.jsonPropertySignature.name,
172
- schema: `${variables.zod}.string().min(1)`,
237
+ schema,
173
238
  };
174
239
  }
175
240
  sparqlConstructTemplateTriples() {
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { type VariableStatementStructure } from "ts-morph";
3
+ import type { ObjectType } from "../ObjectType.js";
4
+ export declare function fromRdfTypeVariableDeclaration(this: ObjectType): Maybe<VariableStatementStructure>;
5
+ //# sourceMappingURL=fromRdfTypeVariableStatement.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { StructureKind } from "ts-morph";
3
+ export function fromRdfTypeVariableDeclaration() {
4
+ if (!this.features.has("fromRdf")) {
5
+ return Maybe.empty();
6
+ }
7
+ if (this.extern) {
8
+ return Maybe.empty();
9
+ }
10
+ if (this.fromRdfType.isNothing()) {
11
+ return Maybe.empty();
12
+ }
13
+ return Maybe.of({
14
+ kind: StructureKind.VariableStatement,
15
+ declarations: [
16
+ {
17
+ name: "fromRdfType",
18
+ initializer: this.rdfjsTermExpression(this.fromRdfType.unsafeCoerce()),
19
+ type: "rdfjs.NamedNode<string>",
20
+ },
21
+ ],
22
+ isExported: true,
23
+ });
24
+ }
25
+ //# sourceMappingURL=fromRdfTypeVariableStatement.js.map
@@ -3,6 +3,7 @@ export * from "./createFunctionDeclaration.js";
3
3
  export * from "./equalsFunctionDeclaration.js";
4
4
  export * from "./fromJsonFunctionDeclarations.js";
5
5
  export * from "./fromRdfFunctionDeclarations.js";
6
+ export * from "./fromRdfTypeVariableStatement.js";
6
7
  export * from "./hashFunctionDeclaration.js";
7
8
  export * from "./IdentifierProperty.js";
8
9
  export * from "./interfaceDeclaration.js";
@@ -3,6 +3,7 @@ export * from "./createFunctionDeclaration.js";
3
3
  export * from "./equalsFunctionDeclaration.js";
4
4
  export * from "./fromJsonFunctionDeclarations.js";
5
5
  export * from "./fromRdfFunctionDeclarations.js";
6
+ export * from "./fromRdfTypeVariableStatement.js";
6
7
  export * from "./hashFunctionDeclaration.js";
7
8
  export * from "./IdentifierProperty.js";
8
9
  export * from "./interfaceDeclaration.js";
@@ -28,10 +28,10 @@ export function toRdfFunctionOrMethodDeclaration() {
28
28
  usedIgnoreRdfTypeVariable = !this.parentObjectTypes[0].abstract;
29
29
  }
30
30
  else if (this.identifierType.isNamedNodeKind) {
31
- statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableNamedResource({ identifier: ${this.thisVariable}.${this.identifierProperty.name}, ${variables.mutateGraph} });`);
31
+ statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableNamedResource(${this.thisVariable}.${this.identifierProperty.name}, { ${variables.mutateGraph} });`);
32
32
  }
33
33
  else {
34
- statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableResource({ identifier: ${this.thisVariable}.${this.identifierProperty.name}, ${variables.mutateGraph} });`);
34
+ statements.push(`const ${variables.resource} = ${variables.resourceSet}.mutableResource(${this.thisVariable}.${this.identifierProperty.name}, { ${variables.mutateGraph} });`);
35
35
  }
36
36
  if (this.toRdfTypes.length > 0) {
37
37
  statements.push(`if (!${variables.ignoreRdfType}) { ${this.toRdfTypes.map((toRdfType) => `${variables.resource}.add(${variables.resource}.dataFactory.namedNode("${rdf.type.value}"), ${variables.resource}.dataFactory.namedNode("${toRdfType.value}"));`).join(" ")} }`);
@@ -55,7 +55,7 @@ export function toRdfFunctionOrMethodDeclaration() {
55
55
  }
56
56
  parameters.push({
57
57
  name: `{ ${usedIgnoreRdfTypeVariable ? `${variables.ignoreRdfType}, ` : ""}${variables.mutateGraph}, ${variables.resourceSet} }`,
58
- type: `{ ${variables.ignoreRdfType}?: boolean; ${variables.mutateGraph}: rdfjsResource.MutableResource.MutateGraph, ${variables.resourceSet}: rdfjsResource.MutableResourceSet }`,
58
+ type: `{ ${variables.ignoreRdfType}?: boolean; ${variables.mutateGraph}?: rdfjsResource.MutableResource.MutateGraph, ${variables.resourceSet}: rdfjsResource.MutableResourceSet }`,
59
59
  });
60
60
  return Maybe.of({
61
61
  name: "toRdf",
@@ -1,7 +1,7 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import { NodeShape as ShaclCoreNodeShape } from "@shaclmate/shacl-ast";
3
3
  import { Maybe } from "purify-ts";
4
- import type { MintingStrategy, TsFeature, TsObjectDeclarationType } from "../enums/index.js";
4
+ import type { IdentifierMintingStrategy, TsFeature, TsObjectDeclarationType } from "../enums/index.js";
5
5
  import type { Shape } from "./Shape.js";
6
6
  import type * as generated from "./generated.js";
7
7
  import type { Ontology, PropertyGroup, PropertyShape, ShapesGraph } from "./index.js";
@@ -30,7 +30,7 @@ export declare class NodeShape extends ShaclCoreNodeShape<any, Ontology, Propert
30
30
  get export(): Maybe<boolean>;
31
31
  get extern(): Maybe<boolean>;
32
32
  get fromRdfType(): Maybe<NamedNode>;
33
- get mintingStrategy(): Maybe<MintingStrategy>;
33
+ get mintingStrategy(): Maybe<IdentifierMintingStrategy>;
34
34
  get mutable(): Maybe<boolean>;
35
35
  get nodeKinds(): Set<"BlankNode" | "NamedNode">;
36
36
  get parentNodeShapes(): readonly NodeShape[];
@@ -96,6 +96,7 @@ export declare namespace ShaclCorePropertyShape {
96
96
  uniqueLang: purify.Maybe<boolean>;
97
97
  } & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
98
98
  function fromRdf(parameters: Parameters<typeof ShaclCorePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyShape>;
99
+ const fromRdfType: rdfjs.NamedNode<string>;
99
100
  }
100
101
  export interface ShaclmatePropertyShape extends ShaclCorePropertyShape {
101
102
  readonly extern: purify.Maybe<boolean>;
@@ -120,6 +121,7 @@ export declare namespace ShaclmatePropertyShape {
120
121
  visibility: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_Visibility_Private" | "http://minorg.github.io/shaclmate/ns#_Visibility_Protected" | "http://minorg.github.io/shaclmate/ns#_Visibility_Public">>;
121
122
  } & UnwrapR<ReturnType<typeof ShaclCorePropertyShape.propertiesFromRdf>>>;
122
123
  function fromRdf(parameters: Parameters<typeof ShaclmatePropertyShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmatePropertyShape>;
124
+ const fromRdfType: rdfjs.NamedNode<string>;
123
125
  }
124
126
  export interface OwlOntology {
125
127
  readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
@@ -138,12 +140,13 @@ export declare namespace OwlOntology {
138
140
  type: "OwlOntology" | "ShaclmateOntology";
139
141
  }>;
140
142
  function fromRdf(parameters: Parameters<typeof OwlOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, OwlOntology>;
143
+ const fromRdfType: rdfjs.NamedNode<string>;
141
144
  }
142
145
  export interface ShaclmateOntology extends OwlOntology {
143
146
  readonly identifier: rdfjs.BlankNode | rdfjs.NamedNode;
144
147
  readonly tsDataFactoryVariable: purify.Maybe<string>;
145
- readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
146
- readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
148
+ readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
149
+ readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
147
150
  readonly tsImports: readonly string[];
148
151
  readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
149
152
  readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
@@ -159,8 +162,8 @@ export declare namespace ShaclmateOntology {
159
162
  }): purify.Either<rdfjsResource.Resource.ValueError, {
160
163
  identifier: rdfjs.BlankNode | rdfjs.NamedNode;
161
164
  tsDataFactoryVariable: purify.Maybe<string>;
162
- tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
163
- tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
165
+ tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
166
+ tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
164
167
  tsImports: readonly string[];
165
168
  tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
166
169
  tsObjectIdentifierPropertyName: purify.Maybe<string>;
@@ -168,6 +171,7 @@ export declare namespace ShaclmateOntology {
168
171
  type: "ShaclmateOntology";
169
172
  } & UnwrapR<ReturnType<typeof OwlOntology.propertiesFromRdf>>>;
170
173
  function fromRdf(parameters: Parameters<typeof ShaclmateOntology.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateOntology>;
174
+ const fromRdfType: rdfjs.NamedNode<string>;
171
175
  }
172
176
  export interface ShaclCoreNodeShape extends BaseShaclCoreShape {
173
177
  readonly closed: purify.Maybe<boolean>;
@@ -190,6 +194,7 @@ export declare namespace ShaclCoreNodeShape {
190
194
  type: "ShaclCoreNodeShape" | "ShaclmateNodeShape";
191
195
  } & UnwrapR<ReturnType<typeof BaseShaclCoreShape.propertiesFromRdf>>>;
192
196
  function fromRdf(parameters: Parameters<typeof ShaclCoreNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCoreNodeShape>;
197
+ const fromRdfType: rdfjs.NamedNode<string>;
193
198
  }
194
199
  export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
195
200
  readonly abstract: purify.Maybe<boolean>;
@@ -201,8 +206,8 @@ export interface ShaclmateNodeShape extends ShaclCoreNodeShape {
201
206
  readonly mutable: purify.Maybe<boolean>;
202
207
  readonly name: purify.Maybe<string>;
203
208
  readonly toRdfTypes: readonly rdfjs.NamedNode[];
204
- readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
205
- readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
209
+ readonly tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
210
+ readonly tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
206
211
  readonly tsImports: readonly string[];
207
212
  readonly tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
208
213
  readonly tsObjectIdentifierPropertyName: purify.Maybe<string>;
@@ -225,8 +230,8 @@ export declare namespace ShaclmateNodeShape {
225
230
  mutable: purify.Maybe<boolean>;
226
231
  name: purify.Maybe<string>;
227
232
  toRdfTypes: readonly rdfjs.NamedNode[];
228
- tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
229
- tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
233
+ tsFeatureExcludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
234
+ tsFeatureIncludes: readonly rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">[];
230
235
  tsImports: readonly string[];
231
236
  tsObjectDeclarationType: purify.Maybe<rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Class" | "http://minorg.github.io/shaclmate/ns#_TsObjectDeclarationType_Interface">>;
232
237
  tsObjectIdentifierPropertyName: purify.Maybe<string>;
@@ -234,6 +239,7 @@ export declare namespace ShaclmateNodeShape {
234
239
  type: "ShaclmateNodeShape";
235
240
  } & UnwrapR<ReturnType<typeof ShaclCoreNodeShape.propertiesFromRdf>>>;
236
241
  function fromRdf(parameters: Parameters<typeof ShaclmateNodeShape.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclmateNodeShape>;
242
+ const fromRdfType: rdfjs.NamedNode<string>;
237
243
  }
238
244
  export interface ShaclCorePropertyGroup {
239
245
  readonly comments: readonly rdfjs.Literal[];
@@ -254,10 +260,11 @@ export declare namespace ShaclCorePropertyGroup {
254
260
  type: "ShaclCorePropertyGroup";
255
261
  }>;
256
262
  function fromRdf(parameters: Parameters<typeof ShaclCorePropertyGroup.propertiesFromRdf>[0]): purify.Either<rdfjsResource.Resource.ValueError, ShaclCorePropertyGroup>;
263
+ const fromRdfType: rdfjs.NamedNode<string>;
257
264
  }
258
265
  export type ShaclCoreShape = ShaclCoreNodeShape | ShaclCorePropertyShape;
259
266
  export declare namespace ShaclCoreShape {
260
- function fromRdf(parameters: {
267
+ function fromRdf({ ignoreRdfType, resource, ...context }: {
261
268
  [_index: string]: any;
262
269
  ignoreRdfType?: boolean;
263
270
  resource: rdfjsResource.Resource;
@@ -265,7 +272,7 @@ export declare namespace ShaclCoreShape {
265
272
  }
266
273
  export type ShaclmateShape = ShaclmateNodeShape | ShaclCorePropertyShape;
267
274
  export declare namespace ShaclmateShape {
268
- function fromRdf(parameters: {
275
+ function fromRdf({ ignoreRdfType, resource, ...context }: {
269
276
  [_index: string]: any;
270
277
  ignoreRdfType?: boolean;
271
278
  resource: rdfjsResource.Resource;
@@ -625,6 +625,7 @@ export var ShaclCorePropertyShape;
625
625
  return ShaclCorePropertyShape.propertiesFromRdf(parameters);
626
626
  }
627
627
  ShaclCorePropertyShape.fromRdf = fromRdf;
628
+ ShaclCorePropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
628
629
  })(ShaclCorePropertyShape || (ShaclCorePropertyShape = {}));
629
630
  export var ShaclmatePropertyShape;
630
631
  (function (ShaclmatePropertyShape) {
@@ -718,6 +719,7 @@ export var ShaclmatePropertyShape;
718
719
  return ShaclmatePropertyShape.propertiesFromRdf(parameters);
719
720
  }
720
721
  ShaclmatePropertyShape.fromRdf = fromRdf;
722
+ ShaclmatePropertyShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape");
721
723
  })(ShaclmatePropertyShape || (ShaclmatePropertyShape = {}));
722
724
  export var OwlOntology;
723
725
  (function (OwlOntology) {
@@ -766,6 +768,7 @@ export var OwlOntology;
766
768
  return OwlOntology.propertiesFromRdf(parameters);
767
769
  }
768
770
  OwlOntology.fromRdf = fromRdf;
771
+ OwlOntology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
769
772
  })(OwlOntology || (OwlOntology = {}));
770
773
  export var ShaclmateOntology;
771
774
  (function (ShaclmateOntology) {
@@ -808,6 +811,8 @@ export var ShaclmateOntology;
808
811
  .head()
809
812
  .chain((_value) => _value.toIri().chain((iri) => {
810
813
  switch (iri.value) {
814
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_All":
815
+ return purify.Either.of(iri);
811
816
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
812
817
  return purify.Either.of(iri);
813
818
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
@@ -824,6 +829,8 @@ export var ShaclmateOntology;
824
829
  return purify.Either.of(iri);
825
830
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
826
831
  return purify.Either.of(iri);
832
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_None":
833
+ return purify.Either.of(iri);
827
834
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
828
835
  return purify.Either.of(iri);
829
836
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
@@ -835,7 +842,7 @@ export var ShaclmateOntology;
835
842
  default:
836
843
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
837
844
  actualValue: iri,
838
- expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
845
+ expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
839
846
  focusResource: _resource,
840
847
  predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"),
841
848
  }));
@@ -856,6 +863,8 @@ export var ShaclmateOntology;
856
863
  .head()
857
864
  .chain((_value) => _value.toIri().chain((iri) => {
858
865
  switch (iri.value) {
866
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_All":
867
+ return purify.Either.of(iri);
859
868
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
860
869
  return purify.Either.of(iri);
861
870
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
@@ -864,14 +873,16 @@ export var ShaclmateOntology;
864
873
  return purify.Either.of(iri);
865
874
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
866
875
  return purify.Either.of(iri);
867
- case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
868
- return purify.Either.of(iri);
869
876
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
870
877
  return purify.Either.of(iri);
878
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
879
+ return purify.Either.of(iri);
871
880
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
872
881
  return purify.Either.of(iri);
873
882
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
874
883
  return purify.Either.of(iri);
884
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_None":
885
+ return purify.Either.of(iri);
875
886
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
876
887
  return purify.Either.of(iri);
877
888
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
@@ -883,7 +894,7 @@ export var ShaclmateOntology;
883
894
  default:
884
895
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
885
896
  actualValue: iri,
886
- expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
897
+ expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
887
898
  focusResource: _resource,
888
899
  predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"),
889
900
  }));
@@ -970,6 +981,7 @@ export var ShaclmateOntology;
970
981
  return ShaclmateOntology.propertiesFromRdf(parameters);
971
982
  }
972
983
  ShaclmateOntology.fromRdf = fromRdf;
984
+ ShaclmateOntology.fromRdfType = dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology");
973
985
  })(ShaclmateOntology || (ShaclmateOntology = {}));
974
986
  export var ShaclCoreNodeShape;
975
987
  (function (ShaclCoreNodeShape) {
@@ -1052,6 +1064,7 @@ export var ShaclCoreNodeShape;
1052
1064
  return ShaclCoreNodeShape.propertiesFromRdf(parameters);
1053
1065
  }
1054
1066
  ShaclCoreNodeShape.fromRdf = fromRdf;
1067
+ ShaclCoreNodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1055
1068
  })(ShaclCoreNodeShape || (ShaclCoreNodeShape = {}));
1056
1069
  export var ShaclmateNodeShape;
1057
1070
  (function (ShaclmateNodeShape) {
@@ -1176,6 +1189,8 @@ export var ShaclmateNodeShape;
1176
1189
  .head()
1177
1190
  .chain((_value) => _value.toIri().chain((iri) => {
1178
1191
  switch (iri.value) {
1192
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_All":
1193
+ return purify.Either.of(iri);
1179
1194
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
1180
1195
  return purify.Either.of(iri);
1181
1196
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
@@ -1192,6 +1207,8 @@ export var ShaclmateNodeShape;
1192
1207
  return purify.Either.of(iri);
1193
1208
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
1194
1209
  return purify.Either.of(iri);
1210
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_None":
1211
+ return purify.Either.of(iri);
1195
1212
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
1196
1213
  return purify.Either.of(iri);
1197
1214
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
@@ -1203,7 +1220,7 @@ export var ShaclmateNodeShape;
1203
1220
  default:
1204
1221
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1205
1222
  actualValue: iri,
1206
- expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
1223
+ expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
1207
1224
  focusResource: _resource,
1208
1225
  predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureExclude"),
1209
1226
  }));
@@ -1224,6 +1241,8 @@ export var ShaclmateNodeShape;
1224
1241
  .head()
1225
1242
  .chain((_value) => _value.toIri().chain((iri) => {
1226
1243
  switch (iri.value) {
1244
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_All":
1245
+ return purify.Either.of(iri);
1227
1246
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
1228
1247
  return purify.Either.of(iri);
1229
1248
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
@@ -1232,14 +1251,16 @@ export var ShaclmateNodeShape;
1232
1251
  return purify.Either.of(iri);
1233
1252
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf":
1234
1253
  return purify.Either.of(iri);
1235
- case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
1236
- return purify.Either.of(iri);
1237
1254
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash":
1238
1255
  return purify.Either.of(iri);
1256
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_Json":
1257
+ return purify.Either.of(iri);
1239
1258
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema":
1240
1259
  return purify.Either.of(iri);
1241
1260
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
1242
1261
  return purify.Either.of(iri);
1262
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_None":
1263
+ return purify.Either.of(iri);
1243
1264
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
1244
1265
  return purify.Either.of(iri);
1245
1266
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
@@ -1251,7 +1272,7 @@ export var ShaclmateNodeShape;
1251
1272
  default:
1252
1273
  return purify.Left(new rdfjsResource.Resource.MistypedValueError({
1253
1274
  actualValue: iri,
1254
- expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
1275
+ expectedValueType: 'rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">',
1255
1276
  focusResource: _resource,
1256
1277
  predicate: dataFactory.namedNode("http://minorg.github.io/shaclmate/ns#tsFeatureInclude"),
1257
1278
  }));
@@ -1345,6 +1366,7 @@ export var ShaclmateNodeShape;
1345
1366
  return ShaclmateNodeShape.propertiesFromRdf(parameters);
1346
1367
  }
1347
1368
  ShaclmateNodeShape.fromRdf = fromRdf;
1369
+ ShaclmateNodeShape.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape");
1348
1370
  })(ShaclmateNodeShape || (ShaclmateNodeShape = {}));
1349
1371
  export var ShaclCorePropertyGroup;
1350
1372
  (function (ShaclCorePropertyGroup) {
@@ -1418,18 +1440,25 @@ export var ShaclCorePropertyGroup;
1418
1440
  return ShaclCorePropertyGroup.propertiesFromRdf(parameters);
1419
1441
  }
1420
1442
  ShaclCorePropertyGroup.fromRdf = fromRdf;
1443
+ ShaclCorePropertyGroup.fromRdfType = dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup");
1421
1444
  })(ShaclCorePropertyGroup || (ShaclCorePropertyGroup = {}));
1422
1445
  export var ShaclCoreShape;
1423
1446
  (function (ShaclCoreShape) {
1424
- function fromRdf(parameters) {
1425
- return ShaclCoreNodeShape.fromRdf(parameters).altLazy(() => ShaclCorePropertyShape.fromRdf(parameters));
1447
+ function fromRdf({ ignoreRdfType, resource, ...context }) {
1448
+ return ShaclCoreNodeShape.fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShape.fromRdf({
1449
+ ...context,
1450
+ resource,
1451
+ }));
1426
1452
  }
1427
1453
  ShaclCoreShape.fromRdf = fromRdf;
1428
1454
  })(ShaclCoreShape || (ShaclCoreShape = {}));
1429
1455
  export var ShaclmateShape;
1430
1456
  (function (ShaclmateShape) {
1431
- function fromRdf(parameters) {
1432
- return ShaclmateNodeShape.fromRdf(parameters).altLazy(() => ShaclCorePropertyShape.fromRdf(parameters));
1457
+ function fromRdf({ ignoreRdfType, resource, ...context }) {
1458
+ return ShaclmateNodeShape.fromRdf({ ...context, resource }).altLazy(() => ShaclCorePropertyShape.fromRdf({
1459
+ ...context,
1460
+ resource,
1461
+ }));
1433
1462
  }
1434
1463
  ShaclmateShape.fromRdf = fromRdf;
1435
1464
  })(ShaclmateShape || (ShaclmateShape = {}));
@@ -1,7 +1,7 @@
1
1
  import type * as rdfjs from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { TsFeature } from "../enums/index.js";
4
- type TsFeatureIri = rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">;
4
+ type TsFeatureIri = rdfjs.NamedNode<"http://minorg.github.io/shaclmate/ns#_TsFeature_All" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Create" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_FromRdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Json" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Hash" | "http://minorg.github.io/shaclmate/ns#_TsFeature_None" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf" | "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToJson" | "http://minorg.github.io/shaclmate/ns#_TsFeature_ToRdf">;
5
5
  export declare function tsFeatures(generated: {
6
6
  readonly tsFeatureExcludes: readonly TsFeatureIri[];
7
7
  readonly tsFeatureIncludes: readonly TsFeatureIri[];
@@ -2,6 +2,8 @@ import { Maybe } from "purify-ts";
2
2
  import { TsFeature } from "../enums/index.js";
3
3
  function iriToTsFeatures(iri) {
4
4
  switch (iri.value) {
5
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_All":
6
+ return TsFeature.MEMBERS;
5
7
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Create":
6
8
  return ["create"];
7
9
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Equals":
@@ -18,6 +20,8 @@ function iriToTsFeatures(iri) {
18
20
  return ["jsonSchema"];
19
21
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_JsonUiSchema":
20
22
  return ["jsonUiSchema"];
23
+ case "http://minorg.github.io/shaclmate/ns#_TsFeature_None":
24
+ return [];
21
25
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Sparql":
22
26
  return ["sparql"];
23
27
  case "http://minorg.github.io/shaclmate/ns#_TsFeature_Rdf":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "2.0.15",
3
+ "@shaclmate/shacl-ast": "2.0.16",
4
4
  "@rdfjs/prefix-map": "^0.1.2",
5
5
  "@rdfjs/term-map": "^2.0.2",
6
6
  "@rdfjs/term-set": "^2.0.3",
@@ -20,7 +20,7 @@
20
20
  "typescript-memoize": "^1.1.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@shaclmate/runtime": "2.0.15",
23
+ "@shaclmate/runtime": "2.0.16",
24
24
  "oxigraph": "^0.4.0"
25
25
  },
26
26
  "files": [
@@ -73,5 +73,5 @@
73
73
  },
74
74
  "type": "module",
75
75
  "types": "index.d.ts",
76
- "version": "2.0.15"
76
+ "version": "2.0.16"
77
77
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * TypeScript enum corresponding to shaclmate:mintingStrategy, for simpler manipulation.
3
- */
4
- export type MintingStrategy = "sha256" | "uuidv4";
5
- //# sourceMappingURL=MintingStrategy.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MintingStrategy.js.map