ldkit 0.6.3 → 0.6.4

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.
@@ -1,5 +1,6 @@
1
1
  import { fromRdf } from "./rdf.js";
2
- import { ldkit, rdf } from "./namespaces/mod.js";
2
+ import ldkit from "./namespaces/ldkit.js";
3
+ import rdf from "./namespaces/rdf.js";
3
4
  class Decoder {
4
5
  constructor(graph, schema, context) {
5
6
  Object.defineProperty(this, "graph", {
@@ -1,5 +1,6 @@
1
1
  import { DataFactory, toRdf } from "./rdf.js";
2
- import { rdf, xsd } from "./namespaces/mod.js";
2
+ import xsd from "./namespaces/xsd.js";
3
+ import rdf from "./namespaces/rdf.js";
3
4
  export const encode = (node, schema, context, variableInitCounter = 0) => {
4
5
  return Encoder.encode(node, schema, context, variableInitCounter);
5
6
  };
@@ -1,7 +1,6 @@
1
1
  export { fromRdf, toRdf } from "rdf-literal";
2
2
  import { DataFactory } from "rdf-data-factory";
3
3
  export { DataFactory };
4
- import { BindingsFactory as ComunicaBindingsFactory } from "@comunica/bindings-factory";
5
4
  export const quadsToGraph = (quads) => {
6
5
  const graph = new Map();
7
6
  for (const quad of quads) {
@@ -39,10 +38,89 @@ export class TermFactory {
39
38
  return this.dataFactory.literal(jsonTerm.value);
40
39
  }
41
40
  }
42
- export class BindingsFactory extends ComunicaBindingsFactory {
43
- constructor(dataFactory = new DataFactory(), termFactory = new TermFactory()) {
44
- super(dataFactory);
45
- Object.defineProperty(this, "localDataFactory", {
41
+ export class ReadOnlyBindings {
42
+ constructor(bindings, dataFactory = new DataFactory()) {
43
+ Object.defineProperty(this, "type", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: "bindings"
48
+ });
49
+ Object.defineProperty(this, "dataFactory", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: void 0
54
+ });
55
+ Object.defineProperty(this, "entries", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
61
+ Object.defineProperty(this, "variables", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: void 0
66
+ });
67
+ this.entries = bindings;
68
+ this.dataFactory = dataFactory;
69
+ this.variables = new Map();
70
+ for (const variable of bindings.keys()) {
71
+ this.variables.set(variable.value, variable);
72
+ }
73
+ }
74
+ has(key) {
75
+ const stringKey = typeof key === "string" ? key : key.value;
76
+ const variableKey = this.variables.get(stringKey);
77
+ return this.entries.has(variableKey);
78
+ }
79
+ get(key) {
80
+ const stringKey = typeof key === "string" ? key : key.value;
81
+ const variableKey = this.variables.get(stringKey);
82
+ return this.entries.get(variableKey);
83
+ }
84
+ set(_key, _value) {
85
+ throw new Error("Method not implemented.");
86
+ }
87
+ delete(_key) {
88
+ throw new Error("Method not implemented.");
89
+ }
90
+ keys() {
91
+ return this.entries.keys();
92
+ }
93
+ values() {
94
+ return this.entries.values();
95
+ }
96
+ forEach(fn) {
97
+ return this.entries.forEach(fn);
98
+ }
99
+ get size() {
100
+ return this.entries.size;
101
+ }
102
+ [Symbol.iterator]() {
103
+ return this.entries.entries();
104
+ }
105
+ equals(_other) {
106
+ throw new Error("Method not implemented.");
107
+ }
108
+ filter(_fn) {
109
+ throw new Error("Method not implemented.");
110
+ }
111
+ map(_fn) {
112
+ throw new Error("Method not implemented.");
113
+ }
114
+ merge(_other) {
115
+ throw new Error("Method not implemented.");
116
+ }
117
+ mergeWith(_merger, _other) {
118
+ throw new Error("Method not implemented.");
119
+ }
120
+ }
121
+ export class BindingsFactory {
122
+ constructor(dataFactory = new DataFactory(), termFactory = new TermFactory(dataFactory)) {
123
+ Object.defineProperty(this, "dataFactory", {
46
124
  enumerable: true,
47
125
  configurable: true,
48
126
  writable: true,
@@ -54,21 +132,21 @@ export class BindingsFactory extends ComunicaBindingsFactory {
54
132
  writable: true,
55
133
  value: void 0
56
134
  });
57
- this.localDataFactory = dataFactory;
135
+ this.dataFactory = dataFactory;
58
136
  this.termFactory = termFactory;
59
137
  }
60
138
  fromJson(jsonBindings) {
61
139
  const bindingsEntries = Object.entries(jsonBindings).map(([varName, jsonTerm]) => {
62
140
  return [
63
- this.localDataFactory.variable(varName),
141
+ this.dataFactory.variable(varName),
64
142
  this.termFactory.fromJson(jsonTerm),
65
143
  ];
66
144
  });
67
- return this.bindings(bindingsEntries);
145
+ return new ReadOnlyBindings(new Map(bindingsEntries), this.dataFactory);
68
146
  }
69
147
  }
70
148
  export class QuadFactory {
71
- constructor(dataFactory = new DataFactory(), termFactory = new TermFactory()) {
149
+ constructor(dataFactory = new DataFactory(), termFactory = new TermFactory(dataFactory)) {
72
150
  Object.defineProperty(this, "dataFactory", {
73
151
  enumerable: true,
74
152
  configurable: true,
@@ -1,7 +1,8 @@
1
1
  import { getSchemaProperties } from "../schema/mod.js";
2
2
  import { $, CONSTRUCT, DELETE, INSERT, SELECT } from "../sparql.js";
3
3
  import { DataFactory } from "../rdf.js";
4
- import { ldkit, rdf } from "../namespaces/mod.js";
4
+ import ldkit from "../namespaces/ldkit.js";
5
+ import rdf from "../namespaces/rdf.js";
5
6
  import { encode } from "../encoder.js";
6
7
  import { QueryHelper } from "./query_helper.js";
7
8
  export class QueryBuilder {
@@ -1,4 +1,5 @@
1
- import { rdf, xsd } from "../namespaces/mod.js";
1
+ import xsd from "../namespaces/xsd.js";
2
+ import rdf from "../namespaces/rdf.js";
2
3
  const SupportedDataTypesPrototype = {
3
4
  [xsd.dateTime]: new Date(),
4
5
  [xsd.date]: new Date(),
@@ -1,4 +1,4 @@
1
- import { xsd } from "../namespaces/mod.js";
1
+ import xsd from "../namespaces/xsd.js";
2
2
  export const expandSchema = (schemaPrototype) => {
3
3
  const expandArray = (stringOrStrings) => {
4
4
  return Array.isArray(stringOrStrings) ? stringOrStrings : [stringOrStrings];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "types": "./types/mod.d.ts",
5
5
  "name": "ldkit",
6
- "version": "0.6.3",
6
+ "version": "0.6.4",
7
7
  "description": "LDkit, a Linked Data query toolkit for TypeScript developers",
8
8
  "homepage": "https://ldkit.io",
9
9
  "author": "Karel Klima <karelklima@gmail.com> (https://karelklima.com)",
@@ -44,7 +44,6 @@
44
44
  }
45
45
  },
46
46
  "dependencies": {
47
- "@comunica/bindings-factory": "2.2.0",
48
47
  "@comunica/types": "2.4.0",
49
48
  "@tpluscode/rdf-string": "0.2.26",
50
49
  "@tpluscode/sparql-builder": "0.3.23",
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.decode = void 0;
4
7
  const rdf_js_1 = require("./rdf.js");
5
- const mod_js_1 = require("./namespaces/mod.js");
8
+ const ldkit_js_1 = __importDefault(require("./namespaces/ldkit.js"));
9
+ const rdf_js_2 = __importDefault(require("./namespaces/rdf.js"));
6
10
  class Decoder {
7
11
  constructor(graph, schema, context) {
8
12
  Object.defineProperty(this, "graph", {
@@ -51,17 +55,17 @@ class Decoder {
51
55
  decode() {
52
56
  const output = [];
53
57
  for (const [iri, properties] of this.graph) {
54
- if (properties.has(mod_js_1.rdf.type)) {
55
- const types = properties.get(mod_js_1.rdf.type);
58
+ if (properties.has(rdf_js_2.default.type)) {
59
+ const types = properties.get(rdf_js_2.default.type);
56
60
  for (const type of types) {
57
- if (type.termType === "NamedNode" && type.value === mod_js_1.ldkit.Resource) {
61
+ if (type.termType === "NamedNode" && type.value === ldkit_js_1.default.Resource) {
58
62
  output.push(this.decodeNode(iri, this.schema));
59
63
  }
60
64
  }
61
65
  }
62
66
  }
63
67
  if (this.graph.size > 0 && output.length < 1) {
64
- throw new Error(`Unable to decode graph - no resources with type <${mod_js_1.ldkit.Resource}> found`);
68
+ throw new Error(`Unable to decode graph - no resources with type <${ldkit_js_1.default.Resource}> found`);
65
69
  }
66
70
  return output;
67
71
  }
@@ -91,12 +95,12 @@ class Decoder {
91
95
  return output;
92
96
  }
93
97
  decodeNodeType(node) {
94
- const typeTerms = node.get(mod_js_1.rdf.type);
98
+ const typeTerms = node.get(rdf_js_2.default.type);
95
99
  if (!typeTerms) {
96
100
  return [];
97
101
  }
98
102
  return typeTerms.reduce((acc, term) => {
99
- if (term.value !== mod_js_1.ldkit.Resource) {
103
+ if (term.value !== ldkit_js_1.default.Resource) {
100
104
  acc.push(term.value);
101
105
  }
102
106
  return acc;
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.encode = void 0;
4
7
  const rdf_js_1 = require("./rdf.js");
5
- const mod_js_1 = require("./namespaces/mod.js");
8
+ const xsd_js_1 = __importDefault(require("./namespaces/xsd.js"));
9
+ const rdf_js_2 = __importDefault(require("./namespaces/rdf.js"));
6
10
  const encode = (node, schema, context, variableInitCounter = 0) => {
7
11
  return Encoder.encode(node, schema, context, variableInitCounter);
8
12
  };
@@ -72,7 +76,7 @@ class Encoder {
72
76
  encodeNodeType(node, requiredTypes, nodeId) {
73
77
  const finalTypes = new Set([...this.getNodeTypes(node), ...requiredTypes]);
74
78
  finalTypes.forEach((type) => {
75
- this.push(nodeId, this.df.namedNode(mod_js_1.rdf.type), this.df.namedNode(type));
79
+ this.push(nodeId, this.df.namedNode(rdf_js_2.default.type), this.df.namedNode(type));
76
80
  });
77
81
  }
78
82
  encodeNodeProperty(value, property, nodeId) {
@@ -104,9 +108,9 @@ class Encoder {
104
108
  this.push(nodeId, propertyId, subNodeId);
105
109
  return;
106
110
  }
107
- const propertyType = property["@type"] ? property["@type"] : mod_js_1.xsd.string;
111
+ const propertyType = property["@type"] ? property["@type"] : xsd_js_1.default.string;
108
112
  if (typeof val === "string" && this.context.language) {
109
- if (propertyType === mod_js_1.xsd.string || propertyType === mod_js_1.rdf.langString) {
113
+ if (propertyType === xsd_js_1.default.string || propertyType === rdf_js_2.default.langString) {
110
114
  this.push(nodeId, propertyId, this.df.literal(val, this.context.language));
111
115
  return;
112
116
  }
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuadFactory = exports.BindingsFactory = exports.TermFactory = exports.quadsToGraph = exports.DataFactory = exports.toRdf = exports.fromRdf = void 0;
3
+ exports.QuadFactory = exports.BindingsFactory = exports.ReadOnlyBindings = exports.TermFactory = exports.quadsToGraph = exports.DataFactory = exports.toRdf = exports.fromRdf = void 0;
4
4
  var rdf_literal_1 = require("rdf-literal");
5
5
  Object.defineProperty(exports, "fromRdf", { enumerable: true, get: function () { return rdf_literal_1.fromRdf; } });
6
6
  Object.defineProperty(exports, "toRdf", { enumerable: true, get: function () { return rdf_literal_1.toRdf; } });
7
7
  const rdf_data_factory_1 = require("rdf-data-factory");
8
8
  Object.defineProperty(exports, "DataFactory", { enumerable: true, get: function () { return rdf_data_factory_1.DataFactory; } });
9
- const bindings_factory_1 = require("@comunica/bindings-factory");
10
9
  const quadsToGraph = (quads) => {
11
10
  const graph = new Map();
12
11
  for (const quad of quads) {
@@ -46,10 +45,90 @@ class TermFactory {
46
45
  }
47
46
  }
48
47
  exports.TermFactory = TermFactory;
49
- class BindingsFactory extends bindings_factory_1.BindingsFactory {
50
- constructor(dataFactory = new rdf_data_factory_1.DataFactory(), termFactory = new TermFactory()) {
51
- super(dataFactory);
52
- Object.defineProperty(this, "localDataFactory", {
48
+ class ReadOnlyBindings {
49
+ constructor(bindings, dataFactory = new rdf_data_factory_1.DataFactory()) {
50
+ Object.defineProperty(this, "type", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: "bindings"
55
+ });
56
+ Object.defineProperty(this, "dataFactory", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: void 0
61
+ });
62
+ Object.defineProperty(this, "entries", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: void 0
67
+ });
68
+ Object.defineProperty(this, "variables", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: void 0
73
+ });
74
+ this.entries = bindings;
75
+ this.dataFactory = dataFactory;
76
+ this.variables = new Map();
77
+ for (const variable of bindings.keys()) {
78
+ this.variables.set(variable.value, variable);
79
+ }
80
+ }
81
+ has(key) {
82
+ const stringKey = typeof key === "string" ? key : key.value;
83
+ const variableKey = this.variables.get(stringKey);
84
+ return this.entries.has(variableKey);
85
+ }
86
+ get(key) {
87
+ const stringKey = typeof key === "string" ? key : key.value;
88
+ const variableKey = this.variables.get(stringKey);
89
+ return this.entries.get(variableKey);
90
+ }
91
+ set(_key, _value) {
92
+ throw new Error("Method not implemented.");
93
+ }
94
+ delete(_key) {
95
+ throw new Error("Method not implemented.");
96
+ }
97
+ keys() {
98
+ return this.entries.keys();
99
+ }
100
+ values() {
101
+ return this.entries.values();
102
+ }
103
+ forEach(fn) {
104
+ return this.entries.forEach(fn);
105
+ }
106
+ get size() {
107
+ return this.entries.size;
108
+ }
109
+ [Symbol.iterator]() {
110
+ return this.entries.entries();
111
+ }
112
+ equals(_other) {
113
+ throw new Error("Method not implemented.");
114
+ }
115
+ filter(_fn) {
116
+ throw new Error("Method not implemented.");
117
+ }
118
+ map(_fn) {
119
+ throw new Error("Method not implemented.");
120
+ }
121
+ merge(_other) {
122
+ throw new Error("Method not implemented.");
123
+ }
124
+ mergeWith(_merger, _other) {
125
+ throw new Error("Method not implemented.");
126
+ }
127
+ }
128
+ exports.ReadOnlyBindings = ReadOnlyBindings;
129
+ class BindingsFactory {
130
+ constructor(dataFactory = new rdf_data_factory_1.DataFactory(), termFactory = new TermFactory(dataFactory)) {
131
+ Object.defineProperty(this, "dataFactory", {
53
132
  enumerable: true,
54
133
  configurable: true,
55
134
  writable: true,
@@ -61,22 +140,22 @@ class BindingsFactory extends bindings_factory_1.BindingsFactory {
61
140
  writable: true,
62
141
  value: void 0
63
142
  });
64
- this.localDataFactory = dataFactory;
143
+ this.dataFactory = dataFactory;
65
144
  this.termFactory = termFactory;
66
145
  }
67
146
  fromJson(jsonBindings) {
68
147
  const bindingsEntries = Object.entries(jsonBindings).map(([varName, jsonTerm]) => {
69
148
  return [
70
- this.localDataFactory.variable(varName),
149
+ this.dataFactory.variable(varName),
71
150
  this.termFactory.fromJson(jsonTerm),
72
151
  ];
73
152
  });
74
- return this.bindings(bindingsEntries);
153
+ return new ReadOnlyBindings(new Map(bindingsEntries), this.dataFactory);
75
154
  }
76
155
  }
77
156
  exports.BindingsFactory = BindingsFactory;
78
157
  class QuadFactory {
79
- constructor(dataFactory = new rdf_data_factory_1.DataFactory(), termFactory = new TermFactory()) {
158
+ constructor(dataFactory = new rdf_data_factory_1.DataFactory(), termFactory = new TermFactory(dataFactory)) {
80
159
  Object.defineProperty(this, "dataFactory", {
81
160
  enumerable: true,
82
161
  configurable: true,
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.QueryBuilder = void 0;
4
7
  const mod_js_1 = require("../schema/mod.js");
5
8
  const sparql_js_1 = require("../sparql.js");
6
9
  const rdf_js_1 = require("../rdf.js");
7
- const mod_js_2 = require("../namespaces/mod.js");
10
+ const ldkit_js_1 = __importDefault(require("../namespaces/ldkit.js"));
11
+ const rdf_js_2 = __importDefault(require("../namespaces/rdf.js"));
8
12
  const encoder_js_1 = require("../encoder.js");
9
13
  const query_helper_js_1 = require("./query_helper.js");
10
14
  class QueryBuilder {
@@ -52,10 +56,10 @@ class QueryBuilder {
52
56
  this.df = new rdf_js_1.DataFactory();
53
57
  }
54
58
  getResourceSignature() {
55
- return this.df.quad(this.df.variable("iri"), this.df.namedNode(mod_js_2.rdf.type), this.df.namedNode(mod_js_2.ldkit.Resource));
59
+ return this.df.quad(this.df.variable("iri"), this.df.namedNode(rdf_js_2.default.type), this.df.namedNode(ldkit_js_1.default.Resource));
56
60
  }
57
61
  getTypesSignature() {
58
- return this.df.quad(this.df.variable("iri"), this.df.namedNode(mod_js_2.rdf.type), this.df.variable("iri_type"));
62
+ return this.df.quad(this.df.variable("iri"), this.df.namedNode(rdf_js_2.default.type), this.df.variable("iri_type"));
59
63
  }
60
64
  entitiesToQuads(entities) {
61
65
  const quadArrays = entities.map((entity) => (0, encoder_js_1.encode)(entity, this.schema, this.context));
@@ -69,7 +73,7 @@ class QueryBuilder {
69
73
  const properties = (0, mod_js_1.getSchemaProperties)(s);
70
74
  if (varPrefix !== "iri" || !omitRootTypes) {
71
75
  rdfType.forEach((type) => {
72
- conditions.push(this.df.quad(this.df.variable(varPrefix), this.df.namedNode(mod_js_2.rdf.type), this.df.namedNode(type)));
76
+ conditions.push(this.df.quad(this.df.variable(varPrefix), this.df.namedNode(rdf_js_2.default.type), this.df.namedNode(type)));
73
77
  });
74
78
  }
75
79
  Object.keys(properties).forEach((prop, index) => {
@@ -1,39 +1,43 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const mod_js_1 = require("../namespaces/mod.js");
6
+ const xsd_js_1 = __importDefault(require("../namespaces/xsd.js"));
7
+ const rdf_js_1 = __importDefault(require("../namespaces/rdf.js"));
4
8
  const SupportedDataTypesPrototype = {
5
- [mod_js_1.xsd.dateTime]: new Date(),
6
- [mod_js_1.xsd.date]: new Date(),
7
- [mod_js_1.xsd.gDay]: new Date(),
8
- [mod_js_1.xsd.gMonthDay]: new Date(),
9
- [mod_js_1.xsd.gYear]: new Date(),
10
- [mod_js_1.xsd.gYearMonth]: new Date(),
11
- [mod_js_1.xsd.boolean]: true,
12
- [mod_js_1.xsd.double]: 0.0,
13
- [mod_js_1.xsd.decimal]: 0.0,
14
- [mod_js_1.xsd.float]: 0.0,
15
- [mod_js_1.xsd.integer]: 0,
16
- [mod_js_1.xsd.long]: 0,
17
- [mod_js_1.xsd.int]: 0,
18
- [mod_js_1.xsd.byte]: 0,
19
- [mod_js_1.xsd.short]: 0,
20
- [mod_js_1.xsd.negativeInteger]: 0,
21
- [mod_js_1.xsd.nonNegativeInteger]: 0,
22
- [mod_js_1.xsd.nonPositiveInteger]: 0,
23
- [mod_js_1.xsd.positiveInteger]: 0,
24
- [mod_js_1.xsd.unsignedByte]: 0,
25
- [mod_js_1.xsd.unsignedInt]: 0,
26
- [mod_js_1.xsd.unsignedLong]: 0,
27
- [mod_js_1.xsd.unsignedShort]: 0,
28
- [mod_js_1.xsd.string]: "",
29
- [mod_js_1.xsd.normalizedString]: "",
30
- [mod_js_1.xsd.anyURI]: "",
31
- [mod_js_1.xsd.base64Binary]: "",
32
- [mod_js_1.xsd.language]: "",
33
- [mod_js_1.xsd.Name]: "",
34
- [mod_js_1.xsd.NCName]: "",
35
- [mod_js_1.xsd.NMTOKEN]: "",
36
- [mod_js_1.xsd.token]: "",
37
- [mod_js_1.xsd.hexBinary]: "",
38
- [mod_js_1.rdf.langString]: "",
9
+ [xsd_js_1.default.dateTime]: new Date(),
10
+ [xsd_js_1.default.date]: new Date(),
11
+ [xsd_js_1.default.gDay]: new Date(),
12
+ [xsd_js_1.default.gMonthDay]: new Date(),
13
+ [xsd_js_1.default.gYear]: new Date(),
14
+ [xsd_js_1.default.gYearMonth]: new Date(),
15
+ [xsd_js_1.default.boolean]: true,
16
+ [xsd_js_1.default.double]: 0.0,
17
+ [xsd_js_1.default.decimal]: 0.0,
18
+ [xsd_js_1.default.float]: 0.0,
19
+ [xsd_js_1.default.integer]: 0,
20
+ [xsd_js_1.default.long]: 0,
21
+ [xsd_js_1.default.int]: 0,
22
+ [xsd_js_1.default.byte]: 0,
23
+ [xsd_js_1.default.short]: 0,
24
+ [xsd_js_1.default.negativeInteger]: 0,
25
+ [xsd_js_1.default.nonNegativeInteger]: 0,
26
+ [xsd_js_1.default.nonPositiveInteger]: 0,
27
+ [xsd_js_1.default.positiveInteger]: 0,
28
+ [xsd_js_1.default.unsignedByte]: 0,
29
+ [xsd_js_1.default.unsignedInt]: 0,
30
+ [xsd_js_1.default.unsignedLong]: 0,
31
+ [xsd_js_1.default.unsignedShort]: 0,
32
+ [xsd_js_1.default.string]: "",
33
+ [xsd_js_1.default.normalizedString]: "",
34
+ [xsd_js_1.default.anyURI]: "",
35
+ [xsd_js_1.default.base64Binary]: "",
36
+ [xsd_js_1.default.language]: "",
37
+ [xsd_js_1.default.Name]: "",
38
+ [xsd_js_1.default.NCName]: "",
39
+ [xsd_js_1.default.NMTOKEN]: "",
40
+ [xsd_js_1.default.token]: "",
41
+ [xsd_js_1.default.hexBinary]: "",
42
+ [rdf_js_1.default.langString]: "",
39
43
  };
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getSchemaProperties = exports.expandSchema = void 0;
4
- const mod_js_1 = require("../namespaces/mod.js");
7
+ const xsd_js_1 = __importDefault(require("../namespaces/xsd.js"));
5
8
  const expandSchema = (schemaPrototype) => {
6
9
  const expandArray = (stringOrStrings) => {
7
10
  return Array.isArray(stringOrStrings) ? stringOrStrings : [stringOrStrings];
@@ -10,7 +13,7 @@ const expandSchema = (schemaPrototype) => {
10
13
  if (typeof stringOrProperty === "string") {
11
14
  return {
12
15
  "@id": stringOrProperty,
13
- "@type": mod_js_1.xsd.string,
16
+ "@type": xsd_js_1.default.string,
14
17
  };
15
18
  }
16
19
  const property = stringOrProperty;
@@ -38,7 +41,7 @@ const expandSchema = (schemaPrototype) => {
38
41
  return acc;
39
42
  }, baseProperty);
40
43
  if (!baseProperty["@type"] && !baseProperty["@context"]) {
41
- baseProperty["@type"] = mod_js_1.xsd.string;
44
+ baseProperty["@type"] = xsd_js_1.default.string;
42
45
  }
43
46
  return expandedProperty;
44
47
  };
@@ -9,6 +9,13 @@ declare const _default: {
9
9
  range: "dbo:range";
10
10
  prefix: "dbo:prefix";
11
11
  length: "dbo:length";
12
+ Name: "dbo:Name";
13
+ date: "dbo:date";
14
+ duration: "dbo:duration";
15
+ language: "dbo:language";
16
+ time: "dbo:time";
17
+ List: "dbo:List";
18
+ description: "dbo:description";
12
19
  Academic: "dbo:Academic";
13
20
  AcademicConference: "dbo:AcademicConference";
14
21
  AcademicJournal: "dbo:AcademicJournal";
@@ -391,7 +398,6 @@ declare const _default: {
391
398
  LineOfFashion: "dbo:LineOfFashion";
392
399
  Linguist: "dbo:Linguist";
393
400
  Lipid: "dbo:Lipid";
394
- List: "dbo:List";
395
401
  LiteraryGenre: "dbo:LiteraryGenre";
396
402
  Locality: "dbo:Locality";
397
403
  Lock: "dbo:Lock";
@@ -471,7 +477,6 @@ declare const _default: {
471
477
  MusicalWork: "dbo:MusicalWork";
472
478
  MythologicalFigure: "dbo:MythologicalFigure";
473
479
  NCAATeamSeason: "dbo:NCAATeamSeason";
474
- Name: "dbo:Name";
475
480
  NarutoCharacter: "dbo:NarutoCharacter";
476
481
  NascarDriver: "dbo:NascarDriver";
477
482
  NationalAnthem: "dbo:NationalAnthem";
@@ -1391,7 +1396,6 @@ declare const _default: {
1391
1396
  damsire: "dbo:damsire";
1392
1397
  danseCompetition: "dbo:danseCompetition";
1393
1398
  danseScore: "dbo:danseScore";
1394
- date: "dbo:date";
1395
1399
  dateAct: "dbo:dateAct";
1396
1400
  dateAgreement: "dbo:dateAgreement";
1397
1401
  dateBudget: "dbo:dateBudget";
@@ -1455,7 +1459,6 @@ declare const _default: {
1455
1459
  deputy: "dbo:deputy";
1456
1460
  derivative: "dbo:derivative";
1457
1461
  derivedWord: "dbo:derivedWord";
1458
- description: "dbo:description";
1459
1462
  designCompany: "dbo:designCompany";
1460
1463
  designer: "dbo:designer";
1461
1464
  destination: "dbo:destination";
@@ -1534,7 +1537,6 @@ declare const _default: {
1534
1537
  drugbank: "dbo:drugbank";
1535
1538
  dryCargo: "dbo:dryCargo";
1536
1539
  dubber: "dbo:dubber";
1537
- duration: "dbo:duration";
1538
1540
  dutchArtworkCode: "dbo:dutchArtworkCode";
1539
1541
  dutchCOROPCode: "dbo:dutchCOROPCode";
1540
1542
  dutchMIPCode: "dbo:dutchMIPCode";
@@ -2069,7 +2071,6 @@ declare const _default: {
2069
2071
  landskap: "dbo:landskap";
2070
2072
  landtag: "dbo:landtag";
2071
2073
  landtagMandate: "dbo:landtagMandate";
2072
- language: "dbo:language";
2073
2074
  languageCode: "dbo:languageCode";
2074
2075
  languageFamily: "dbo:languageFamily";
2075
2076
  languageRegulator: "dbo:languageRegulator";
@@ -3406,7 +3407,6 @@ declare const _default: {
3406
3407
  thumbnail: "dbo:thumbnail";
3407
3408
  thumbnailCaption: "dbo:thumbnailCaption";
3408
3409
  tie: "dbo:tie";
3409
- time: "dbo:time";
3410
3410
  timeInSpace: "dbo:timeInSpace";
3411
3411
  timeZone: "dbo:timeZone";
3412
3412
  timeshiftChannel: "dbo:timeshiftChannel";
@@ -1,11 +1,11 @@
1
1
  declare const _default: {
2
2
  subject: "dc:subject";
3
3
  type: "dc:type";
4
- creator: "dc:creator";
5
4
  date: "dc:date";
5
+ language: "dc:language";
6
6
  description: "dc:description";
7
+ creator: "dc:creator";
7
8
  format: "dc:format";
8
- language: "dc:language";
9
9
  publisher: "dc:publisher";
10
10
  relation: "dc:relation";
11
11
  source: "dc:source";
@@ -1,16 +1,16 @@
1
1
  declare const _default: {
2
2
  subject: "dcterms:subject";
3
3
  type: "dcterms:type";
4
+ date: "dcterms:date";
5
+ language: "dcterms:language";
6
+ description: "dcterms:description";
4
7
  Agent: "dcterms:Agent";
5
8
  Standard: "dcterms:Standard";
6
9
  abstract: "dcterms:abstract";
7
10
  created: "dcterms:created";
8
11
  creator: "dcterms:creator";
9
- date: "dcterms:date";
10
- description: "dcterms:description";
11
12
  format: "dcterms:format";
12
13
  isPartOf: "dcterms:isPartOf";
13
- language: "dcterms:language";
14
14
  license: "dcterms:license";
15
15
  publisher: "dcterms:publisher";
16
16
  relation: "dcterms:relation";
@@ -1,8 +1,8 @@
1
1
  declare const _default: {
2
2
  includes: "gr:includes";
3
+ description: "gr:description";
3
4
  category: "gr:category";
4
5
  depth: "gr:depth";
5
- description: "gr:description";
6
6
  height: "gr:height";
7
7
  name: "gr:name";
8
8
  owns: "gr:owns";
@@ -4,13 +4,13 @@ declare const _default: {
4
4
  predicate: "rdf:predicate";
5
5
  value: "rdf:value";
6
6
  type: "rdf:type";
7
- List: "rdf:List";
8
7
  language: "rdf:language";
9
8
  Alt: "rdf:Alt";
10
9
  Bag: "rdf:Bag";
11
10
  CompoundLiteral: "rdf:CompoundLiteral";
12
11
  HTML: "rdf:HTML";
13
12
  JSON: "rdf:JSON";
13
+ List: "rdf:List";
14
14
  PlainLiteral: "rdf:PlainLiteral";
15
15
  Property: "rdf:Property";
16
16
  Seq: "rdf:Seq";
@@ -1,10 +1,10 @@
1
1
  declare const _default: {
2
2
  Literal: "rdfs:Literal";
3
3
  range: "rdfs:range";
4
+ Resource: "rdfs:Resource";
4
5
  comment: "rdfs:comment";
5
6
  domain: "rdfs:domain";
6
7
  member: "rdfs:member";
7
- Resource: "rdfs:Resource";
8
8
  Class: "rdfs:Class";
9
9
  Container: "rdfs:Container";
10
10
  ContainerMembershipProperty: "rdfs:ContainerMembershipProperty";
@@ -3,6 +3,10 @@ declare const _default: {
3
3
  value: "schema:value";
4
4
  query: "schema:query";
5
5
  map: "schema:map";
6
+ duration: "schema:duration";
7
+ language: "schema:language";
8
+ Property: "schema:Property";
9
+ description: "schema:description";
6
10
  Airline: "schema:Airline";
7
11
  Airport: "schema:Airport";
8
12
  AnatomicalStructure: "schema:AnatomicalStructure";
@@ -94,14 +98,12 @@ declare const _default: {
94
98
  deathPlace: "schema:deathPlace";
95
99
  department: "schema:department";
96
100
  depth: "schema:depth";
97
- description: "schema:description";
98
101
  differentialDiagnosis: "schema:differentialDiagnosis";
99
102
  director: "schema:director";
100
103
  dissolutionDate: "schema:dissolutionDate";
101
104
  distance: "schema:distance";
102
105
  drainsTo: "schema:drainsTo";
103
106
  drug: "schema:drug";
104
- duration: "schema:duration";
105
107
  editor: "schema:editor";
106
108
  elevation: "schema:elevation";
107
109
  endDate: "schema:endDate";
@@ -131,7 +133,6 @@ declare const _default: {
131
133
  isbn: "schema:isbn";
132
134
  issn: "schema:issn";
133
135
  jurisdiction: "schema:jurisdiction";
134
- language: "schema:language";
135
136
  license: "schema:license";
136
137
  location: "schema:location";
137
138
  logo: "schema:logo";
@@ -270,7 +271,6 @@ declare const _default: {
270
271
  valueAddedTaxIncluded: "schema:valueAddedTaxIncluded";
271
272
  valueReference: "schema:valueReference";
272
273
  vatID: "schema:vatID";
273
- Property: "schema:Property";
274
274
  Class: "schema:Class";
275
275
  "3DModel": "schema:3DModel";
276
276
  AMRadioChannel: "schema:AMRadioChannel";
@@ -1,7 +1,8 @@
1
1
  declare const _default: {
2
2
  subject: "sioc:subject";
3
- Community: "sioc:Community";
3
+ link: "sioc:link";
4
4
  description: "sioc:description";
5
+ Community: "sioc:Community";
5
6
  follows: "sioc:follows";
6
7
  id: "sioc:id";
7
8
  name: "sioc:name";
@@ -71,7 +72,6 @@ declare const _default: {
71
72
  later_version: "sioc:later_version";
72
73
  latest_version: "sioc:latest_version";
73
74
  likes: "sioc:likes";
74
- link: "sioc:link";
75
75
  links_to: "sioc:links_to";
76
76
  member_of: "sioc:member_of";
77
77
  moderator_of: "sioc:moderator_of";
@@ -1,11 +1,6 @@
1
1
  declare const _default: {
2
2
  string: "xsd:string";
3
3
  boolean: "xsd:boolean";
4
- Name: "xsd:Name";
5
- date: "xsd:date";
6
- duration: "xsd:duration";
7
- language: "xsd:language";
8
- time: "xsd:time";
9
4
  ENTITIES: "xsd:ENTITIES";
10
5
  ENTITY: "xsd:ENTITY";
11
6
  ID: "xsd:ID";
@@ -15,6 +10,7 @@ declare const _default: {
15
10
  NMTOKEN: "xsd:NMTOKEN";
16
11
  NMTOKENS: "xsd:NMTOKENS";
17
12
  NOTATION: "xsd:NOTATION";
13
+ Name: "xsd:Name";
18
14
  QName: "xsd:QName";
19
15
  anyAtomicType: "xsd:anyAtomicType";
20
16
  anySimpleType: "xsd:anySimpleType";
@@ -22,11 +18,13 @@ declare const _default: {
22
18
  anyURI: "xsd:anyURI";
23
19
  base64Binary: "xsd:base64Binary";
24
20
  byte: "xsd:byte";
21
+ date: "xsd:date";
25
22
  dateTime: "xsd:dateTime";
26
23
  dateTimeStamp: "xsd:dateTimeStamp";
27
24
  dayTimeDuration: "xsd:dayTimeDuration";
28
25
  decimal: "xsd:decimal";
29
26
  double: "xsd:double";
27
+ duration: "xsd:duration";
30
28
  float: "xsd:float";
31
29
  gDay: "xsd:gDay";
32
30
  gMonth: "xsd:gMonth";
@@ -36,6 +34,7 @@ declare const _default: {
36
34
  hexBinary: "xsd:hexBinary";
37
35
  int: "xsd:int";
38
36
  integer: "xsd:integer";
37
+ language: "xsd:language";
39
38
  long: "xsd:long";
40
39
  negativeInteger: "xsd:negativeInteger";
41
40
  nonNegativeInteger: "xsd:nonNegativeInteger";
@@ -43,6 +42,7 @@ declare const _default: {
43
42
  normalizedString: "xsd:normalizedString";
44
43
  positiveInteger: "xsd:positiveInteger";
45
44
  short: "xsd:short";
45
+ time: "xsd:time";
46
46
  token: "xsd:token";
47
47
  unsignedByte: "xsd:unsignedByte";
48
48
  unsignedInt: "xsd:unsignedInt";
@@ -1,11 +1,8 @@
1
- import type { Bindings, BlankNode, Literal, NamedNode, Quad, Term, Variable } from "rdf-js";
2
- export type { Bindings, BlankNode, Literal, NamedNode, Quad, Term, Variable };
3
1
  import type * as RDF from "rdf-js";
4
2
  export type { RDF };
5
3
  export { fromRdf, toRdf } from "rdf-literal";
6
4
  import { DataFactory } from "rdf-data-factory";
7
5
  export { DataFactory };
8
- import { BindingsFactory as ComunicaBindingsFactory } from "@comunica/bindings-factory";
9
6
  import type { IDataSource, IQueryContextCommon } from "@comunica/types";
10
7
  export declare type LDkitContext = {
11
8
  graph?: string;
@@ -14,9 +11,9 @@ export declare type LDkitContext = {
14
11
  export declare type Context = LDkitContext & RDF.QueryStringContext & RDF.QuerySourceContext<IDataSource> & IQueryContextCommon;
15
12
  export declare type IQueryEngine = RDF.StringSparqlQueryable<RDF.SparqlResultSupport, Context>;
16
13
  export declare type Iri = string;
17
- export declare type Node = Map<Iri, Term[]>;
14
+ export declare type Node = Map<Iri, RDF.Term[]>;
18
15
  export declare type Graph = Map<Iri, Node>;
19
- export declare const quadsToGraph: (quads: Quad[]) => Graph;
16
+ export declare const quadsToGraph: (quads: RDF.Quad[]) => Graph;
20
17
  export declare namespace RDFJSON {
21
18
  type Term = {
22
19
  type: "uri" | "literal" | "bnode";
@@ -25,6 +22,7 @@ export declare namespace RDFJSON {
25
22
  datatype?: string;
26
23
  };
27
24
  type Bindings = Record<string, Term>;
25
+ type Triple = [Iri, Iri, Term];
28
26
  type SparqlResultsJsonFormat = {
29
27
  head: {
30
28
  vars?: string[];
@@ -42,23 +40,44 @@ export declare namespace RDFJSON {
42
40
  fromJson(jsonBindings: Bindings): RDF.Bindings;
43
41
  }
44
42
  interface QuadFactory {
45
- fromJson(jsonRdf: [Iri, Iri, Term]): RDF.Quad;
43
+ fromJson(jsonRdf: Triple): RDF.Quad;
46
44
  }
47
45
  }
48
46
  export declare class TermFactory implements RDFJSON.TermFactory {
49
47
  protected readonly dataFactory: RDF.DataFactory;
50
48
  constructor(dataFactory?: RDF.DataFactory);
51
- fromJson(jsonTerm: RDFJSON.Term): BlankNode | Literal | NamedNode<string>;
49
+ fromJson(jsonTerm: RDFJSON.Term): RDF.BlankNode | RDF.Literal | RDF.NamedNode<string>;
52
50
  }
53
- export declare class BindingsFactory extends ComunicaBindingsFactory implements RDFJSON.BindingsFactory {
54
- protected readonly localDataFactory: RDF.DataFactory;
51
+ export declare class ReadOnlyBindings implements RDF.Bindings {
52
+ readonly type = "bindings";
53
+ protected readonly dataFactory: RDF.DataFactory;
54
+ protected readonly entries: Map<RDF.Variable, RDF.Term>;
55
+ protected readonly variables: Map<string, RDF.Variable>;
56
+ constructor(bindings: Map<RDF.Variable, RDF.Term>, dataFactory?: RDF.DataFactory);
57
+ has(key: string | RDF.Variable): boolean;
58
+ get(key: string | RDF.Variable): RDF.Term | undefined;
59
+ set(_key: string | RDF.Variable, _value: RDF.Term): RDF.Bindings;
60
+ delete(_key: string | RDF.Variable): RDF.Bindings;
61
+ keys(): IterableIterator<RDF.Variable>;
62
+ values(): IterableIterator<RDF.Term>;
63
+ forEach(fn: (value: RDF.Term, key: RDF.Variable) => unknown): void;
64
+ get size(): number;
65
+ [Symbol.iterator](): IterableIterator<[RDF.Variable, RDF.Term]>;
66
+ equals(_other: RDF.Bindings | null | undefined): boolean;
67
+ filter(_fn: (value: RDF.Term, key: RDF.Variable) => boolean): RDF.Bindings;
68
+ map(_fn: (value: RDF.Term, key: RDF.Variable) => RDF.Term): RDF.Bindings;
69
+ merge(_other: RDF.Bindings): RDF.Bindings | undefined;
70
+ mergeWith(_merger: (self: RDF.Term, other: RDF.Term, key: RDF.Variable) => RDF.Term, _other: RDF.Bindings): RDF.Bindings;
71
+ }
72
+ export declare class BindingsFactory implements RDFJSON.BindingsFactory {
73
+ protected readonly dataFactory: RDF.DataFactory;
55
74
  protected readonly termFactory: RDFJSON.TermFactory;
56
75
  constructor(dataFactory?: RDF.DataFactory, termFactory?: RDFJSON.TermFactory);
57
- fromJson(jsonBindings: RDFJSON.Bindings): Bindings;
76
+ fromJson(jsonBindings: RDFJSON.Bindings): ReadOnlyBindings;
58
77
  }
59
78
  export declare class QuadFactory implements RDFJSON.QuadFactory {
60
79
  protected readonly dataFactory: RDF.DataFactory;
61
80
  protected readonly termFactory: RDFJSON.TermFactory;
62
81
  constructor(dataFactory?: RDF.DataFactory, termFactory?: RDFJSON.TermFactory);
63
- fromJson(jsonRdf: [Iri, Iri, RDFJSON.Term]): Quad;
82
+ fromJson(jsonRdf: [Iri, Iri, RDFJSON.Term]): RDF.Quad;
64
83
  }