rdflib 2.2.21 → 2.2.22-b51259b5
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/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +9 -1
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +61 -114
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -128
- package/esm/convert.js +1 -2
- package/esm/default-graph.js +14 -48
- package/esm/empty.js +8 -39
- package/esm/factories/canonical-data-factory.js +33 -65
- package/esm/factories/extended-term-factory.js +18 -25
- package/esm/factories/factory-types.js +3 -2
- package/esm/factories/rdflib-data-factory.js +9 -19
- package/esm/fetcher.js +1341 -1854
- package/esm/formula.js +639 -846
- package/esm/index.js +40 -76
- package/esm/jsonldparser.js +24 -49
- package/esm/jsonparser.js +1 -8
- package/esm/lists.js +47 -110
- package/esm/literal.js +120 -189
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1015 -1412
- package/esm/named-node.js +70 -119
- package/esm/namespace.js +2 -5
- package/esm/node-internal.js +73 -110
- package/esm/node.js +2 -7
- package/esm/parse.js +12 -19
- package/esm/patch-parser.js +10 -30
- package/esm/query-to-sparql.js +0 -18
- package/esm/query.js +63 -147
- package/esm/rdfaparser.js +794 -997
- package/esm/rdfxmlparser.js +347 -461
- package/esm/serialize.js +9 -27
- package/esm/serializer.js +820 -1049
- package/esm/sparql-to-query.js +44 -134
- package/esm/statement.js +54 -85
- package/esm/store.js +830 -1103
- package/esm/types.js +22 -21
- package/esm/update-manager.js +869 -1106
- package/esm/updates-via.js +104 -161
- package/esm/uri.js +9 -53
- package/esm/utils/default-graph-uri.js +3 -2
- package/esm/utils/termValue.js +0 -1
- package/esm/utils/terms.js +19 -21
- package/esm/utils-js.js +20 -61
- package/esm/utils.js +10 -21
- package/esm/variable.js +32 -78
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +60 -113
- package/lib/class-order.js +1 -2
- package/lib/collection.js +69 -131
- package/lib/convert.js +3 -9
- package/lib/default-graph.js +13 -52
- package/lib/empty.js +8 -43
- package/lib/factories/canonical-data-factory.js +35 -79
- package/lib/factories/extended-term-factory.js +18 -32
- package/lib/factories/factory-types.d.ts +6 -6
- package/lib/factories/factory-types.js +1 -4
- package/lib/factories/rdflib-data-factory.js +9 -23
- package/lib/fetcher.d.ts +6 -6
- package/lib/fetcher.js +1370 -1843
- package/lib/formula.js +640 -855
- package/lib/index.js +66 -152
- package/lib/jsonldparser.js +23 -53
- package/lib/jsonparser.js +1 -10
- package/lib/lists.js +55 -112
- package/lib/literal.js +120 -195
- package/lib/log.d.ts +0 -6
- package/lib/log.js +7 -8
- package/lib/n3parser.js +1030 -1436
- package/lib/named-node.js +69 -126
- package/lib/namespace.js +2 -7
- package/lib/node-internal.js +74 -107
- package/lib/node.js +2 -12
- package/lib/parse.d.ts +1 -1
- package/lib/parse.js +12 -32
- package/lib/patch-parser.js +11 -34
- package/lib/query-to-sparql.js +0 -23
- package/lib/query.js +62 -167
- package/lib/rdfaparser.js +796 -1009
- package/lib/rdfxmlparser.js +349 -466
- package/lib/serialize.js +11 -37
- package/lib/serializer.js +823 -1064
- package/lib/sparql-to-query.js +42 -167
- package/lib/statement.js +55 -91
- package/lib/store.d.ts +1 -1
- package/lib/store.js +850 -1112
- package/lib/tf-types.d.ts +4 -4
- package/lib/types.d.ts +8 -8
- package/lib/types.js +23 -23
- package/lib/update-manager.d.ts +1 -1
- package/lib/update-manager.js +865 -1103
- package/lib/updates-via.js +105 -164
- package/lib/uri.js +8 -61
- package/lib/utils/default-graph-uri.js +3 -5
- package/lib/utils/termValue.js +0 -2
- package/lib/utils/terms.js +19 -40
- package/lib/utils-js.js +23 -88
- package/lib/utils.js +10 -27
- package/lib/variable.js +34 -85
- package/lib/xsd-internal.js +0 -3
- package/lib/xsd.js +2 -6
- package/package.json +35 -35
- package/src/fetcher.ts +2 -2
- package/src/update-manager.ts +12 -7
- package/changes.txt +0 -59
package/lib/serialize.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
7
|
exports.default = serialize;
|
|
11
|
-
|
|
12
8
|
var convert = _interopRequireWildcard(require("./convert"));
|
|
13
|
-
|
|
14
9
|
var _serializer = _interopRequireDefault(require("./serializer"));
|
|
15
|
-
|
|
16
10
|
var _types = require("./types");
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
|
|
21
|
-
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof 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; }
|
|
22
13
|
/**
|
|
23
14
|
* Serialize to the appropriate format
|
|
24
15
|
*/
|
|
25
|
-
function serialize(
|
|
26
|
-
/** The
|
|
27
|
-
target,
|
|
28
|
-
/** The store */
|
|
16
|
+
function serialize( /** The graph or nodes that should be serialized */
|
|
17
|
+
target, /** The store */
|
|
29
18
|
kb, base,
|
|
30
19
|
/**
|
|
31
20
|
* The mime type.
|
|
@@ -33,71 +22,57 @@ kb, base,
|
|
|
33
22
|
*/
|
|
34
23
|
contentType, callback, options) {
|
|
35
24
|
base = base || (target === null || target === void 0 ? void 0 : target.value);
|
|
36
|
-
|
|
25
|
+
const opts = options || {};
|
|
37
26
|
contentType = contentType || _types.TurtleContentType; // text/n3 if complex?
|
|
38
|
-
|
|
39
27
|
var documentString = undefined;
|
|
40
|
-
|
|
41
28
|
try {
|
|
42
29
|
var sz = (0, _serializer.default)(kb);
|
|
43
30
|
if (opts.flags) sz.setFlags(opts.flags);
|
|
44
31
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, target);
|
|
45
|
-
var n3String;
|
|
32
|
+
var n3String;
|
|
46
33
|
|
|
34
|
+
// If an IndexedFormula, use the namespaces from the given graph as suggestions
|
|
47
35
|
if ('namespaces' in kb) {
|
|
48
36
|
sz.suggestNamespaces(kb.namespaces);
|
|
49
|
-
}
|
|
50
|
-
|
|
37
|
+
}
|
|
51
38
|
|
|
39
|
+
// use the provided options.namespaces are mandatory prefixes
|
|
52
40
|
if (opts.namespaces) {
|
|
53
41
|
sz.setNamespaces(opts.namespaces);
|
|
54
42
|
}
|
|
55
|
-
|
|
56
43
|
sz.setBase(base);
|
|
57
|
-
|
|
58
44
|
switch (contentType) {
|
|
59
45
|
case _types.RDFXMLContentType:
|
|
60
46
|
documentString = sz.statementsToXML(newSts);
|
|
61
47
|
return executeCallback(null, documentString);
|
|
62
|
-
|
|
63
48
|
case _types.N3ContentType:
|
|
64
49
|
case _types.N3LegacyContentType:
|
|
65
50
|
documentString = sz.statementsToN3(newSts);
|
|
66
51
|
return executeCallback(null, documentString);
|
|
67
|
-
|
|
68
52
|
case _types.TurtleContentType:
|
|
69
53
|
case _types.TurtleLegacyContentType:
|
|
70
54
|
sz.setFlags('si'); // Suppress = for sameAs and => for implies
|
|
71
|
-
|
|
72
55
|
documentString = sz.statementsToN3(newSts);
|
|
73
56
|
return executeCallback(null, documentString);
|
|
74
|
-
|
|
75
57
|
case _types.NTriplesContentType:
|
|
76
58
|
sz.setFlags('deinprstux'); // Suppress nice parts of N3 to make ntriples
|
|
77
|
-
|
|
78
59
|
documentString = sz.statementsToNTriples(newSts);
|
|
79
60
|
return executeCallback(null, documentString);
|
|
80
|
-
|
|
81
61
|
case _types.JSONLDContentType:
|
|
82
62
|
sz.setFlags('deinprstux'); // Use adapters to connect to incmpatible parser
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
n3String = sz.statementsToNTriples(newSts);
|
|
64
|
+
// n3String = sz.statementsToN3(newSts)
|
|
86
65
|
convert.convertToJson(n3String, callback);
|
|
87
66
|
break;
|
|
88
|
-
|
|
89
67
|
case _types.NQuadsContentType:
|
|
90
68
|
case _types.NQuadsAltContentType:
|
|
91
69
|
// @@@ just outpout the quads? Does not work for collections
|
|
92
70
|
sz.setFlags('deinprstux q'); // Suppress nice parts of N3 to make ntriples
|
|
93
|
-
|
|
94
71
|
documentString = sz.statementsToNTriples(newSts); // q in flag means actually quads
|
|
95
|
-
|
|
96
72
|
return executeCallback(null, documentString);
|
|
97
73
|
// n3String = sz.statementsToN3(newSts)
|
|
98
74
|
// documentString = convert.convertToNQuads(n3String, callback)
|
|
99
75
|
// break
|
|
100
|
-
|
|
101
76
|
default:
|
|
102
77
|
throw new Error('Serialize: Content-type ' + contentType + ' not supported for data write.');
|
|
103
78
|
}
|
|
@@ -106,7 +81,6 @@ contentType, callback, options) {
|
|
|
106
81
|
// @ts-ignore
|
|
107
82
|
return callback(err, undefined);
|
|
108
83
|
}
|
|
109
|
-
|
|
110
84
|
throw err; // Don't hide problems from caller in sync mode
|
|
111
85
|
}
|
|
112
86
|
|