rdflib 2.2.22-4e175603 → 2.2.22-53d65d90

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.
Files changed (95) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +4 -0
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +90 -61
  5. package/esm/class-order.js +1 -1
  6. package/esm/collection.js +106 -70
  7. package/esm/default-graph.js +33 -13
  8. package/esm/empty.js +26 -8
  9. package/esm/factories/canonical-data-factory.js +30 -33
  10. package/esm/factories/extended-term-factory.js +14 -18
  11. package/esm/factories/factory-types.js +1 -1
  12. package/esm/factories/rdflib-data-factory.js +11 -9
  13. package/esm/fetcher.js +1644 -1355
  14. package/esm/formula.js +740 -632
  15. package/esm/index.js +51 -31
  16. package/esm/jsonldparser.js +26 -19
  17. package/esm/jsonparser.js +1 -1
  18. package/esm/lists.js +86 -38
  19. package/esm/literal.js +157 -120
  20. package/esm/log.js +7 -7
  21. package/esm/n3parser.js +1085 -1008
  22. package/esm/named-node.js +99 -69
  23. package/esm/namespace.js +4 -2
  24. package/esm/node-internal.js +98 -74
  25. package/esm/node.js +1 -1
  26. package/esm/parse.js +3 -3
  27. package/esm/patch-parser.js +1 -1
  28. package/esm/query.js +16 -15
  29. package/esm/rdfaparser.js +846 -781
  30. package/esm/rdfxmlparser.js +365 -348
  31. package/esm/serialize.js +4 -20
  32. package/esm/serializer.js +886 -821
  33. package/esm/statement.js +72 -52
  34. package/esm/store.js +924 -822
  35. package/esm/types.js +21 -21
  36. package/esm/update-manager.js +983 -882
  37. package/esm/updates-via.js +134 -104
  38. package/esm/uri.js +3 -3
  39. package/esm/utils/default-graph-uri.js +2 -2
  40. package/esm/utils/terms.js +5 -4
  41. package/esm/utils-js.js +5 -5
  42. package/esm/utils.js +6 -6
  43. package/esm/variable.js +58 -32
  44. package/esm/xsd.js +2 -2
  45. package/lib/blank-node.js +88 -60
  46. package/lib/class-order.js +1 -1
  47. package/lib/collection.js +104 -69
  48. package/lib/default-graph.js +32 -13
  49. package/lib/empty.js +25 -8
  50. package/lib/factories/canonical-data-factory.js +32 -35
  51. package/lib/factories/extended-term-factory.js +14 -18
  52. package/lib/factories/factory-types.js +1 -1
  53. package/lib/factories/rdflib-data-factory.js +11 -9
  54. package/lib/fetcher.js +1646 -1385
  55. package/lib/formula.d.ts +1 -1
  56. package/lib/formula.js +739 -632
  57. package/lib/index.js +87 -66
  58. package/lib/jsonldparser.js +26 -19
  59. package/lib/jsonparser.js +1 -1
  60. package/lib/lists.js +86 -54
  61. package/lib/literal.js +156 -120
  62. package/lib/log.js +7 -7
  63. package/lib/n3parser.js +1089 -1010
  64. package/lib/named-node.js +98 -69
  65. package/lib/namespace.js +4 -2
  66. package/lib/node-internal.js +96 -73
  67. package/lib/node.js +1 -1
  68. package/lib/parse.js +6 -5
  69. package/lib/patch-parser.js +1 -1
  70. package/lib/query.js +18 -19
  71. package/lib/rdfaparser.js +848 -783
  72. package/lib/rdfxmlparser.js +366 -350
  73. package/lib/serialize.d.ts +1 -1
  74. package/lib/serialize.js +4 -21
  75. package/lib/serializer.d.ts +1 -0
  76. package/lib/serializer.js +890 -825
  77. package/lib/statement.js +74 -54
  78. package/lib/store.d.ts +1 -1
  79. package/lib/store.js +926 -844
  80. package/lib/types.js +21 -21
  81. package/lib/update-manager.d.ts +1 -1
  82. package/lib/update-manager.js +959 -865
  83. package/lib/updates-via.js +134 -105
  84. package/lib/uri.js +3 -3
  85. package/lib/utils/default-graph-uri.js +2 -2
  86. package/lib/utils/terms.js +6 -4
  87. package/lib/utils-js.js +9 -8
  88. package/lib/utils.js +6 -6
  89. package/lib/variable.js +60 -34
  90. package/lib/xsd.js +2 -2
  91. package/package.json +6 -6
  92. package/src/jsonldparser.js +1 -1
  93. package/src/serialize.ts +4 -14
  94. package/src/serializer.js +24 -0
  95. package/src/update-manager.ts +8 -2
@@ -23,4 +23,4 @@ contentType?: string | ContentType, callback?: (err: Error | undefined | null, r
23
23
  * A set of [prefix, uri] pairs that define namespace prefixes
24
24
  */
25
25
  namespaces?: Record<string, string>;
26
- }): string | undefined;
26
+ }): string | undefined | Promise<string>;
package/lib/serialize.js CHANGED
@@ -7,9 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = serialize;
8
8
  var _serializer = _interopRequireDefault(require("./serializer"));
9
9
  var _types = require("./types");
10
- var jsonld = _interopRequireWildcard(require("jsonld"));
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; }
13
10
  /**
14
11
  * Serialize to the appropriate format
15
12
  */
@@ -22,14 +19,13 @@ kb, base,
22
19
  */
23
20
  contentType, callback, options) {
24
21
  base = base || (target === null || target === void 0 ? void 0 : target.value);
25
- const opts = options || {};
22
+ var opts = options || {};
26
23
  contentType = contentType || _types.TurtleContentType; // text/n3 if complex?
27
24
  var documentString = undefined;
28
25
  try {
29
26
  var sz = (0, _serializer.default)(kb);
30
27
  if (opts.flags) sz.setFlags(opts.flags);
31
28
  var newSts = kb.statementsMatching(undefined, undefined, undefined, target);
32
- var n3String;
33
29
 
34
30
  // If an IndexedFormula, use the namespaces from the given graph as suggestions
35
31
  if ('namespaces' in kb) {
@@ -59,10 +55,9 @@ contentType, callback, options) {
59
55
  documentString = sz.statementsToNTriples(newSts);
60
56
  return executeCallback(null, documentString);
61
57
  case _types.JSONLDContentType:
62
- sz.setFlags('deinprstux'); // Use adapters to connect to incmpatible parser
63
- n3String = sz.statementsToNTriples(newSts);
64
- // n3String = sz.statementsToN3(newSts)
65
- return toJsonld(n3String);
58
+ sz.setFlags('si'); // use turtle parameters
59
+ documentString = sz.statementsToJsonld(newSts); // convert via turtle
60
+ return executeCallback(null, documentString);
66
61
  case _types.NQuadsContentType:
67
62
  case _types.NQuadsAltContentType:
68
63
  // @@@ just outpout the quads? Does not work for collections
@@ -88,16 +83,4 @@ contentType, callback, options) {
88
83
  return result;
89
84
  }
90
85
  }
91
- function toJsonld(item) {
92
- try {
93
- return jsonld.fromRDF(item, {
94
- format: 'application/n-quads'
95
- }).then(docJsonld => {
96
- return JSON.stringify(docJsonld);
97
- });
98
- // return JSON.stringify(await jsonld.fromRDF(item, {format: 'application/n-quads'}))
99
- } catch (e) {
100
- throw e;
101
- }
102
- }
103
86
  }
@@ -63,5 +63,6 @@ export class Serializer {
63
63
  symbolToN3(x: any): any;
64
64
  writeStore(write: any): void;
65
65
  statementsToXML(sts: any): string;
66
+ statementsToJsonld(sts: any): string;
66
67
  }
67
68
  import NamedNode from "./named-node";