rdflib 2.2.25 → 2.2.26
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.
- package/.babelrc +0 -0
- package/README.md +0 -0
- package/dist/670.rdflib.min.js +1 -0
- package/dist/730.rdflib.min.js +3 -0
- package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
- package/dist/730.rdflib.min.js.map +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -59
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +0 -0
- package/esm/class-order.js +0 -0
- package/esm/collection.js +4 -3
- package/esm/default-graph.js +0 -0
- package/esm/empty.js +0 -0
- package/esm/factories/canonical-data-factory.js +0 -0
- package/esm/factories/extended-term-factory.js +0 -0
- package/esm/factories/factory-types.js +0 -0
- package/esm/factories/rdflib-data-factory.js +0 -0
- package/esm/fetcher.js +3 -2
- package/esm/formula.js +0 -0
- package/esm/index.js +0 -0
- package/esm/jsonldparser.js +4 -3
- package/esm/jsonparser.js +0 -0
- package/esm/lists.js +0 -0
- package/esm/literal.js +0 -0
- package/esm/log.js +0 -0
- package/esm/n3parser.js +0 -0
- package/esm/named-node.js +0 -0
- package/esm/namespace.js +0 -0
- package/esm/node-internal.js +0 -0
- package/esm/node.js +0 -0
- package/esm/parse.js +0 -0
- package/esm/patch-parser.js +0 -0
- package/esm/query-to-sparql.js +0 -0
- package/esm/query.js +0 -0
- package/esm/rdfaparser.js +0 -0
- package/esm/rdfxmlparser.js +0 -0
- package/esm/serialize.js +1 -1
- package/esm/serializer.js +10 -12
- package/esm/sparql-to-query.js +0 -0
- package/esm/statement.js +0 -0
- package/esm/store.js +4 -4
- package/esm/tf-types.js +0 -0
- package/esm/types.js +0 -0
- package/esm/update-manager.js +0 -0
- package/esm/updates-via.js +0 -0
- package/esm/uri.js +0 -0
- package/esm/utils/default-graph-uri.js +0 -0
- package/esm/utils/termValue.js +0 -0
- package/esm/utils/terms.js +0 -0
- package/esm/utils-js.js +0 -0
- package/esm/utils.js +0 -0
- package/esm/variable.js +0 -0
- package/esm/xsd-internal.js +0 -0
- package/esm/xsd.js +0 -0
- package/lib/blank-node.d.ts +0 -0
- package/lib/blank-node.js +0 -0
- package/lib/class-order.d.ts +0 -0
- package/lib/class-order.js +0 -0
- package/lib/collection.d.ts +0 -0
- package/lib/collection.js +4 -3
- package/lib/default-graph.d.ts +0 -0
- package/lib/default-graph.js +0 -0
- package/lib/empty.d.ts +0 -0
- package/lib/empty.js +0 -0
- package/lib/factories/canonical-data-factory.d.ts +0 -0
- package/lib/factories/canonical-data-factory.js +0 -0
- package/lib/factories/extended-term-factory.d.ts +0 -0
- package/lib/factories/extended-term-factory.js +0 -0
- package/lib/factories/factory-types.d.ts +0 -0
- package/lib/factories/factory-types.js +0 -0
- package/lib/factories/rdflib-data-factory.d.ts +0 -0
- package/lib/factories/rdflib-data-factory.js +0 -0
- package/lib/fetcher.d.ts +0 -0
- package/lib/fetcher.js +3 -2
- package/lib/formula.d.ts +0 -0
- package/lib/formula.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/jsonldparser.d.ts +0 -0
- package/lib/jsonldparser.js +9 -3
- package/lib/jsonparser.d.ts +0 -0
- package/lib/jsonparser.js +0 -0
- package/lib/lists.d.ts +0 -0
- package/lib/lists.js +0 -0
- package/lib/literal.d.ts +0 -0
- package/lib/literal.js +0 -0
- package/lib/log.d.ts +0 -0
- package/lib/log.js +0 -0
- package/lib/n3parser.d.ts +0 -0
- package/lib/n3parser.js +0 -0
- package/lib/named-node.d.ts +0 -0
- package/lib/named-node.js +0 -0
- package/lib/namespace.d.ts +0 -0
- package/lib/namespace.js +0 -0
- package/lib/node-internal.d.ts +0 -0
- package/lib/node-internal.js +0 -0
- package/lib/node.d.ts +0 -0
- package/lib/node.js +0 -0
- package/lib/parse.d.ts +0 -0
- package/lib/parse.js +0 -0
- package/lib/patch-parser.d.ts +0 -0
- package/lib/patch-parser.js +0 -0
- package/lib/query-to-sparql.d.ts +0 -0
- package/lib/query-to-sparql.js +0 -0
- package/lib/query.d.ts +0 -0
- package/lib/query.js +0 -0
- package/lib/rdfaparser.d.ts +0 -0
- package/lib/rdfaparser.js +0 -0
- package/lib/rdfxmlparser.d.ts +0 -0
- package/lib/rdfxmlparser.js +0 -0
- package/lib/serialize.d.ts +0 -0
- package/lib/serialize.js +1 -1
- package/lib/serializer.d.ts +0 -0
- package/lib/serializer.js +10 -13
- package/lib/sparql-to-query.d.ts +0 -0
- package/lib/sparql-to-query.js +0 -0
- package/lib/statement.d.ts +0 -0
- package/lib/statement.js +0 -0
- package/lib/store.d.ts +1 -1
- package/lib/store.js +4 -4
- package/lib/tf-types.d.ts +0 -0
- package/lib/tf-types.js +0 -0
- package/lib/types.d.ts +0 -0
- package/lib/types.js +0 -0
- package/lib/update-manager.d.ts +0 -0
- package/lib/update-manager.js +0 -0
- package/lib/updates-via.d.ts +0 -0
- package/lib/updates-via.js +0 -0
- package/lib/uri.d.ts +0 -0
- package/lib/uri.js +0 -0
- package/lib/utils/default-graph-uri.d.ts +0 -0
- package/lib/utils/default-graph-uri.js +0 -0
- package/lib/utils/termValue.d.ts +0 -0
- package/lib/utils/termValue.js +0 -0
- package/lib/utils/terms.d.ts +0 -0
- package/lib/utils/terms.js +0 -0
- package/lib/utils-js.d.ts +0 -0
- package/lib/utils-js.js +0 -0
- package/lib/utils.d.ts +0 -0
- package/lib/utils.js +0 -0
- package/lib/variable.d.ts +0 -0
- package/lib/variable.js +0 -0
- package/lib/xsd-internal.d.ts +0 -0
- package/lib/xsd-internal.js +0 -0
- package/lib/xsd.d.ts +0 -0
- package/lib/xsd.js +0 -0
- package/package.json +7 -7
- package/src/blank-node.ts +0 -0
- package/src/class-order.ts +0 -0
- package/src/collection.ts +3 -3
- package/src/default-graph.ts +0 -0
- package/src/empty.ts +0 -0
- package/src/factories/canonical-data-factory.ts +0 -0
- package/src/factories/extended-term-factory.ts +0 -0
- package/src/factories/factory-types.ts +0 -0
- package/src/factories/rdflib-data-factory.ts +0 -0
- package/src/fetcher.ts +2 -2
- package/src/formula.ts +0 -0
- package/src/index.ts +0 -0
- package/src/jsonldparser.js +2 -4
- package/src/jsonparser.js +0 -0
- package/src/lists.ts +0 -0
- package/src/literal.ts +0 -0
- package/src/log.js +0 -0
- package/src/n3parser.js +0 -0
- package/src/named-node.ts +0 -0
- package/src/namespace.ts +0 -0
- package/src/node-internal.ts +0 -0
- package/src/node.ts +0 -0
- package/src/parse.ts +0 -0
- package/src/patch-parser.js +0 -0
- package/src/query-to-sparql.js +0 -0
- package/src/query.js +0 -0
- package/src/rdfaparser.js +0 -0
- package/src/rdfxmlparser.js +0 -0
- package/src/serialize.ts +1 -1
- package/src/serializer.js +4 -6
- package/src/sparql-to-query.js +0 -0
- package/src/statement.ts +0 -0
- package/src/store.ts +6 -5
- package/src/tf-types.ts +0 -0
- package/src/types.ts +0 -0
- package/src/update-manager.ts +0 -0
- package/src/updates-via.js +0 -0
- package/src/uri.ts +0 -0
- package/src/utils/default-graph-uri.ts +0 -0
- package/src/utils/termValue.ts +0 -0
- package/src/utils/terms.ts +0 -0
- package/src/utils-js.js +0 -0
- package/src/utils.ts +0 -0
- package/src/variable.ts +0 -0
- package/src/xsd-internal.js +0 -0
- package/src/xsd.js +0 -0
- package/esm/convert.js +0 -60
- package/lib/convert.d.ts +0 -2
- package/lib/convert.js +0 -71
package/esm/blank-node.js
CHANGED
|
File without changes
|
package/esm/class-order.js
CHANGED
|
File without changes
|
package/esm/collection.js
CHANGED
|
@@ -109,10 +109,11 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
109
109
|
}, {
|
|
110
110
|
key: "substitute",
|
|
111
111
|
value: function substitute(bindings) {
|
|
112
|
-
var
|
|
113
|
-
|
|
112
|
+
var collection = new Collection();
|
|
113
|
+
this.elements.forEach(function (ea) {
|
|
114
|
+
collection.append(ea.substitute(bindings));
|
|
114
115
|
});
|
|
115
|
-
return
|
|
116
|
+
return collection;
|
|
116
117
|
}
|
|
117
118
|
}, {
|
|
118
119
|
key: "toNT",
|
package/esm/default-graph.js
CHANGED
|
File without changes
|
package/esm/empty.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/esm/fetcher.js
CHANGED
|
@@ -1274,16 +1274,17 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1274
1274
|
var fetcher = this;
|
|
1275
1275
|
// @ts-ignore
|
|
1276
1276
|
if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {
|
|
1277
|
-
console.log('Internal error - fetchQueue exists ' + uri)
|
|
1277
|
+
// console.log('Internal error - fetchQueue exists ' + uri)
|
|
1278
1278
|
var promise = fetcher.fetchQueue[uri];
|
|
1279
1279
|
if (promise['PromiseStatus'] === 'resolved') {
|
|
1280
1280
|
delete fetcher.fetchQueue[uri];
|
|
1281
1281
|
} else {
|
|
1282
1282
|
// pending
|
|
1283
1283
|
delete fetcher.fetchQueue[uri];
|
|
1284
|
-
console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
1284
|
+
// console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
+
|
|
1287
1288
|
if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {
|
|
1288
1289
|
var msg = "Rdflib: fetcher: Destructive operation on <".concat(fetcher.requested[uri], "> file being fetched! ") + uri;
|
|
1289
1290
|
console.error(msg);
|
package/esm/formula.js
CHANGED
|
File without changes
|
package/esm/index.js
CHANGED
|
File without changes
|
package/esm/jsonldparser.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import jsonld from 'jsonld';
|
|
2
1
|
import { arrayToStatements } from './utils';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -60,8 +59,10 @@ function listToCollection(kb, obj) {
|
|
|
60
59
|
*/
|
|
61
60
|
export default function jsonldParser(str, kb, base, callback) {
|
|
62
61
|
var baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
|
|
63
|
-
return jsonld.
|
|
64
|
-
|
|
62
|
+
return import('jsonld').then(function (jsonld) {
|
|
63
|
+
return jsonld.flatten(JSON.parse(str), null, {
|
|
64
|
+
base: baseString
|
|
65
|
+
});
|
|
65
66
|
}).then(function (flattened) {
|
|
66
67
|
return flattened.reduce(function (store, flatResource) {
|
|
67
68
|
kb = processResource(kb, base, flatResource);
|
package/esm/jsonparser.js
CHANGED
|
File without changes
|
package/esm/lists.js
CHANGED
|
File without changes
|
package/esm/literal.js
CHANGED
|
File without changes
|
package/esm/log.js
CHANGED
|
File without changes
|
package/esm/n3parser.js
CHANGED
|
File without changes
|
package/esm/named-node.js
CHANGED
|
File without changes
|
package/esm/namespace.js
CHANGED
|
File without changes
|
package/esm/node-internal.js
CHANGED
|
File without changes
|
package/esm/node.js
CHANGED
|
File without changes
|
package/esm/parse.js
CHANGED
|
File without changes
|
package/esm/patch-parser.js
CHANGED
|
File without changes
|
package/esm/query-to-sparql.js
CHANGED
|
File without changes
|
package/esm/query.js
CHANGED
|
File without changes
|
package/esm/rdfaparser.js
CHANGED
|
File without changes
|
package/esm/rdfxmlparser.js
CHANGED
|
File without changes
|
package/esm/serialize.js
CHANGED
|
@@ -48,7 +48,7 @@ contentType, callback, options) {
|
|
|
48
48
|
documentString = sz.statementsToNTriples(newSts);
|
|
49
49
|
return executeCallback(null, documentString);
|
|
50
50
|
case JSONLDContentType:
|
|
51
|
-
sz.setFlags('si'); //
|
|
51
|
+
sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)
|
|
52
52
|
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
53
53
|
return executeCallback(null, documentString);
|
|
54
54
|
case NQuadsContentType:
|
package/esm/serializer.js
CHANGED
|
@@ -15,7 +15,6 @@ import * as Util from './utils-js';
|
|
|
15
15
|
import CanonicalDataFactory from './factories/canonical-data-factory';
|
|
16
16
|
import { createXSD } from './xsd';
|
|
17
17
|
import solidNs from 'solid-namespace';
|
|
18
|
-
// import * as jsonld from 'jsonld'
|
|
19
18
|
import * as ttl2jsonld from '@frogcat/ttl2jsonld';
|
|
20
19
|
export default function createSerializer(store) {
|
|
21
20
|
return new Serializer(store);
|
|
@@ -522,7 +521,7 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
522
521
|
var termToN3 = termToN3Method.bind(this);
|
|
523
522
|
function prefixDirectivesMethod() {
|
|
524
523
|
var str = '';
|
|
525
|
-
if (this.defaultNamespace) {
|
|
524
|
+
if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {
|
|
526
525
|
str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\n';
|
|
527
526
|
}
|
|
528
527
|
for (var ns in this.prefixes) {
|
|
@@ -1007,20 +1006,19 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
1007
1006
|
key: "statementsToJsonld",
|
|
1008
1007
|
value: function statementsToJsonld(sts) {
|
|
1009
1008
|
// ttl2jsonld creates context keys for all ttl prefix
|
|
1010
|
-
// context keys must be
|
|
1011
|
-
function findId(itemObj) {
|
|
1009
|
+
// context keys must be absolute IRI ttl2jsonld@0.0.8
|
|
1010
|
+
/* function findId (itemObj) {
|
|
1012
1011
|
if (itemObj['@id']) {
|
|
1013
|
-
|
|
1014
|
-
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
1012
|
+
const item = itemObj['@id'].split(':')
|
|
1013
|
+
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
1015
1014
|
}
|
|
1016
|
-
|
|
1017
|
-
for (
|
|
1018
|
-
if (typeof itemValues[i] !== 'string') {
|
|
1019
|
-
|
|
1020
|
-
findId(itemValues[i]);
|
|
1015
|
+
const itemValues = Object.values(itemObj)
|
|
1016
|
+
for (const i in itemValues) {
|
|
1017
|
+
if (typeof itemValues[i] !== 'string') { // @list contains array
|
|
1018
|
+
findId(itemValues[i])
|
|
1021
1019
|
}
|
|
1022
1020
|
}
|
|
1023
|
-
}
|
|
1021
|
+
} */
|
|
1024
1022
|
var turtleDoc = this.statementsToN3(sts);
|
|
1025
1023
|
var jsonldObj = ttl2jsonld.parse(turtleDoc);
|
|
1026
1024
|
return JSON.stringify(jsonldObj, null, 2);
|
package/esm/sparql-to-query.js
CHANGED
|
File without changes
|
package/esm/statement.js
CHANGED
|
File without changes
|
package/esm/store.js
CHANGED
|
@@ -237,9 +237,9 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
237
237
|
// console.log('ds before substitute: ' + ds)
|
|
238
238
|
if (binding) ds = ds.substitute(binding);
|
|
239
239
|
// console.log('applyPatch: delete: ' + ds)
|
|
240
|
-
|
|
240
|
+
|
|
241
241
|
var bad = [];
|
|
242
|
-
var ds2 = ds.map(function (st) {
|
|
242
|
+
var ds2 = ds.elements.map(function (st) {
|
|
243
243
|
// Find the actual statements in the store
|
|
244
244
|
var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target);
|
|
245
245
|
if (sts.length === 0) {
|
|
@@ -264,8 +264,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
264
264
|
// log.info("doPatch insert "+patch['insert'])
|
|
265
265
|
ds = patch['insert'];
|
|
266
266
|
if (binding) ds = ds.substitute(binding);
|
|
267
|
-
ds
|
|
268
|
-
ds.map(function (st) {
|
|
267
|
+
ds.elements.map(function (st) {
|
|
269
268
|
st.graph = target;
|
|
270
269
|
targetKB.add(st.subject, st.predicate, st.object, st.graph);
|
|
271
270
|
});
|
|
@@ -282,6 +281,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
282
281
|
//@ts-ignore TODO: add sync property to Query when converting Query to typescript
|
|
283
282
|
query.sync = true;
|
|
284
283
|
var bindingsFound = [];
|
|
284
|
+
query.pat.initBindings = [];
|
|
285
285
|
targetKB.query(query, function onBinding(binding) {
|
|
286
286
|
bindingsFound.push(binding);
|
|
287
287
|
// console.log(' got a binding: ' + bindingDebug(binding))
|
package/esm/tf-types.js
CHANGED
|
File without changes
|
package/esm/types.js
CHANGED
|
File without changes
|
package/esm/update-manager.js
CHANGED
|
File without changes
|
package/esm/updates-via.js
CHANGED
|
File without changes
|
package/esm/uri.js
CHANGED
|
File without changes
|
|
File without changes
|
package/esm/utils/termValue.js
CHANGED
|
File without changes
|
package/esm/utils/terms.js
CHANGED
|
File without changes
|
package/esm/utils-js.js
CHANGED
|
File without changes
|
package/esm/utils.js
CHANGED
|
File without changes
|
package/esm/variable.js
CHANGED
|
File without changes
|
package/esm/xsd-internal.js
CHANGED
|
File without changes
|
package/esm/xsd.js
CHANGED
|
File without changes
|
package/lib/blank-node.d.ts
CHANGED
|
File without changes
|
package/lib/blank-node.js
CHANGED
|
File without changes
|
package/lib/class-order.d.ts
CHANGED
|
File without changes
|
package/lib/class-order.js
CHANGED
|
File without changes
|
package/lib/collection.d.ts
CHANGED
|
File without changes
|
package/lib/collection.js
CHANGED
|
@@ -117,10 +117,11 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
117
117
|
}, {
|
|
118
118
|
key: "substitute",
|
|
119
119
|
value: function substitute(bindings) {
|
|
120
|
-
var
|
|
121
|
-
|
|
120
|
+
var collection = new Collection();
|
|
121
|
+
this.elements.forEach(function (ea) {
|
|
122
|
+
collection.append(ea.substitute(bindings));
|
|
122
123
|
});
|
|
123
|
-
return
|
|
124
|
+
return collection;
|
|
124
125
|
}
|
|
125
126
|
}, {
|
|
126
127
|
key: "toNT",
|
package/lib/default-graph.d.ts
CHANGED
|
File without changes
|
package/lib/default-graph.js
CHANGED
|
File without changes
|
package/lib/empty.d.ts
CHANGED
|
File without changes
|
package/lib/empty.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/fetcher.d.ts
CHANGED
|
File without changes
|
package/lib/fetcher.js
CHANGED
|
@@ -1257,16 +1257,17 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1257
1257
|
var fetcher = this;
|
|
1258
1258
|
// @ts-ignore
|
|
1259
1259
|
if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {
|
|
1260
|
-
console.log('Internal error - fetchQueue exists ' + uri)
|
|
1260
|
+
// console.log('Internal error - fetchQueue exists ' + uri)
|
|
1261
1261
|
var promise = fetcher.fetchQueue[uri];
|
|
1262
1262
|
if (promise['PromiseStatus'] === 'resolved') {
|
|
1263
1263
|
delete fetcher.fetchQueue[uri];
|
|
1264
1264
|
} else {
|
|
1265
1265
|
// pending
|
|
1266
1266
|
delete fetcher.fetchQueue[uri];
|
|
1267
|
-
console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
1267
|
+
// console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
+
|
|
1270
1271
|
if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {
|
|
1271
1272
|
var msg = "Rdflib: fetcher: Destructive operation on <".concat(fetcher.requested[uri], "> file being fetched! ") + uri;
|
|
1272
1273
|
console.error(msg);
|
package/lib/formula.d.ts
CHANGED
|
File without changes
|
package/lib/formula.js
CHANGED
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/jsonldparser.d.ts
CHANGED
|
File without changes
|
package/lib/jsonldparser.js
CHANGED
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = jsonldParser;
|
|
8
8
|
exports.jsonldObjectToTerm = jsonldObjectToTerm;
|
|
9
|
-
var
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _utils = require("./utils");
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2.default)(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
13
|
/**
|
|
12
14
|
* Parses json-ld formatted JS objects to a rdf Term.
|
|
13
15
|
* @param kb - The DataFactory to use.
|
|
@@ -67,8 +69,12 @@ function listToCollection(kb, obj) {
|
|
|
67
69
|
*/
|
|
68
70
|
function jsonldParser(str, kb, base, callback) {
|
|
69
71
|
var baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
+
return Promise.resolve().then(function () {
|
|
73
|
+
return _interopRequireWildcard(require('jsonld'));
|
|
74
|
+
}).then(function (jsonld) {
|
|
75
|
+
return jsonld.flatten(JSON.parse(str), null, {
|
|
76
|
+
base: baseString
|
|
77
|
+
});
|
|
72
78
|
}).then(function (flattened) {
|
|
73
79
|
return flattened.reduce(function (store, flatResource) {
|
|
74
80
|
kb = processResource(kb, base, flatResource);
|
package/lib/jsonparser.d.ts
CHANGED
|
File without changes
|
package/lib/jsonparser.js
CHANGED
|
File without changes
|
package/lib/lists.d.ts
CHANGED
|
File without changes
|
package/lib/lists.js
CHANGED
|
File without changes
|
package/lib/literal.d.ts
CHANGED
|
File without changes
|
package/lib/literal.js
CHANGED
|
File without changes
|
package/lib/log.d.ts
CHANGED
|
File without changes
|
package/lib/log.js
CHANGED
|
File without changes
|
package/lib/n3parser.d.ts
CHANGED
|
File without changes
|
package/lib/n3parser.js
CHANGED
|
File without changes
|
package/lib/named-node.d.ts
CHANGED
|
File without changes
|
package/lib/named-node.js
CHANGED
|
File without changes
|
package/lib/namespace.d.ts
CHANGED
|
File without changes
|
package/lib/namespace.js
CHANGED
|
File without changes
|
package/lib/node-internal.d.ts
CHANGED
|
File without changes
|
package/lib/node-internal.js
CHANGED
|
File without changes
|
package/lib/node.d.ts
CHANGED
|
File without changes
|
package/lib/node.js
CHANGED
|
File without changes
|
package/lib/parse.d.ts
CHANGED
|
File without changes
|
package/lib/parse.js
CHANGED
|
File without changes
|
package/lib/patch-parser.d.ts
CHANGED
|
File without changes
|
package/lib/patch-parser.js
CHANGED
|
File without changes
|
package/lib/query-to-sparql.d.ts
CHANGED
|
File without changes
|
package/lib/query-to-sparql.js
CHANGED
|
File without changes
|
package/lib/query.d.ts
CHANGED
|
File without changes
|
package/lib/query.js
CHANGED
|
File without changes
|
package/lib/rdfaparser.d.ts
CHANGED
|
File without changes
|
package/lib/rdfaparser.js
CHANGED
|
File without changes
|
package/lib/rdfxmlparser.d.ts
CHANGED
|
File without changes
|
package/lib/rdfxmlparser.js
CHANGED
|
File without changes
|
package/lib/serialize.d.ts
CHANGED
|
File without changes
|
package/lib/serialize.js
CHANGED
|
@@ -55,7 +55,7 @@ contentType, callback, options) {
|
|
|
55
55
|
documentString = sz.statementsToNTriples(newSts);
|
|
56
56
|
return executeCallback(null, documentString);
|
|
57
57
|
case _types.JSONLDContentType:
|
|
58
|
-
sz.setFlags('si'); //
|
|
58
|
+
sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)
|
|
59
59
|
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
60
60
|
return executeCallback(null, documentString);
|
|
61
61
|
case _types.NQuadsContentType:
|
package/lib/serializer.d.ts
CHANGED
|
File without changes
|
package/lib/serializer.js
CHANGED
|
@@ -28,8 +28,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
28
28
|
** Licence: MIT
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
// import * as jsonld from 'jsonld'
|
|
32
|
-
|
|
33
31
|
function createSerializer(store) {
|
|
34
32
|
return new Serializer(store);
|
|
35
33
|
}
|
|
@@ -535,7 +533,7 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
535
533
|
var termToN3 = termToN3Method.bind(this);
|
|
536
534
|
function prefixDirectivesMethod() {
|
|
537
535
|
var str = '';
|
|
538
|
-
if (this.defaultNamespace) {
|
|
536
|
+
if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {
|
|
539
537
|
str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\n';
|
|
540
538
|
}
|
|
541
539
|
for (var ns in this.prefixes) {
|
|
@@ -1020,20 +1018,19 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
1020
1018
|
key: "statementsToJsonld",
|
|
1021
1019
|
value: function statementsToJsonld(sts) {
|
|
1022
1020
|
// ttl2jsonld creates context keys for all ttl prefix
|
|
1023
|
-
// context keys must be
|
|
1024
|
-
function findId(itemObj) {
|
|
1021
|
+
// context keys must be absolute IRI ttl2jsonld@0.0.8
|
|
1022
|
+
/* function findId (itemObj) {
|
|
1025
1023
|
if (itemObj['@id']) {
|
|
1026
|
-
|
|
1027
|
-
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
1024
|
+
const item = itemObj['@id'].split(':')
|
|
1025
|
+
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
1028
1026
|
}
|
|
1029
|
-
|
|
1030
|
-
for (
|
|
1031
|
-
if (typeof itemValues[i] !== 'string') {
|
|
1032
|
-
|
|
1033
|
-
findId(itemValues[i]);
|
|
1027
|
+
const itemValues = Object.values(itemObj)
|
|
1028
|
+
for (const i in itemValues) {
|
|
1029
|
+
if (typeof itemValues[i] !== 'string') { // @list contains array
|
|
1030
|
+
findId(itemValues[i])
|
|
1034
1031
|
}
|
|
1035
1032
|
}
|
|
1036
|
-
}
|
|
1033
|
+
} */
|
|
1037
1034
|
var turtleDoc = this.statementsToN3(sts);
|
|
1038
1035
|
var jsonldObj = ttl2jsonld.parse(turtleDoc);
|
|
1039
1036
|
return JSON.stringify(jsonldObj, null, 2);
|
package/lib/sparql-to-query.d.ts
CHANGED
|
File without changes
|
package/lib/sparql-to-query.js
CHANGED
|
File without changes
|
package/lib/statement.d.ts
CHANGED
|
File without changes
|
package/lib/statement.js
CHANGED
|
File without changes
|
package/lib/store.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export default class IndexedFormula extends Formula {
|
|
|
95
95
|
*/
|
|
96
96
|
applyPatch(patch: {
|
|
97
97
|
delete?: ReadonlyArray<Statement>;
|
|
98
|
-
|
|
98
|
+
insert?: ReadonlyArray<Statement>;
|
|
99
99
|
where?: any;
|
|
100
100
|
}, target: TFNamedNode, patchCallback: (errorString?: string) => void): void;
|
|
101
101
|
/**
|
package/lib/store.js
CHANGED
|
@@ -226,9 +226,9 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
226
226
|
// console.log('ds before substitute: ' + ds)
|
|
227
227
|
if (binding) ds = ds.substitute(binding);
|
|
228
228
|
// console.log('applyPatch: delete: ' + ds)
|
|
229
|
-
|
|
229
|
+
|
|
230
230
|
var bad = [];
|
|
231
|
-
var ds2 = ds.map(function (st) {
|
|
231
|
+
var ds2 = ds.elements.map(function (st) {
|
|
232
232
|
// Find the actual statements in the store
|
|
233
233
|
var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target);
|
|
234
234
|
if (sts.length === 0) {
|
|
@@ -253,8 +253,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
253
253
|
// log.info("doPatch insert "+patch['insert'])
|
|
254
254
|
ds = patch['insert'];
|
|
255
255
|
if (binding) ds = ds.substitute(binding);
|
|
256
|
-
ds
|
|
257
|
-
ds.map(function (st) {
|
|
256
|
+
ds.elements.map(function (st) {
|
|
258
257
|
st.graph = target;
|
|
259
258
|
targetKB.add(st.subject, st.predicate, st.object, st.graph);
|
|
260
259
|
});
|
|
@@ -271,6 +270,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
271
270
|
//@ts-ignore TODO: add sync property to Query when converting Query to typescript
|
|
272
271
|
query.sync = true;
|
|
273
272
|
var bindingsFound = [];
|
|
273
|
+
query.pat.initBindings = [];
|
|
274
274
|
targetKB.query(query, function onBinding(binding) {
|
|
275
275
|
bindingsFound.push(binding);
|
|
276
276
|
// console.log(' got a binding: ' + bindingDebug(binding))
|
package/lib/tf-types.d.ts
CHANGED
|
File without changes
|
package/lib/tf-types.js
CHANGED
|
File without changes
|
package/lib/types.d.ts
CHANGED
|
File without changes
|
package/lib/types.js
CHANGED
|
File without changes
|
package/lib/update-manager.d.ts
CHANGED
|
File without changes
|
package/lib/update-manager.js
CHANGED
|
File without changes
|
package/lib/updates-via.d.ts
CHANGED
|
File without changes
|
package/lib/updates-via.js
CHANGED
|
File without changes
|
package/lib/uri.d.ts
CHANGED
|
File without changes
|
package/lib/uri.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/termValue.d.ts
CHANGED
|
File without changes
|
package/lib/utils/termValue.js
CHANGED
|
File without changes
|
package/lib/utils/terms.d.ts
CHANGED
|
File without changes
|
package/lib/utils/terms.js
CHANGED
|
File without changes
|
package/lib/utils-js.d.ts
CHANGED
|
File without changes
|
package/lib/utils-js.js
CHANGED
|
File without changes
|
package/lib/utils.d.ts
CHANGED
|
File without changes
|
package/lib/utils.js
CHANGED
|
File without changes
|
package/lib/variable.d.ts
CHANGED
|
File without changes
|