rdflib 2.2.21 → 2.2.22-04669b23
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 +11 -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/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 -77
- package/esm/jsonldparser.js +34 -50
- 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 +1022 -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 -34
- package/esm/serializer.js +842 -1048
- 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/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.d.ts +1 -1
- package/lib/formula.js +640 -855
- package/lib/index.d.ts +1 -2
- package/lib/index.js +67 -156
- package/lib/jsonldparser.js +33 -54
- 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.d.ts +1 -0
- package/lib/n3parser.js +1023 -1422
- 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.d.ts +1 -1
- package/lib/serialize.js +9 -44
- package/lib/serializer.d.ts +1 -0
- package/lib/serializer.js +846 -1063
- package/lib/sparql-to-query.js +42 -167
- package/lib/statement.js +55 -91
- package/lib/store.d.ts +2 -2
- 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 +40 -39
- package/src/fetcher.ts +2 -2
- package/src/index.ts +0 -2
- package/src/jsonldparser.js +13 -4
- package/src/n3parser.js +12 -4
- package/src/serialize.ts +4 -11
- package/src/serializer.js +24 -0
- package/src/update-manager.ts +12 -7
- package/changes.txt +0 -59
- package/esm/convert.js +0 -61
- package/lib/convert.d.ts +0 -2
- package/lib/convert.js +0 -77
- package/src/convert.js +0 -70
package/lib/serialize.d.ts
CHANGED
package/lib/serialize.js
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
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
|
-
var convert = _interopRequireWildcard(require("./convert"));
|
|
13
|
-
|
|
14
8
|
var _serializer = _interopRequireDefault(require("./serializer"));
|
|
15
|
-
|
|
16
9
|
var _types = require("./types");
|
|
17
|
-
|
|
18
|
-
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); }
|
|
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
|
-
|
|
22
10
|
/**
|
|
23
11
|
* Serialize to the appropriate format
|
|
24
12
|
*/
|
|
25
|
-
function serialize(
|
|
26
|
-
/** The
|
|
27
|
-
target,
|
|
28
|
-
/** The store */
|
|
13
|
+
function serialize( /** The graph or nodes that should be serialized */
|
|
14
|
+
target, /** The store */
|
|
29
15
|
kb, base,
|
|
30
16
|
/**
|
|
31
17
|
* The mime type.
|
|
@@ -33,71 +19,51 @@ kb, base,
|
|
|
33
19
|
*/
|
|
34
20
|
contentType, callback, options) {
|
|
35
21
|
base = base || (target === null || target === void 0 ? void 0 : target.value);
|
|
36
|
-
|
|
22
|
+
const opts = options || {};
|
|
37
23
|
contentType = contentType || _types.TurtleContentType; // text/n3 if complex?
|
|
38
|
-
|
|
39
24
|
var documentString = undefined;
|
|
40
|
-
|
|
41
25
|
try {
|
|
42
26
|
var sz = (0, _serializer.default)(kb);
|
|
43
27
|
if (opts.flags) sz.setFlags(opts.flags);
|
|
44
28
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, target);
|
|
45
|
-
var n3String; // If an IndexedFormula, use the namespaces from the given graph as suggestions
|
|
46
29
|
|
|
30
|
+
// If an IndexedFormula, use the namespaces from the given graph as suggestions
|
|
47
31
|
if ('namespaces' in kb) {
|
|
48
32
|
sz.suggestNamespaces(kb.namespaces);
|
|
49
|
-
}
|
|
50
|
-
|
|
33
|
+
}
|
|
51
34
|
|
|
35
|
+
// use the provided options.namespaces are mandatory prefixes
|
|
52
36
|
if (opts.namespaces) {
|
|
53
37
|
sz.setNamespaces(opts.namespaces);
|
|
54
38
|
}
|
|
55
|
-
|
|
56
39
|
sz.setBase(base);
|
|
57
|
-
|
|
58
40
|
switch (contentType) {
|
|
59
41
|
case _types.RDFXMLContentType:
|
|
60
42
|
documentString = sz.statementsToXML(newSts);
|
|
61
43
|
return executeCallback(null, documentString);
|
|
62
|
-
|
|
63
44
|
case _types.N3ContentType:
|
|
64
45
|
case _types.N3LegacyContentType:
|
|
65
46
|
documentString = sz.statementsToN3(newSts);
|
|
66
47
|
return executeCallback(null, documentString);
|
|
67
|
-
|
|
68
48
|
case _types.TurtleContentType:
|
|
69
49
|
case _types.TurtleLegacyContentType:
|
|
70
50
|
sz.setFlags('si'); // Suppress = for sameAs and => for implies
|
|
71
|
-
|
|
72
51
|
documentString = sz.statementsToN3(newSts);
|
|
73
52
|
return executeCallback(null, documentString);
|
|
74
|
-
|
|
75
53
|
case _types.NTriplesContentType:
|
|
76
54
|
sz.setFlags('deinprstux'); // Suppress nice parts of N3 to make ntriples
|
|
77
|
-
|
|
78
55
|
documentString = sz.statementsToNTriples(newSts);
|
|
79
56
|
return executeCallback(null, documentString);
|
|
80
|
-
|
|
81
57
|
case _types.JSONLDContentType:
|
|
82
|
-
sz.setFlags('
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
convert.convertToJson(n3String, callback);
|
|
87
|
-
break;
|
|
88
|
-
|
|
58
|
+
sz.setFlags('si'); // use turtle parameters
|
|
59
|
+
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
60
|
+
return executeCallback(null, documentString);
|
|
89
61
|
case _types.NQuadsContentType:
|
|
90
62
|
case _types.NQuadsAltContentType:
|
|
91
63
|
// @@@ just outpout the quads? Does not work for collections
|
|
92
64
|
sz.setFlags('deinprstux q'); // Suppress nice parts of N3 to make ntriples
|
|
93
|
-
|
|
94
65
|
documentString = sz.statementsToNTriples(newSts); // q in flag means actually quads
|
|
95
|
-
|
|
96
66
|
return executeCallback(null, documentString);
|
|
97
|
-
// n3String = sz.statementsToN3(newSts)
|
|
98
|
-
// documentString = convert.convertToNQuads(n3String, callback)
|
|
99
|
-
// break
|
|
100
|
-
|
|
101
67
|
default:
|
|
102
68
|
throw new Error('Serialize: Content-type ' + contentType + ' not supported for data write.');
|
|
103
69
|
}
|
|
@@ -106,7 +72,6 @@ contentType, callback, options) {
|
|
|
106
72
|
// @ts-ignore
|
|
107
73
|
return callback(err, undefined);
|
|
108
74
|
}
|
|
109
|
-
|
|
110
75
|
throw err; // Don't hide problems from caller in sync mode
|
|
111
76
|
}
|
|
112
77
|
|