@shaclmate/compiler 4.0.21 → 4.0.22

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.
@@ -20,7 +20,7 @@ export function NamedObjectType_toRdfResourceFunctionOrMethodDeclaration() {
20
20
  }
21
21
  parameters.push(code `options?: Parameters<${snippets.ToRdfResourceFunction}<${this.name}>>[1]`);
22
22
  const statements = [
23
- code `const ${variables.resourceSet} = options?.${variables.resourceSet} ?? new ${imports.ResourceSet}(${imports.datasetFactory}.dataset(), { dataFactory: ${imports.dataFactory} });`,
23
+ code `const ${variables.resourceSet} = options?.${variables.resourceSet} ?? new ${imports.ResourceSet}({ dataFactory: ${imports.dataFactory}, dataset: ${imports.datasetFactory}.dataset() });`,
24
24
  ];
25
25
  if (this.parentObjectTypes.length > 0) {
26
26
  const superToRdfOptions = code `{ ${variables.ignoreRdfType}: true, ${variables.graph}: options?.${variables.graph}, ${variables.resourceSet} }`;
@@ -37,7 +37,7 @@ export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticN
37
37
  }
38
38
 
39
39
  protected ${syntheticNamePrefix}resourceSet(): ${imports.ResourceSet} {
40
- return new ${imports.ResourceSet}(this.${syntheticNamePrefix}dataset(), { dataFactory: ${imports.dataFactory} });
40
+ return new ${imports.ResourceSet}({ dataFactory: ${imports.dataFactory}, dataset: this.${syntheticNamePrefix}dataset() });
41
41
  }
42
42
 
43
43
  ${joinCode([
@@ -161,7 +161,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
161
161
  const dataset = ${imports.datasetFactory}.dataset(quads.concat());
162
162
  const objects: ObjectT[] = [];
163
163
  for (const identifier of identifiers) {
164
- objects.push(await liftEither(namedObjectType.${syntheticNamePrefix}fromRdfResource(new ${imports.Resource}(dataset, identifier as ${imports.NamedNode}), { objectSet: this, preferredLanguages: query?.preferredLanguages })));
164
+ objects.push(await liftEither(namedObjectType.${syntheticNamePrefix}fromRdfResource(new ${imports.Resource}({ dataFactory: ${imports.dataFactory}, dataset: dataset, identifier: identifier as ${imports.NamedNode} }), { objectSet: this, preferredLanguages: query?.preferredLanguages })));
165
165
  }
166
166
  return objects;
167
167
  });
@@ -80,13 +80,13 @@ export type $ToRdfResourceFunction<T> = (value: T, options?: {
80
80
  ignoreRdfType?: boolean;
81
81
  resourceSet?: ResourceSet;
82
82
  }) => Resource;
83
- export type $ToRdfResourceValuesFunction<T> = (value: T, options: {
83
+ export type $ToRdfResourceValuesFunction<ValueT, ReturnT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> = (value: ValueT, options: {
84
84
  graph?: Exclude<Quad_Graph, Variable>;
85
85
  ignoreRdfType?: boolean;
86
86
  propertyPath: $PropertyPath;
87
87
  resource: Resource;
88
88
  resourceSet: ResourceSet;
89
- }) => (bigint | boolean | number | string | BlankNode | Literal | NamedNode)[];
89
+ }) => ReturnT[];
90
90
  export interface PropertyShape {
91
91
  readonly $identifier: PropertyShape.$Identifier;
92
92
  readonly $type: "PropertyShape";
@@ -2695,7 +2695,13 @@ export declare namespace Shape {
2695
2695
  };
2696
2696
  };
2697
2697
  const $toRdfResource: $ToRdfResourceFunction<Shape>;
2698
- const $toRdfResourceValues: $ToRdfResourceValuesFunction<Shape>;
2698
+ const $toRdfResourceValues: (value: Shape, _options: {
2699
+ graph?: Exclude<Quad_Graph, Variable>;
2700
+ ignoreRdfType?: boolean;
2701
+ propertyPath: $PropertyPath;
2702
+ resource: Resource;
2703
+ resourceSet: ResourceSet;
2704
+ }) => (BlankNode | NamedNode)[];
2699
2705
  function isShape(object: $Object): object is Shape;
2700
2706
  }
2701
2707
  export type $Object = NodeShape | Ontology | PropertyGroup | PropertyShape;
@@ -3733,7 +3739,13 @@ export declare namespace $Object {
3733
3739
  };
3734
3740
  };
3735
3741
  const $toRdfResource: $ToRdfResourceFunction<$Object>;
3736
- const $toRdfResourceValues: $ToRdfResourceValuesFunction<$Object>;
3742
+ const $toRdfResourceValues: (value: $Object, _options: {
3743
+ graph?: Exclude<Quad_Graph, Variable>;
3744
+ ignoreRdfType?: boolean;
3745
+ propertyPath: $PropertyPath;
3746
+ resource: Resource;
3747
+ resourceSet: ResourceSet;
3748
+ }) => (BlankNode | NamedNode)[];
3737
3749
  }
3738
3750
  export interface $ObjectSet {
3739
3751
  nodeShape(identifier: NodeShape.$Identifier, options?: {
@@ -2166,7 +2166,10 @@ export var PropertyShape;
2166
2166
  };
2167
2167
  function $toRdfResource(_propertyShape, options) {
2168
2168
  const resourceSet = options?.resourceSet ??
2169
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2169
+ new ResourceSet({
2170
+ dataFactory: dataFactory,
2171
+ dataset: datasetFactory.dataset(),
2172
+ });
2170
2173
  const resource = resourceSet.resource(_propertyShape.$identifier);
2171
2174
  if (!options?.ignoreRdfType) {
2172
2175
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"), options?.graph);
@@ -2546,7 +2549,10 @@ export var PropertyGroup;
2546
2549
  };
2547
2550
  function $toRdfResource(_propertyGroup, options) {
2548
2551
  const resourceSet = options?.resourceSet ??
2549
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2552
+ new ResourceSet({
2553
+ dataFactory: dataFactory,
2554
+ dataset: datasetFactory.dataset(),
2555
+ });
2550
2556
  const resource = resourceSet.resource(_propertyGroup.$identifier);
2551
2557
  if (!options?.ignoreRdfType) {
2552
2558
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
@@ -2974,7 +2980,10 @@ export var Ontology;
2974
2980
  };
2975
2981
  function $toRdfResource(_ontology, options) {
2976
2982
  const resourceSet = options?.resourceSet ??
2977
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
2983
+ new ResourceSet({
2984
+ dataFactory: dataFactory,
2985
+ dataset: datasetFactory.dataset(),
2986
+ });
2978
2987
  const resource = resourceSet.resource(_ontology.$identifier);
2979
2988
  if (!options?.ignoreRdfType) {
2980
2989
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
@@ -5315,7 +5324,10 @@ export var NodeShape;
5315
5324
  };
5316
5325
  function $toRdfResource(_nodeShape, options) {
5317
5326
  const resourceSet = options?.resourceSet ??
5318
- new ResourceSet(datasetFactory.dataset(), { dataFactory: dataFactory });
5327
+ new ResourceSet({
5328
+ dataFactory: dataFactory,
5329
+ dataset: datasetFactory.dataset(),
5330
+ });
5319
5331
  const resource = resourceSet.resource(_nodeShape.$identifier);
5320
5332
  if (!options?.ignoreRdfType) {
5321
5333
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
@@ -6069,7 +6081,10 @@ export class $RdfjsDatasetObjectSet {
6069
6081
  return this.#dataset();
6070
6082
  }
6071
6083
  $resourceSet() {
6072
- return new ResourceSet(this.$dataset(), { dataFactory: dataFactory });
6084
+ return new ResourceSet({
6085
+ dataFactory: dataFactory,
6086
+ dataset: this.$dataset(),
6087
+ });
6073
6088
  }
6074
6089
  async nodeShape(identifier, options) {
6075
6090
  return this.nodeShapeSync(identifier, options);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.21",
3
+ "@shaclmate/shacl-ast": "4.0.22",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
7
7
  "@rdfjs/term-set": "~2.0.3",
8
8
  "@rdfjs/types": "~2.0.1",
9
- "@rdfx/data-factory": "0.0.11",
10
- "@rdfx/literal": "0.0.11",
11
- "@rdfx/resource": "0.0.11",
12
- "@rdfx/string": "0.0.11",
9
+ "@rdfx/data-factory": "0.0.12",
10
+ "@rdfx/literal": "0.0.12",
11
+ "@rdfx/resource": "0.0.12",
12
+ "@rdfx/string": "0.0.12",
13
13
  "@sindresorhus/base62": "~0.1.0",
14
14
  "@tpluscode/rdf-ns-builders": "~4.3.0",
15
15
  "@types/rdfjs__dataset": "~2.0.7",
@@ -70,5 +70,5 @@
70
70
  },
71
71
  "type": "module",
72
72
  "types": "./dist/index.d.ts",
73
- "version": "4.0.21"
73
+ "version": "4.0.22"
74
74
  }