@shaclmate/compiler 4.0.25 → 4.0.27

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.
@@ -11,13 +11,13 @@ import { transformShapeToAstType } from "./transformShapeToAstType.js";
11
11
  export function transformShapeToAstCompoundType(shape, shapeStack) {
12
12
  shapeStack.push(shape);
13
13
  try {
14
- return Eithers.chain4(Either.sequence(shape.and
14
+ return Eithers.chain3(Either.sequence(shape.and
15
15
  .orDefault([])
16
- .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier))), Either.sequence(shape.nodes.map((nodeShapeIdentifier) => this.shapesGraph.nodeShape(nodeShapeIdentifier))), shape.$type === "NodeShape"
16
+ .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier))), shape.$type === "NodeShape"
17
17
  ? nodeShapeTsFeatures.call(this, shape)
18
18
  : Either.of(new Set()), Either.sequence(shape.xone
19
19
  .orDefault([])
20
- .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([andConstraintShapes, nodeConstraintShapes, tsFeatures, xoneConstraintShapes,]) => {
20
+ .map((shapeIdentifier) => this.shapesGraph.shape(shapeIdentifier)))).chain(([andConstraintShapes, tsFeatures, xoneConstraintShapes]) => {
21
21
  let compoundTypeKind;
22
22
  // Distinguish constraints that take arbitrary shapes from those that only take node shapes
23
23
  // With the latter we'll do special transformations.
@@ -26,10 +26,6 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
26
26
  memberShapes = andConstraintShapes;
27
27
  compoundTypeKind = "IntersectionType";
28
28
  }
29
- else if (nodeConstraintShapes.length > 0) {
30
- memberShapes = nodeConstraintShapes;
31
- compoundTypeKind = "IntersectionType";
32
- }
33
29
  else if (xoneConstraintShapes.length > 0) {
34
30
  memberShapes = xoneConstraintShapes;
35
31
  compoundTypeKind = "UnionType";
@@ -3,5 +3,5 @@ import * as ast from "../ast/index.js";
3
3
  import type * as input from "../input/index.js";
4
4
  import type { ShapesGraphToAstTransformer } from "../ShapesGraphToAstTransformer.js";
5
5
  import { ShapeStack } from "./ShapeStack.js";
6
- export declare function transformShapeToAstObjectType(this: ShapesGraphToAstTransformer, shape: input.Shape, shapeStack: ShapeStack): Either<Error, Maybe<ast.ObjectType>>;
6
+ export declare function transformShapeToAstObjectType(this: ShapesGraphToAstTransformer, shape: input.Shape, shapeStack: ShapeStack): Either<Error, Maybe<ast.Type>>;
7
7
  //# sourceMappingURL=transformShapeToAstObjectType.d.ts.map
@@ -43,6 +43,12 @@ function isObjectTypePropertyRequired(property) {
43
43
  export function transformShapeToAstObjectType(shape, shapeStack) {
44
44
  shapeStack.push(shape);
45
45
  try {
46
+ if (shape.node.isJust()) {
47
+ return this.shapesGraph
48
+ .nodeShape(shape.node.unsafeCoerce())
49
+ .chain((nodeShape) => transformShapeToAstType.call(this, nodeShape, shapeStack))
50
+ .map(Maybe.of);
51
+ }
46
52
  if (shape.$type !== "NodeShape") {
47
53
  return Either.of(Maybe.empty());
48
54
  }
@@ -3,6 +3,7 @@ import { graphqlSchemaVariableStatement } from "./graphqlSchemaVariableStatement
3
3
  import { objectSetDeclarations } from "./objectSetDeclarations.js";
4
4
  import { snippets } from "./snippets.js";
5
5
  import { synthesizeUberObjectUnionType } from "./synthesizeUberObjectUnionType.js";
6
+ import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
6
7
  import { TypeFactory } from "./TypeFactory.js";
7
8
  import { code, joinCode } from "./ts-poet-wrapper.js";
8
9
  export class TsGenerator {
@@ -32,13 +33,20 @@ export class TsGenerator {
32
33
  }
33
34
  const namedObjectTypesNameSorted = namedObjectTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
34
35
  const namedObjectUnionTypesNameSorted = namedObjectUnionTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
35
- if (namedObjectTypesToposorted.length > 0) {
36
- const uberObjectUnionType = synthesizeUberObjectUnionType({
37
- logger: this.logger,
38
- namedObjectTypes: namedObjectTypesToposorted.toReversed(), // Reverse topological order so children ane before parents
39
- });
40
- declarations = declarations.concat(uberObjectUnionType.declaration.toList());
41
- namedObjectUnionTypesNameSorted.push(uberObjectUnionType);
36
+ switch (namedObjectTypesNameSorted.length) {
37
+ case 0:
38
+ break;
39
+ case 1:
40
+ declarations.push(code `type ${syntheticNamePrefix}Object = ${namedObjectTypesNameSorted[0].name};`);
41
+ break;
42
+ default: {
43
+ const uberObjectUnionType = synthesizeUberObjectUnionType({
44
+ logger: this.logger,
45
+ namedObjectTypes: namedObjectTypesToposorted.toReversed(), // Reverse topological order so children ane before parents
46
+ });
47
+ declarations = declarations.concat(uberObjectUnionType.declaration.toList());
48
+ namedObjectUnionTypesNameSorted.push(uberObjectUnionType);
49
+ }
42
50
  }
43
51
  declarations.push(...objectSetDeclarations({
44
52
  namedObjectTypes: namedObjectTypesNameSorted,
@@ -1,9 +1,14 @@
1
1
  import { camelCase, trainCase } from "change-case";
2
2
  import plur from "plur";
3
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
3
4
  export function NamedObjectType_objectSetMethodNames() {
4
- const prefixSingular = camelCase(this.name);
5
- const thisNameParts = trainCase(this.name).split("-");
6
- let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`);
5
+ const prefixSingular = camelCase(this.name, {
6
+ prefixCharacters: syntheticNamePrefix,
7
+ });
8
+ const thisNameParts = trainCase(this.name, {
9
+ prefixCharacters: syntheticNamePrefix,
10
+ }).split("-");
11
+ let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
7
12
  if (prefixPlural === prefixSingular) {
8
13
  // Happens with singular-s nouns like "series"
9
14
  prefixPlural = `${prefixPlural}s`;
@@ -6,7 +6,7 @@ export const snippets_compactRecord = conditionalOutput(`${syntheticNamePrefix}c
6
6
  */
7
7
  function ${syntheticNamePrefix}compactRecord<KeyT extends string, ValueT extends {}>(record: Record<KeyT, ValueT | undefined>): Record<KeyT, ValueT> {
8
8
  return \
9
- Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
9
+ globalThis.Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
10
10
  if (propertyValue !== undefined) {
11
11
  definedProperties[propertyName as KeyT] = propertyValue as ValueT;
12
12
  }
@@ -98,13 +98,13 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
98
98
  case "NamedObjectType": {
99
99
  return delegatingMethods.concat(code `\
100
100
  ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
101
- return this.${syntheticNamePrefix}objectsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
101
+ return this.#objectsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
102
102
  }`);
103
103
  }
104
104
  case "NamedObjectUnionType":
105
105
  return delegatingMethods.concat(code `\
106
106
  ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
107
- return this.${syntheticNamePrefix}objectUnionsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
107
+ return this.#objectUnionsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
108
108
  ${joinCode(namedObjectType.members.map((member) => runtimeObjectType(namedObjectType.filterFunction, member.type)), { on: ", " })}
109
109
  ], query);
110
110
  }`);
@@ -116,7 +116,7 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
116
116
  ...(namedObjectTypes.length > 0
117
117
  ? [
118
118
  code `\
119
- protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
119
+ #objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
120
120
  const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
121
121
 
122
122
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
@@ -208,7 +208,7 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
208
208
  ...(namedObjectUnionTypes.length > 0
209
209
  ? [
210
210
  code `\
211
- protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
211
+ #objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
212
212
  const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
213
213
 
214
214
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
@@ -14,6 +14,7 @@ export function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectU
14
14
  query: code `query?: ${syntheticNamePrefix}SparqlObjectSet.Query<ObjectFilterT, ObjectIdentifierT>`,
15
15
  selectObjectTypeType: code `namedObjectType: { ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT> }`,
16
16
  };
17
+ const sparqlClientType = code `{ queryBindings: (query: string) => Promise<readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[]>; queryQuads: (query: string) => Promise<readonly ${imports.Quad}[]>; }`;
17
18
  const typeParameters = {
18
19
  ObjectT: code `ObjectT extends { readonly $identifier: () => ObjectIdentifierT }`,
19
20
  ObjectFilterT: code `ObjectFilterT`,
@@ -21,13 +22,15 @@ export function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectU
21
22
  };
22
23
  return code `\
23
24
  export class ${syntheticNamePrefix}SparqlObjectSet implements ${syntheticNamePrefix}ObjectSet {
24
- protected readonly ${syntheticNamePrefix}countVariable = ${imports.dataFactory}.variable!("count");;
25
- protected readonly graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
26
- protected readonly ${syntheticNamePrefix}objectVariable = ${imports.dataFactory}.variable!("object");
27
- protected readonly ${syntheticNamePrefix}sparqlGenerator = new ${imports.sparqljs}.Generator();
28
-
29
- constructor(protected readonly ${syntheticNamePrefix}sparqlClient: { queryBindings: (query: string) => Promise<readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[]>; queryQuads: (query: string) => Promise<readonly ${imports.Quad}[]>; }, options?: { graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}> }) {
30
- this.graph = options?.graph;
25
+ readonly #countVariable = ${imports.dataFactory}.variable!("count");;
26
+ readonly #graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
27
+ readonly #objectVariable = ${imports.dataFactory}.variable!("object");
28
+ readonly #sparqlClient: ${sparqlClientType};
29
+ readonly #sparqlGenerator = new ${imports.sparqljs}.Generator();
30
+
31
+ constructor(sparqlClient: ${sparqlClientType}, options?: { graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}> }) {
32
+ this.#graph = options?.graph;
33
+ this.#sparqlClient = sparqlClient;
31
34
  }
32
35
 
33
36
  ${joinCode([...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
@@ -48,20 +51,20 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
48
51
  }`,
49
52
  code `\
50
53
  async ${methodSignatures.objectCount.name}(${methodSignatures.objectCount.parameters}): ${methodSignatures.objectCount.returnType} {
51
- return this.${syntheticNamePrefix}objectCount<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
54
+ return this.#objectCount<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
52
55
  }`,
53
56
  code `\
54
57
  async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdentifiers.parameters}): ${methodSignatures.objectIdentifiers.returnType} {
55
- return this.${syntheticNamePrefix}objectIdentifiers<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
58
+ return this.#objectIdentifiers<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
56
59
  }`,
57
60
  code `\
58
61
  async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}): ${methodSignatures.objects.returnType} {
59
- return this.${syntheticNamePrefix}objects<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
62
+ return this.#objects<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
60
63
  }`,
61
64
  ];
62
65
  }), { on: "\n\n" })}
63
66
 
64
- protected ${syntheticNamePrefix}mapBindingsToCount(bindings: readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[], variable: string): ${imports.Either}<Error, number> {
67
+ #mapBindingsToCount(bindings: readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[], variable: string): ${imports.Either}<Error, number> {
65
68
  if (bindings.length === 0) {
66
69
  return ${imports.Left}(new Error("empty result rows"));
67
70
  }
@@ -82,7 +85,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
82
85
  return ${imports.Right}(parsedCount);
83
86
  }
84
87
 
85
- protected ${syntheticNamePrefix}mapBindingsToIdentifiers(bindings: readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[], variable: string): readonly ${imports.NamedNode}[] {
88
+ #mapBindingsToIdentifiers(bindings: readonly Record<string, ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>[], variable: string): readonly ${imports.NamedNode}[] {
86
89
  const identifiers: ${imports.NamedNode}[] = [];
87
90
  for (const bindings_ of bindings) {
88
91
  const identifier = bindings_[variable];
@@ -96,7 +99,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
96
99
  return identifiers;
97
100
  }
98
101
 
99
- protected async ${syntheticNamePrefix}objectIdentifiers<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectIdentifierT[]>> {
102
+ async #objectIdentifiers<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectIdentifierT[]>> {
100
103
  if (query?.identifiers) {
101
104
  return ${imports.Right}(query.identifiers);
102
105
  }
@@ -111,41 +114,41 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
111
114
  offset = 0;
112
115
  }
113
116
 
114
- const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
117
+ const wherePatterns = this.#wherePatterns(namedObjectType, query);
115
118
  if (wherePatterns.length === 0) {
116
119
  return ${imports.Left}(new Error("no SPARQL WHERE patterns for identifiers"));
117
120
  }
118
121
 
119
122
  const selectQueryString = \
120
- this.${syntheticNamePrefix}sparqlGenerator.stringify({
123
+ this.#sparqlGenerator.stringify({
121
124
  distinct: true,
122
125
  limit: limit < Number.MAX_SAFE_INTEGER ? limit : undefined,
123
126
  offset,
124
- order: query?.order ? query.order(this.${syntheticNamePrefix}objectVariable).concat() : [{ expression: this.${syntheticNamePrefix}objectVariable }],
127
+ order: query?.order ? query.order(this.#objectVariable).concat() : [{ expression: this.#objectVariable }],
125
128
  prefixes: {},
126
129
  queryType: "SELECT",
127
130
  type: "query",
128
- variables: [this.${syntheticNamePrefix}objectVariable],
131
+ variables: [this.#objectVariable],
129
132
  where: wherePatterns.concat()
130
133
  });
131
134
 
132
135
  return ${imports.EitherAsync}(async () =>
133
- this.${syntheticNamePrefix}mapBindingsToIdentifiers(
134
- await this.${syntheticNamePrefix}sparqlClient.queryBindings(selectQueryString),
135
- this.${syntheticNamePrefix}objectVariable.value,
136
+ this.#mapBindingsToIdentifiers(
137
+ await this.#sparqlClient.queryBindings(selectQueryString),
138
+ this.#objectVariable.value,
136
139
  ) as readonly ObjectIdentifierT[],
137
140
  );
138
141
  }
139
142
 
140
- protected async ${syntheticNamePrefix}objects<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.constructObjectType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectT[]>> {
143
+ async #objects<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.constructObjectType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectT[]>> {
141
144
  return ${imports.EitherAsync}(async ({ liftEither }) => {
142
- const identifiers = await liftEither(await this.${syntheticNamePrefix}objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(namedObjectType, query));
145
+ const identifiers = await liftEither(await this.#objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(namedObjectType, query));
143
146
  if (identifiers.length === 0) {
144
147
  return [];
145
148
  }
146
149
 
147
150
  const constructQueryString = namedObjectType.${syntheticNamePrefix}sparqlConstructQueryString({
148
- subject: this.${syntheticNamePrefix}objectVariable,
151
+ subject: this.#objectVariable,
149
152
  where: [{
150
153
  type: "values" as const,
151
154
  values: identifiers.map((identifier) => {
@@ -156,7 +159,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
156
159
  }]
157
160
  });
158
161
 
159
- const quads = await this.${syntheticNamePrefix}sparqlClient.queryQuads(constructQueryString);
162
+ const quads = await this.#sparqlClient.queryQuads(constructQueryString);
160
163
 
161
164
  const dataset = ${imports.datasetFactory}.dataset(quads.concat());
162
165
  const objects: ObjectT[] = [];
@@ -167,14 +170,14 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
167
170
  });
168
171
  }
169
172
 
170
- protected async ${syntheticNamePrefix}objectCount<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, number>> {
171
- const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
173
+ async #objectCount<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, number>> {
174
+ const wherePatterns = this.#wherePatterns(namedObjectType, query);
172
175
  if (wherePatterns.length === 0) {
173
176
  return ${imports.Left}(new Error("no SPARQL WHERE patterns for count"));
174
177
  }
175
178
 
176
179
  const selectQueryString = \
177
- this.${syntheticNamePrefix}sparqlGenerator.stringify({
180
+ this.#sparqlGenerator.stringify({
178
181
  prefixes: {},
179
182
  queryType: "SELECT",
180
183
  type: "query",
@@ -183,10 +186,10 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
183
186
  expression: {
184
187
  aggregation: "COUNT",
185
188
  distinct: true,
186
- expression: this.${syntheticNamePrefix}objectVariable,
189
+ expression: this.#objectVariable,
187
190
  type: "aggregate",
188
191
  },
189
- variable: this.${syntheticNamePrefix}countVariable,
192
+ variable: this.#countVariable,
190
193
  },
191
194
  ],
192
195
  where: wherePatterns.concat()
@@ -194,27 +197,27 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
194
197
 
195
198
  return ${imports.EitherAsync}(async ({ liftEither }) =>
196
199
  liftEither(
197
- this.${syntheticNamePrefix}mapBindingsToCount(
198
- await this.${syntheticNamePrefix}sparqlClient.queryBindings(selectQueryString),
199
- this.${syntheticNamePrefix}countVariable.value,
200
+ this.#mapBindingsToCount(
201
+ await this.#sparqlClient.queryBindings(selectQueryString),
202
+ this.#countVariable.value,
200
203
  ),
201
204
  ),
202
205
  );
203
206
  }
204
207
 
205
- protected ${syntheticNamePrefix}wherePatterns<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): readonly ${imports.sparqljs}.Pattern[] {
208
+ #wherePatterns<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): readonly ${imports.sparqljs}.Pattern[] {
206
209
  // Patterns should be most to least specific.
207
210
  let patterns: ${imports.sparqljs}.Pattern[] = [];
208
211
 
209
212
  if (query?.where) {
210
- patterns = patterns.concat(query.where(this.${syntheticNamePrefix}objectVariable));
213
+ patterns = patterns.concat(query.where(this.#objectVariable));
211
214
  }
212
215
 
213
- patterns = patterns.concat(namedObjectType.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: query?.filter, focusIdentifier: this.${syntheticNamePrefix}objectVariable, ignoreRdfType: false, preferredLanguages: query?.preferredLanguages, variablePrefix: this.${syntheticNamePrefix}objectVariable.value }));
216
+ patterns = patterns.concat(namedObjectType.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: query?.filter, focusIdentifier: this.#objectVariable, ignoreRdfType: false, preferredLanguages: query?.preferredLanguages, variablePrefix: this.#objectVariable.value }));
214
217
 
215
218
  patterns = ${snippets.normalizeSparqlWherePatterns}(patterns).concat();
216
219
 
217
- const graph = query?.graph ?? this.graph;
220
+ const graph = query?.graph ?? this.#graph;
218
221
  if (graph) {
219
222
  switch (graph.termType) {
220
223
  case "DefaultGraph":
@@ -155,8 +155,8 @@ export interface PropertyShape {
155
155
  readonly minLength: Maybe<number>;
156
156
  readonly mutable: Maybe<boolean>;
157
157
  readonly name: Maybe<string>;
158
+ readonly node: Maybe<BlankNode | NamedNode>;
158
159
  readonly nodeKind: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
159
- readonly nodes: readonly (BlankNode | NamedNode)[];
160
160
  readonly not: readonly (BlankNode | NamedNode)[];
161
161
  readonly or: Maybe<readonly (BlankNode | NamedNode)[]>;
162
162
  readonly order: Maybe<number>;
@@ -195,8 +195,8 @@ export declare namespace PropertyShape {
195
195
  readonly minLength?: Maybe<number> | number;
196
196
  readonly mutable?: Maybe<boolean> | boolean;
197
197
  readonly name?: Maybe<string> | string;
198
+ readonly node?: Maybe<BlankNode | NamedNode> | (BlankNode | NamedNode) | string;
198
199
  readonly nodeKind?: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">> | NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal"> | "http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal";
199
- readonly nodes?: readonly (BlankNode | NamedNode)[] | readonly string[];
200
200
  readonly not?: readonly (BlankNode | NamedNode)[] | readonly string[];
201
201
  readonly or?: Maybe<readonly (BlankNode | NamedNode)[]> | readonly (BlankNode | NamedNode)[] | readonly string[];
202
202
  readonly order?: Maybe<number> | number;
@@ -240,8 +240,8 @@ export declare namespace PropertyShape {
240
240
  readonly minLength?: $MaybeFilter<$NumericFilter<number>>;
241
241
  readonly mutable?: $MaybeFilter<$BooleanFilter>;
242
242
  readonly name?: $MaybeFilter<$StringFilter>;
243
+ readonly node?: $MaybeFilter<$IdentifierFilter>;
243
244
  readonly nodeKind?: $MaybeFilter<$IriFilter>;
244
- readonly nodes?: $CollectionFilter<$IdentifierFilter>;
245
245
  readonly not?: $CollectionFilter<$IdentifierFilter>;
246
246
  readonly or?: $MaybeFilter<$CollectionFilter<$IdentifierFilter>>;
247
247
  readonly order?: $MaybeFilter<$NumericFilter<number>>;
@@ -284,8 +284,8 @@ export declare namespace PropertyShape {
284
284
  minLength: Maybe<number>;
285
285
  mutable: Maybe<boolean>;
286
286
  name: Maybe<string>;
287
+ node: Maybe<BlankNode | NamedNode>;
287
288
  nodeKind: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
288
- nodes: readonly (BlankNode | NamedNode)[];
289
289
  not: readonly (BlankNode | NamedNode)[];
290
290
  or: Maybe<readonly (BlankNode | NamedNode)[]>;
291
291
  order: Maybe<number>;
@@ -571,26 +571,26 @@ export declare namespace PropertyShape {
571
571
  };
572
572
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#name">;
573
573
  };
574
- readonly nodeKind: {
574
+ readonly node: {
575
575
  readonly kind: "Shacl";
576
576
  readonly type: () => {
577
577
  kind: "Maybe";
578
578
  item: () => {
579
- kind: "Iri";
580
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
579
+ kind: "Identifier";
581
580
  };
582
581
  };
583
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
582
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
584
583
  };
585
- readonly nodes: {
584
+ readonly nodeKind: {
586
585
  readonly kind: "Shacl";
587
586
  readonly type: () => {
588
- kind: "Set";
587
+ kind: "Maybe";
589
588
  item: () => {
590
- kind: "Identifier";
589
+ kind: "Iri";
590
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
591
591
  };
592
592
  };
593
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
593
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
594
594
  };
595
595
  readonly not: {
596
596
  readonly kind: "Shacl";
@@ -912,8 +912,8 @@ export interface NodeShape {
912
912
  readonly minInclusive: Maybe<Literal>;
913
913
  readonly minLength: Maybe<number>;
914
914
  readonly mutable: Maybe<boolean>;
915
+ readonly node: Maybe<BlankNode | NamedNode>;
915
916
  readonly nodeKind: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
916
- readonly nodes: readonly (BlankNode | NamedNode)[];
917
917
  readonly not: readonly (BlankNode | NamedNode)[];
918
918
  readonly or: Maybe<readonly (BlankNode | NamedNode)[]>;
919
919
  readonly patterns: readonly string[];
@@ -956,8 +956,8 @@ export declare namespace NodeShape {
956
956
  readonly minInclusive?: Maybe<Literal> | bigint | boolean | Date | number | string | Literal;
957
957
  readonly minLength?: Maybe<number> | number;
958
958
  readonly mutable?: Maybe<boolean> | boolean;
959
+ readonly node?: Maybe<BlankNode | NamedNode> | (BlankNode | NamedNode) | string;
959
960
  readonly nodeKind?: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">> | NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal"> | "http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal";
960
- readonly nodes?: readonly (BlankNode | NamedNode)[] | readonly string[];
961
961
  readonly not?: readonly (BlankNode | NamedNode)[] | readonly string[];
962
962
  readonly or?: Maybe<readonly (BlankNode | NamedNode)[]> | readonly (BlankNode | NamedNode)[] | readonly string[];
963
963
  readonly patterns?: readonly string[];
@@ -1005,8 +1005,8 @@ export declare namespace NodeShape {
1005
1005
  readonly minInclusive?: $MaybeFilter<$LiteralFilter>;
1006
1006
  readonly minLength?: $MaybeFilter<$NumericFilter<number>>;
1007
1007
  readonly mutable?: $MaybeFilter<$BooleanFilter>;
1008
+ readonly node?: $MaybeFilter<$IdentifierFilter>;
1008
1009
  readonly nodeKind?: $MaybeFilter<$IriFilter>;
1009
- readonly nodes?: $CollectionFilter<$IdentifierFilter>;
1010
1010
  readonly not?: $CollectionFilter<$IdentifierFilter>;
1011
1011
  readonly or?: $MaybeFilter<$CollectionFilter<$IdentifierFilter>>;
1012
1012
  readonly patterns?: $CollectionFilter<$StringFilter>;
@@ -1053,8 +1053,8 @@ export declare namespace NodeShape {
1053
1053
  minInclusive: Maybe<Literal>;
1054
1054
  minLength: Maybe<number>;
1055
1055
  mutable: Maybe<boolean>;
1056
+ node: Maybe<BlankNode | NamedNode>;
1056
1057
  nodeKind: Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
1057
- nodes: readonly (BlankNode | NamedNode)[];
1058
1058
  not: readonly (BlankNode | NamedNode)[];
1059
1059
  or: Maybe<readonly (BlankNode | NamedNode)[]>;
1060
1060
  patterns: readonly string[];
@@ -1346,26 +1346,26 @@ export declare namespace NodeShape {
1346
1346
  };
1347
1347
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://purl.org/shaclmate/ontology#mutable">;
1348
1348
  };
1349
- readonly nodeKind: {
1349
+ readonly node: {
1350
1350
  readonly kind: "Shacl";
1351
1351
  readonly type: () => {
1352
1352
  kind: "Maybe";
1353
1353
  item: () => {
1354
- kind: "Iri";
1355
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
1354
+ kind: "Identifier";
1356
1355
  };
1357
1356
  };
1358
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
1357
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
1359
1358
  };
1360
- readonly nodes: {
1359
+ readonly nodeKind: {
1361
1360
  readonly kind: "Shacl";
1362
1361
  readonly type: () => {
1363
- kind: "Set";
1362
+ kind: "Maybe";
1364
1363
  item: () => {
1365
- kind: "Identifier";
1364
+ kind: "Iri";
1365
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
1366
1366
  };
1367
1367
  };
1368
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
1368
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
1369
1369
  };
1370
1370
  readonly not: {
1371
1371
  readonly kind: "Shacl";
@@ -1811,26 +1811,26 @@ export declare namespace Shape {
1811
1811
  };
1812
1812
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://purl.org/shaclmate/ontology#mutable">;
1813
1813
  };
1814
- readonly nodeKind: {
1814
+ readonly node: {
1815
1815
  readonly kind: "Shacl";
1816
1816
  readonly type: () => {
1817
1817
  kind: "Maybe";
1818
1818
  item: () => {
1819
- kind: "Iri";
1820
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
1819
+ kind: "Identifier";
1821
1820
  };
1822
1821
  };
1823
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
1822
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
1824
1823
  };
1825
- readonly nodes: {
1824
+ readonly nodeKind: {
1826
1825
  readonly kind: "Shacl";
1827
1826
  readonly type: () => {
1828
- kind: "Set";
1827
+ kind: "Maybe";
1829
1828
  item: () => {
1830
- kind: "Identifier";
1829
+ kind: "Iri";
1830
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
1831
1831
  };
1832
1832
  };
1833
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
1833
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
1834
1834
  };
1835
1835
  readonly not: {
1836
1836
  readonly kind: "Shacl";
@@ -2250,26 +2250,26 @@ export declare namespace Shape {
2250
2250
  };
2251
2251
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#name">;
2252
2252
  };
2253
- readonly nodeKind: {
2253
+ readonly node: {
2254
2254
  readonly kind: "Shacl";
2255
2255
  readonly type: () => {
2256
2256
  kind: "Maybe";
2257
2257
  item: () => {
2258
- kind: "Iri";
2259
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2258
+ kind: "Identifier";
2260
2259
  };
2261
2260
  };
2262
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2261
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2263
2262
  };
2264
- readonly nodes: {
2263
+ readonly nodeKind: {
2265
2264
  readonly kind: "Shacl";
2266
2265
  readonly type: () => {
2267
- kind: "Set";
2266
+ kind: "Maybe";
2268
2267
  item: () => {
2269
- kind: "Identifier";
2268
+ kind: "Iri";
2269
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2270
2270
  };
2271
2271
  };
2272
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2272
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2273
2273
  };
2274
2274
  readonly not: {
2275
2275
  readonly kind: "Shacl";
@@ -2576,26 +2576,26 @@ export declare namespace Shape {
2576
2576
  };
2577
2577
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://purl.org/shaclmate/ontology#mutable">;
2578
2578
  };
2579
- readonly nodeKind: {
2579
+ readonly node: {
2580
2580
  readonly kind: "Shacl";
2581
2581
  readonly type: () => {
2582
2582
  kind: "Maybe";
2583
2583
  item: () => {
2584
- kind: "Iri";
2585
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2584
+ kind: "Identifier";
2586
2585
  };
2587
2586
  };
2588
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2587
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2589
2588
  };
2590
- readonly nodes: {
2589
+ readonly nodeKind: {
2591
2590
  readonly kind: "Shacl";
2592
2591
  readonly type: () => {
2593
- kind: "Set";
2592
+ kind: "Maybe";
2594
2593
  item: () => {
2595
- kind: "Identifier";
2594
+ kind: "Iri";
2595
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2596
2596
  };
2597
2597
  };
2598
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2598
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2599
2599
  };
2600
2600
  readonly not: {
2601
2601
  readonly kind: "Shacl";
@@ -2967,26 +2967,26 @@ export declare namespace $Object {
2967
2967
  };
2968
2968
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://purl.org/shaclmate/ontology#mutable">;
2969
2969
  };
2970
- readonly nodeKind: {
2970
+ readonly node: {
2971
2971
  readonly kind: "Shacl";
2972
2972
  readonly type: () => {
2973
2973
  kind: "Maybe";
2974
2974
  item: () => {
2975
- kind: "Iri";
2976
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2975
+ kind: "Identifier";
2977
2976
  };
2978
2977
  };
2979
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2978
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2980
2979
  };
2981
- readonly nodes: {
2980
+ readonly nodeKind: {
2982
2981
  readonly kind: "Shacl";
2983
2982
  readonly type: () => {
2984
- kind: "Set";
2983
+ kind: "Maybe";
2985
2984
  item: () => {
2986
- kind: "Identifier";
2985
+ kind: "Iri";
2986
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
2987
2987
  };
2988
2988
  };
2989
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
2989
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
2990
2990
  };
2991
2991
  readonly not: {
2992
2992
  readonly kind: "Shacl";
@@ -3518,26 +3518,26 @@ export declare namespace $Object {
3518
3518
  };
3519
3519
  readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#name">;
3520
3520
  };
3521
- readonly nodeKind: {
3521
+ readonly node: {
3522
3522
  readonly kind: "Shacl";
3523
3523
  readonly type: () => {
3524
3524
  kind: "Maybe";
3525
3525
  item: () => {
3526
- kind: "Iri";
3527
- in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
3526
+ kind: "Identifier";
3528
3527
  };
3529
3528
  };
3530
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
3529
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
3531
3530
  };
3532
- readonly nodes: {
3531
+ readonly nodeKind: {
3533
3532
  readonly kind: "Shacl";
3534
3533
  readonly type: () => {
3535
- kind: "Set";
3534
+ kind: "Maybe";
3536
3535
  item: () => {
3537
- kind: "Identifier";
3536
+ kind: "Iri";
3537
+ in: (import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNode"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRI"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral"> | import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#Literal">)[];
3538
3538
  };
3539
3539
  };
3540
- readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#node">;
3540
+ readonly path: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#nodeKind">;
3541
3541
  };
3542
3542
  readonly not: {
3543
3543
  readonly kind: "Shacl";
@@ -3698,12 +3698,12 @@ export interface $ObjectSet {
3698
3698
  shapeCount(query?: Pick<$ObjectSet.Query<Shape.$Filter, Shape.$Identifier>, "filter">): Promise<Either<Error, number>>;
3699
3699
  shapeIdentifiers(query?: $ObjectSet.Query<Shape.$Filter, Shape.$Identifier>): Promise<Either<Error, readonly Shape.$Identifier[]>>;
3700
3700
  shapes(query?: $ObjectSet.Query<Shape.$Filter, Shape.$Identifier>): Promise<Either<Error, readonly Shape[]>>;
3701
- object(identifier: $Object.$Identifier, options?: {
3701
+ $object(identifier: $Object.$Identifier, options?: {
3702
3702
  preferredLanguages?: readonly string[];
3703
3703
  }): Promise<Either<Error, $Object>>;
3704
- objectCount(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Promise<Either<Error, number>>;
3705
- objectIdentifiers(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object.$Identifier[]>>;
3706
- objects(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object[]>>;
3704
+ $objectCount(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Promise<Either<Error, number>>;
3705
+ $objectIdentifiers(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object.$Identifier[]>>;
3706
+ $objects(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object[]>>;
3707
3707
  }
3708
3708
  export declare namespace $ObjectSet {
3709
3709
  interface Query<ObjectFilterT, ObjectIdentifierT extends BlankNode | NamedNode> {
@@ -3783,32 +3783,18 @@ export declare class $RdfjsDatasetObjectSet implements $ObjectSet {
3783
3783
  shapeIdentifiersSync(query?: $ObjectSet.Query<Shape.$Filter, Shape.$Identifier>): Either<Error, readonly Shape.$Identifier[]>;
3784
3784
  shapes(query?: $ObjectSet.Query<Shape.$Filter, Shape.$Identifier>): Promise<Either<Error, readonly Shape[]>>;
3785
3785
  shapesSync(query?: $ObjectSet.Query<Shape.$Filter, Shape.$Identifier>): Either<Error, readonly Shape[]>;
3786
- object(identifier: $Object.$Identifier, options?: {
3786
+ $object(identifier: $Object.$Identifier, options?: {
3787
3787
  preferredLanguages?: readonly string[];
3788
3788
  }): Promise<Either<Error, $Object>>;
3789
- objectSync(identifier: $Object.$Identifier, options?: {
3789
+ $objectSync(identifier: $Object.$Identifier, options?: {
3790
3790
  preferredLanguages?: readonly string[];
3791
3791
  }): Either<Error, $Object>;
3792
- objectCount(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Promise<Either<Error, number>>;
3793
- objectCountSync(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Either<Error, number>;
3794
- objectIdentifiers(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object.$Identifier[]>>;
3795
- objectIdentifiersSync(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Either<Error, readonly $Object.$Identifier[]>;
3796
- objects(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object[]>>;
3797
- objectsSync(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Either<Error, readonly $Object[]>;
3798
- protected $objectsSync<ObjectT extends {
3799
- readonly $identifier: () => ObjectIdentifierT;
3800
- }, ObjectFilterT, ObjectIdentifierT extends BlankNode | NamedNode>(namedObjectType: {
3801
- $filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
3802
- $fromRdfResource: $FromRdfResourceFunction<ObjectT>;
3803
- $fromRdfTypes: readonly NamedNode[];
3804
- }, query?: $ObjectSet.Query<ObjectFilterT, ObjectIdentifierT>): Either<Error, readonly ObjectT[]>;
3805
- protected $objectUnionsSync<ObjectT extends {
3806
- readonly $identifier: () => ObjectIdentifierT;
3807
- }, ObjectFilterT, ObjectIdentifierT extends BlankNode | NamedNode>(namedObjectTypes: readonly {
3808
- $filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
3809
- $fromRdfResource: $FromRdfResourceFunction<ObjectT>;
3810
- $fromRdfTypes: readonly NamedNode[];
3811
- }[], query?: $ObjectSet.Query<ObjectFilterT, ObjectIdentifierT>): Either<Error, readonly ObjectT[]>;
3792
+ $objectCount(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Promise<Either<Error, number>>;
3793
+ $objectCountSync(query?: Pick<$ObjectSet.Query<$Object.$Filter, $Object.$Identifier>, "filter">): Either<Error, number>;
3794
+ $objectIdentifiers(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object.$Identifier[]>>;
3795
+ $objectIdentifiersSync(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Either<Error, readonly $Object.$Identifier[]>;
3796
+ $objects(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Promise<Either<Error, readonly $Object[]>>;
3797
+ $objectsSync(query?: $ObjectSet.Query<$Object.$Filter, $Object.$Identifier>): Either<Error, readonly $Object[]>;
3812
3798
  }
3813
3799
  export {};
3814
3800
  //# sourceMappingURL=generated.d.ts.map
@@ -8,7 +8,7 @@ import { Either, Left, Maybe, Right } from "purify-ts";
8
8
  * Remove undefined values from a record.
9
9
  */
10
10
  function $compactRecord(record) {
11
- return Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
11
+ return globalThis.Object.entries(record).reduce((definedProperties, [propertyName, propertyValue]) => {
12
12
  if (propertyValue !== undefined) {
13
13
  definedProperties[propertyName] = propertyValue;
14
14
  }
@@ -715,6 +715,22 @@ export var PropertyShape;
715
715
  else {
716
716
  name = parameters.name;
717
717
  }
718
+ let node;
719
+ if (Maybe.isMaybe(parameters.node)) {
720
+ node = parameters.node;
721
+ }
722
+ else if (typeof parameters.node === "object") {
723
+ node = Maybe.of(parameters.node);
724
+ }
725
+ else if (typeof parameters.node === "string") {
726
+ node = Maybe.of(dataFactory.namedNode(parameters.node));
727
+ }
728
+ else if (parameters.node === undefined) {
729
+ node = Maybe.empty();
730
+ }
731
+ else {
732
+ node = parameters.node;
733
+ }
718
734
  let nodeKind;
719
735
  if (Maybe.isMaybe(parameters.nodeKind)) {
720
736
  nodeKind = parameters.nodeKind;
@@ -731,19 +747,6 @@ export var PropertyShape;
731
747
  else {
732
748
  nodeKind = parameters.nodeKind;
733
749
  }
734
- let nodes;
735
- if (parameters.nodes === undefined) {
736
- nodes = [];
737
- }
738
- else if ($isReadonlyObjectArray(parameters.nodes)) {
739
- nodes = parameters.nodes;
740
- }
741
- else if ($isReadonlyStringArray(parameters.nodes)) {
742
- nodes = parameters.nodes.map((item) => dataFactory.namedNode(item));
743
- }
744
- else {
745
- nodes = parameters.nodes;
746
- }
747
750
  let not;
748
751
  if (parameters.not === undefined) {
749
752
  not = [];
@@ -883,8 +886,8 @@ export var PropertyShape;
883
886
  minLength,
884
887
  mutable,
885
888
  name,
889
+ node,
886
890
  nodeKind,
887
- nodes,
888
891
  not,
889
892
  or,
890
893
  order,
@@ -1007,12 +1010,12 @@ export var PropertyShape;
1007
1010
  !$filterMaybe($filterString)(filter.name, value.name)) {
1008
1011
  return false;
1009
1012
  }
1010
- if (filter.nodeKind !== undefined &&
1011
- !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
1013
+ if (filter.node !== undefined &&
1014
+ !$filterMaybe($filterIdentifier)(filter.node, value.node)) {
1012
1015
  return false;
1013
1016
  }
1014
- if (filter.nodes !== undefined &&
1015
- !$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
1017
+ if (filter.nodeKind !== undefined &&
1018
+ !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
1016
1019
  return false;
1017
1020
  }
1018
1021
  if (filter.not !== undefined &&
@@ -1577,6 +1580,26 @@ export var PropertyShape;
1577
1580
  value: Maybe.empty(),
1578
1581
  })),
1579
1582
  }).chain((name) => $shaclPropertyFromRdf({
1583
+ graph: _$options.graph,
1584
+ resource: $resource,
1585
+ propertySchema: PropertyShape.$schema
1586
+ .properties
1587
+ .node,
1588
+ typeFromRdf: (resourceValues) => resourceValues
1589
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
1590
+ .map((values) => values.length >
1591
+ 0
1592
+ ? values.map((value) => Maybe.of(value))
1593
+ : Resource.Values.fromValue({
1594
+ focusResource: $resource,
1595
+ propertyPath: PropertyShape
1596
+ .$schema
1597
+ .properties
1598
+ .node
1599
+ .path,
1600
+ value: Maybe.empty(),
1601
+ })),
1602
+ }).chain((node) => $shaclPropertyFromRdf({
1580
1603
  graph: _$options.graph,
1581
1604
  resource: $resource,
1582
1605
  propertySchema: PropertyShape.$schema
@@ -1604,24 +1627,6 @@ export var PropertyShape;
1604
1627
  value: Maybe.empty(),
1605
1628
  })),
1606
1629
  }).chain((nodeKind) => $shaclPropertyFromRdf({
1607
- graph: _$options.graph,
1608
- resource: $resource,
1609
- propertySchema: PropertyShape.$schema
1610
- .properties
1611
- .nodes,
1612
- typeFromRdf: (resourceValues) => resourceValues
1613
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
1614
- .map((values) => values.toArray())
1615
- .map((valuesArray) => Resource.Values.fromValue({
1616
- focusResource: $resource,
1617
- propertyPath: PropertyShape
1618
- .$schema
1619
- .properties
1620
- .nodes
1621
- .path,
1622
- value: valuesArray,
1623
- })),
1624
- }).chain((nodes) => $shaclPropertyFromRdf({
1625
1630
  graph: _$options.graph,
1626
1631
  resource: $resource,
1627
1632
  propertySchema: PropertyShape.$schema
@@ -1850,8 +1855,8 @@ export var PropertyShape;
1850
1855
  minLength,
1851
1856
  mutable,
1852
1857
  name,
1858
+ node,
1853
1859
  nodeKind,
1854
- nodes,
1855
1860
  not,
1856
1861
  or,
1857
1862
  order,
@@ -2086,6 +2091,14 @@ export var PropertyShape;
2086
2091
  }),
2087
2092
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
2088
2093
  },
2094
+ node: {
2095
+ kind: "Shacl",
2096
+ type: () => ({
2097
+ kind: "Maybe",
2098
+ item: () => ({ kind: "Identifier" }),
2099
+ }),
2100
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
2101
+ },
2089
2102
  nodeKind: {
2090
2103
  kind: "Shacl",
2091
2104
  type: () => ({
@@ -2104,14 +2117,6 @@ export var PropertyShape;
2104
2117
  }),
2105
2118
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
2106
2119
  },
2107
- nodes: {
2108
- kind: "Shacl",
2109
- type: () => ({
2110
- kind: "Set",
2111
- item: () => ({ kind: "Identifier" }),
2112
- }),
2113
- path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
2114
- },
2115
2120
  not: {
2116
2121
  kind: "Shacl",
2117
2122
  type: () => ({
@@ -2323,8 +2328,8 @@ export var PropertyShape;
2323
2328
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.name
2324
2329
  .toList()
2325
2330
  .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2331
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.node.toList(), options?.graph);
2326
2332
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _propertyShape.nodeKind.toList(), options?.graph);
2327
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.nodes.flatMap((item) => [item]), options?.graph);
2328
2333
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _propertyShape.not.flatMap((item) => [item]), options?.graph);
2329
2334
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _propertyShape.or.toList().flatMap((value) => [
2330
2335
  value.length > 0
@@ -3468,6 +3473,22 @@ export var NodeShape;
3468
3473
  else {
3469
3474
  mutable = parameters?.mutable;
3470
3475
  }
3476
+ let node;
3477
+ if (Maybe.isMaybe(parameters?.node)) {
3478
+ node = parameters?.node;
3479
+ }
3480
+ else if (typeof parameters?.node === "object") {
3481
+ node = Maybe.of(parameters?.node);
3482
+ }
3483
+ else if (typeof parameters?.node === "string") {
3484
+ node = Maybe.of(dataFactory.namedNode(parameters?.node));
3485
+ }
3486
+ else if (parameters?.node === undefined) {
3487
+ node = Maybe.empty();
3488
+ }
3489
+ else {
3490
+ node = parameters?.node;
3491
+ }
3471
3492
  let nodeKind;
3472
3493
  if (Maybe.isMaybe(parameters?.nodeKind)) {
3473
3494
  nodeKind = parameters?.nodeKind;
@@ -3484,19 +3505,6 @@ export var NodeShape;
3484
3505
  else {
3485
3506
  nodeKind = parameters?.nodeKind;
3486
3507
  }
3487
- let nodes;
3488
- if (parameters?.nodes === undefined) {
3489
- nodes = [];
3490
- }
3491
- else if ($isReadonlyObjectArray(parameters?.nodes)) {
3492
- nodes = parameters?.nodes;
3493
- }
3494
- else if ($isReadonlyStringArray(parameters?.nodes)) {
3495
- nodes = parameters?.nodes.map((item) => dataFactory.namedNode(item));
3496
- }
3497
- else {
3498
- nodes = parameters?.nodes;
3499
- }
3500
3508
  let not;
3501
3509
  if (parameters?.not === undefined) {
3502
3510
  not = [];
@@ -3697,8 +3705,8 @@ export var NodeShape;
3697
3705
  minInclusive,
3698
3706
  minLength,
3699
3707
  mutable,
3708
+ node,
3700
3709
  nodeKind,
3701
- nodes,
3702
3710
  not,
3703
3711
  or,
3704
3712
  patterns,
@@ -3825,12 +3833,12 @@ export var NodeShape;
3825
3833
  !$filterMaybe($filterBoolean)(filter.mutable, value.mutable)) {
3826
3834
  return false;
3827
3835
  }
3828
- if (filter.nodeKind !== undefined &&
3829
- !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
3836
+ if (filter.node !== undefined &&
3837
+ !$filterMaybe($filterIdentifier)(filter.node, value.node)) {
3830
3838
  return false;
3831
3839
  }
3832
- if (filter.nodes !== undefined &&
3833
- !$filterArray($filterIdentifier)(filter.nodes, value.nodes)) {
3840
+ if (filter.nodeKind !== undefined &&
3841
+ !$filterMaybe($filterIri)(filter.nodeKind, value.nodeKind)) {
3834
3842
  return false;
3835
3843
  }
3836
3844
  if (filter.not !== undefined &&
@@ -4406,6 +4414,26 @@ export var NodeShape;
4406
4414
  value: Maybe.empty(),
4407
4415
  })),
4408
4416
  }).chain((mutable) => $shaclPropertyFromRdf({
4417
+ graph: _$options.graph,
4418
+ resource: $resource,
4419
+ propertySchema: NodeShape.$schema
4420
+ .properties
4421
+ .node,
4422
+ typeFromRdf: (resourceValues) => resourceValues
4423
+ .chain((values) => values.chainMap((value) => value.toIdentifier()))
4424
+ .map((values) => values.length >
4425
+ 0
4426
+ ? values.map((value) => Maybe.of(value))
4427
+ : Resource.Values.fromValue({
4428
+ focusResource: $resource,
4429
+ propertyPath: PropertyShape
4430
+ .$schema
4431
+ .properties
4432
+ .node
4433
+ .path,
4434
+ value: Maybe.empty(),
4435
+ })),
4436
+ }).chain((node) => $shaclPropertyFromRdf({
4409
4437
  graph: _$options.graph,
4410
4438
  resource: $resource,
4411
4439
  propertySchema: NodeShape.$schema
@@ -4433,24 +4461,6 @@ export var NodeShape;
4433
4461
  value: Maybe.empty(),
4434
4462
  })),
4435
4463
  }).chain((nodeKind) => $shaclPropertyFromRdf({
4436
- graph: _$options.graph,
4437
- resource: $resource,
4438
- propertySchema: NodeShape.$schema
4439
- .properties
4440
- .nodes,
4441
- typeFromRdf: (resourceValues) => resourceValues
4442
- .chain((values) => values.chainMap((value) => value.toIdentifier()))
4443
- .map((values) => values.toArray())
4444
- .map((valuesArray) => Resource.Values.fromValue({
4445
- focusResource: $resource,
4446
- propertyPath: PropertyShape
4447
- .$schema
4448
- .properties
4449
- .nodes
4450
- .path,
4451
- value: valuesArray,
4452
- })),
4453
- }).chain((nodes) => $shaclPropertyFromRdf({
4454
4464
  graph: _$options.graph,
4455
4465
  resource: $resource,
4456
4466
  propertySchema: NodeShape.$schema
@@ -4769,8 +4779,8 @@ export var NodeShape;
4769
4779
  minInclusive,
4770
4780
  minLength,
4771
4781
  mutable,
4782
+ node,
4772
4783
  nodeKind,
4773
- nodes,
4774
4784
  not,
4775
4785
  or,
4776
4786
  patterns,
@@ -5011,6 +5021,14 @@ export var NodeShape;
5011
5021
  }),
5012
5022
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
5013
5023
  },
5024
+ node: {
5025
+ kind: "Shacl",
5026
+ type: () => ({
5027
+ kind: "Maybe",
5028
+ item: () => ({ kind: "Identifier" }),
5029
+ }),
5030
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
5031
+ },
5014
5032
  nodeKind: {
5015
5033
  kind: "Shacl",
5016
5034
  type: () => ({
@@ -5029,14 +5047,6 @@ export var NodeShape;
5029
5047
  }),
5030
5048
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
5031
5049
  },
5032
- nodes: {
5033
- kind: "Shacl",
5034
- type: () => ({
5035
- kind: "Set",
5036
- item: () => ({ kind: "Identifier" }),
5037
- }),
5038
- path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
5039
- },
5040
5050
  not: {
5041
5051
  kind: "Shacl",
5042
5052
  type: () => ({
@@ -5334,8 +5344,8 @@ export var NodeShape;
5334
5344
  .flatMap((value) => [
5335
5345
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5336
5346
  ]), options?.graph);
5347
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _nodeShape.node.toList(), options?.graph);
5337
5348
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _nodeShape.nodeKind.toList(), options?.graph);
5338
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _nodeShape.nodes.flatMap((item) => [item]), options?.graph);
5339
5349
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _nodeShape.not.flatMap((item) => [item]), options?.graph);
5340
5350
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#or"), _nodeShape.or.toList().flatMap((value) => [
5341
5351
  value.length > 0
@@ -5645,6 +5655,14 @@ export var Shape;
5645
5655
  }),
5646
5656
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#mutable"),
5647
5657
  },
5658
+ node: {
5659
+ kind: "Shacl",
5660
+ type: () => ({
5661
+ kind: "Maybe",
5662
+ item: () => ({ kind: "Identifier" }),
5663
+ }),
5664
+ path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
5665
+ },
5648
5666
  nodeKind: {
5649
5667
  kind: "Shacl",
5650
5668
  type: () => ({
@@ -5663,14 +5681,6 @@ export var Shape;
5663
5681
  }),
5664
5682
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"),
5665
5683
  },
5666
- nodes: {
5667
- kind: "Shacl",
5668
- type: () => ({
5669
- kind: "Set",
5670
- item: () => ({ kind: "Identifier" }),
5671
- }),
5672
- path: dataFactory.namedNode("http://www.w3.org/ns/shacl#node"),
5673
- },
5674
5684
  not: {
5675
5685
  kind: "Shacl",
5676
5686
  type: () => ({
@@ -5997,7 +6007,7 @@ export class $RdfjsDatasetObjectSet {
5997
6007
  return this.nodeShapesSync(query);
5998
6008
  }
5999
6009
  nodeShapesSync(query) {
6000
- return this.$objectsSync({
6010
+ return this.#objectsSync({
6001
6011
  $filter: NodeShape.$filter,
6002
6012
  $fromRdfResource: NodeShape.$fromRdfResource,
6003
6013
  $fromRdfTypes: [NodeShape.$fromRdfType],
@@ -6028,7 +6038,7 @@ export class $RdfjsDatasetObjectSet {
6028
6038
  return this.ontologiesSync(query);
6029
6039
  }
6030
6040
  ontologiesSync(query) {
6031
- return this.$objectsSync({
6041
+ return this.#objectsSync({
6032
6042
  $filter: Ontology.$filter,
6033
6043
  $fromRdfResource: Ontology.$fromRdfResource,
6034
6044
  $fromRdfTypes: [Ontology.$fromRdfType],
@@ -6059,7 +6069,7 @@ export class $RdfjsDatasetObjectSet {
6059
6069
  return this.propertyGroupsSync(query);
6060
6070
  }
6061
6071
  propertyGroupsSync(query) {
6062
- return this.$objectsSync({
6072
+ return this.#objectsSync({
6063
6073
  $filter: PropertyGroup.$filter,
6064
6074
  $fromRdfResource: PropertyGroup.$fromRdfResource,
6065
6075
  $fromRdfTypes: [PropertyGroup.$fromRdfType],
@@ -6090,7 +6100,7 @@ export class $RdfjsDatasetObjectSet {
6090
6100
  return this.propertyShapesSync(query);
6091
6101
  }
6092
6102
  propertyShapesSync(query) {
6093
- return this.$objectsSync({
6103
+ return this.#objectsSync({
6094
6104
  $filter: PropertyShape.$filter,
6095
6105
  $fromRdfResource: PropertyShape.$fromRdfResource,
6096
6106
  $fromRdfTypes: [PropertyShape.$fromRdfType],
@@ -6121,7 +6131,7 @@ export class $RdfjsDatasetObjectSet {
6121
6131
  return this.shapesSync(query);
6122
6132
  }
6123
6133
  shapesSync(query) {
6124
- return this.$objectUnionsSync([
6134
+ return this.#objectUnionsSync([
6125
6135
  {
6126
6136
  $filter: Shape.$filter,
6127
6137
  $fromRdfResource: NodeShape.$fromRdfResource,
@@ -6134,32 +6144,32 @@ export class $RdfjsDatasetObjectSet {
6134
6144
  },
6135
6145
  ], query);
6136
6146
  }
6137
- async object(identifier, options) {
6138
- return this.objectSync(identifier, options);
6147
+ async $object(identifier, options) {
6148
+ return this.$objectSync(identifier, options);
6139
6149
  }
6140
- objectSync(identifier, options) {
6141
- return this.objectsSync({
6150
+ $objectSync(identifier, options) {
6151
+ return this.$objectsSync({
6142
6152
  identifiers: [identifier],
6143
6153
  preferredLanguages: options?.preferredLanguages,
6144
6154
  }).map((objects) => objects[0]);
6145
6155
  }
6146
- async objectCount(query) {
6147
- return this.objectCountSync(query);
6156
+ async $objectCount(query) {
6157
+ return this.$objectCountSync(query);
6148
6158
  }
6149
- objectCountSync(query) {
6150
- return this.objectsSync(query).map((objects) => objects.length);
6159
+ $objectCountSync(query) {
6160
+ return this.$objectsSync(query).map((objects) => objects.length);
6151
6161
  }
6152
- async objectIdentifiers(query) {
6153
- return this.objectIdentifiersSync(query);
6162
+ async $objectIdentifiers(query) {
6163
+ return this.$objectIdentifiersSync(query);
6154
6164
  }
6155
- objectIdentifiersSync(query) {
6156
- return this.objectsSync(query).map((objects) => objects.map((object) => object.$identifier()));
6165
+ $objectIdentifiersSync(query) {
6166
+ return this.$objectsSync(query).map((objects) => objects.map((object) => object.$identifier()));
6157
6167
  }
6158
- async objects(query) {
6159
- return this.objectsSync(query);
6168
+ async $objects(query) {
6169
+ return this.$objectsSync(query);
6160
6170
  }
6161
- objectsSync(query) {
6162
- return this.$objectUnionsSync([
6171
+ $objectsSync(query) {
6172
+ return this.#objectUnionsSync([
6163
6173
  {
6164
6174
  $filter: $Object.$filter,
6165
6175
  $fromRdfResource: NodeShape.$fromRdfResource,
@@ -6182,7 +6192,7 @@ export class $RdfjsDatasetObjectSet {
6182
6192
  },
6183
6193
  ], query);
6184
6194
  }
6185
- $objectsSync(namedObjectType, query) {
6195
+ #objectsSync(namedObjectType, query) {
6186
6196
  const graph = query?.graph ?? this.$graph;
6187
6197
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
6188
6198
  if (limit <= 0) {
@@ -6275,7 +6285,7 @@ export class $RdfjsDatasetObjectSet {
6275
6285
  }
6276
6286
  return Right(objects);
6277
6287
  }
6278
- $objectUnionsSync(namedObjectTypes, query) {
6288
+ #objectUnionsSync(namedObjectTypes, query) {
6279
6289
  const graph = query?.graph ?? this.$graph;
6280
6290
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
6281
6291
  if (limit <= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.25",
3
+ "@shaclmate/shacl-ast": "4.0.27",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
@@ -68,5 +68,5 @@
68
68
  },
69
69
  "type": "module",
70
70
  "types": "./dist/index.d.ts",
71
- "version": "4.0.25"
71
+ "version": "4.0.27"
72
72
  }