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.
Files changed (106) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +9 -1
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +61 -114
  5. package/esm/class-order.js +1 -1
  6. package/esm/collection.js +70 -128
  7. package/esm/convert.js +1 -2
  8. package/esm/default-graph.js +14 -48
  9. package/esm/empty.js +8 -39
  10. package/esm/factories/canonical-data-factory.js +33 -65
  11. package/esm/factories/extended-term-factory.js +18 -25
  12. package/esm/factories/factory-types.js +3 -2
  13. package/esm/factories/rdflib-data-factory.js +9 -19
  14. package/esm/fetcher.js +1341 -1854
  15. package/esm/formula.js +639 -846
  16. package/esm/index.js +40 -76
  17. package/esm/jsonldparser.js +24 -49
  18. package/esm/jsonparser.js +1 -8
  19. package/esm/lists.js +47 -110
  20. package/esm/literal.js +120 -189
  21. package/esm/log.js +7 -7
  22. package/esm/n3parser.js +1015 -1412
  23. package/esm/named-node.js +70 -119
  24. package/esm/namespace.js +2 -5
  25. package/esm/node-internal.js +73 -110
  26. package/esm/node.js +2 -7
  27. package/esm/parse.js +12 -19
  28. package/esm/patch-parser.js +10 -30
  29. package/esm/query-to-sparql.js +0 -18
  30. package/esm/query.js +63 -147
  31. package/esm/rdfaparser.js +794 -997
  32. package/esm/rdfxmlparser.js +347 -461
  33. package/esm/serialize.js +9 -27
  34. package/esm/serializer.js +820 -1049
  35. package/esm/sparql-to-query.js +44 -134
  36. package/esm/statement.js +54 -85
  37. package/esm/store.js +830 -1103
  38. package/esm/types.js +22 -21
  39. package/esm/update-manager.js +869 -1106
  40. package/esm/updates-via.js +104 -161
  41. package/esm/uri.js +9 -53
  42. package/esm/utils/default-graph-uri.js +3 -2
  43. package/esm/utils/termValue.js +0 -1
  44. package/esm/utils/terms.js +19 -21
  45. package/esm/utils-js.js +20 -61
  46. package/esm/utils.js +10 -21
  47. package/esm/variable.js +32 -78
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +60 -113
  50. package/lib/class-order.js +1 -2
  51. package/lib/collection.js +69 -131
  52. package/lib/convert.js +3 -9
  53. package/lib/default-graph.js +13 -52
  54. package/lib/empty.js +8 -43
  55. package/lib/factories/canonical-data-factory.js +35 -79
  56. package/lib/factories/extended-term-factory.js +18 -32
  57. package/lib/factories/factory-types.d.ts +6 -6
  58. package/lib/factories/factory-types.js +1 -4
  59. package/lib/factories/rdflib-data-factory.js +9 -23
  60. package/lib/fetcher.d.ts +6 -6
  61. package/lib/fetcher.js +1370 -1843
  62. package/lib/formula.js +640 -855
  63. package/lib/index.js +66 -152
  64. package/lib/jsonldparser.js +23 -53
  65. package/lib/jsonparser.js +1 -10
  66. package/lib/lists.js +55 -112
  67. package/lib/literal.js +120 -195
  68. package/lib/log.d.ts +0 -6
  69. package/lib/log.js +7 -8
  70. package/lib/n3parser.js +1030 -1436
  71. package/lib/named-node.js +69 -126
  72. package/lib/namespace.js +2 -7
  73. package/lib/node-internal.js +74 -107
  74. package/lib/node.js +2 -12
  75. package/lib/parse.d.ts +1 -1
  76. package/lib/parse.js +12 -32
  77. package/lib/patch-parser.js +11 -34
  78. package/lib/query-to-sparql.js +0 -23
  79. package/lib/query.js +62 -167
  80. package/lib/rdfaparser.js +796 -1009
  81. package/lib/rdfxmlparser.js +349 -466
  82. package/lib/serialize.js +11 -37
  83. package/lib/serializer.js +823 -1064
  84. package/lib/sparql-to-query.js +42 -167
  85. package/lib/statement.js +55 -91
  86. package/lib/store.d.ts +1 -1
  87. package/lib/store.js +850 -1112
  88. package/lib/tf-types.d.ts +4 -4
  89. package/lib/types.d.ts +8 -8
  90. package/lib/types.js +23 -23
  91. package/lib/update-manager.d.ts +1 -1
  92. package/lib/update-manager.js +865 -1103
  93. package/lib/updates-via.js +105 -164
  94. package/lib/uri.js +8 -61
  95. package/lib/utils/default-graph-uri.js +3 -5
  96. package/lib/utils/termValue.js +0 -2
  97. package/lib/utils/terms.js +19 -40
  98. package/lib/utils-js.js +23 -88
  99. package/lib/utils.js +10 -27
  100. package/lib/variable.js +34 -85
  101. package/lib/xsd-internal.js +0 -3
  102. package/lib/xsd.js +2 -6
  103. package/package.json +35 -35
  104. package/src/fetcher.ts +2 -2
  105. package/src/update-manager.ts +12 -7
  106. package/changes.txt +0 -59
@@ -13,98 +13,78 @@ export default function sparqlUpdateParser(str, kb, base) {
13
13
  var SQNS = Namespace('http://www.w3.org/ns/pim/patch#');
14
14
  var p = N3Parser(kb, kb, base, base, null, null, '', null);
15
15
  var clauses = {};
16
-
17
- var badSyntax = function badSyntax(uri, lines, str, i, why) {
16
+ var badSyntax = function (uri, lines, str, i, why) {
18
17
  return 'Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\n ' + why + '\n at: "' + str.slice(i, i + 30) + '"';
19
- }; // var check = function (next, last, message) {
18
+ };
19
+
20
+ // var check = function (next, last, message) {
20
21
  // if (next < 0) {
21
22
  // throw badSyntax(p._thisDoc, p.lines, str, j, last, message)
22
23
  // }
23
24
  // return next
24
25
  // }
25
-
26
-
27
26
  i = 0;
28
27
  var query = kb.sym(base + '#query'); // Invent a URI for the query
29
-
30
28
  clauses['query'] = query; // A way of accessing it in its N3 model.
31
29
 
32
30
  while (true) {
33
31
  // console.log("A Now at i = " + i)
34
32
  j = p.skipSpace(str, i);
35
-
36
33
  if (j < 0) {
37
34
  return clauses;
38
- } // console.log("B After space at j= " + j)
39
-
40
-
35
+ }
36
+ // console.log("B After space at j= " + j)
41
37
  if (str[j] === ';') {
42
38
  i = p.skipSpace(str, j + 1);
43
-
44
39
  if (i < 0) {
45
40
  return clauses; // Allow end in a
46
41
  }
47
42
 
48
43
  j = i;
49
44
  }
50
-
51
45
  var found = false;
52
-
53
46
  for (k = 0; k < keywords.length; k++) {
54
47
  var key = keywords[k];
55
-
56
48
  if (str.slice(j, j + key.length) === key) {
57
49
  i = p.skipSpace(str, j + key.length);
58
-
59
50
  if (i < 0) {
60
51
  throw badSyntax(p._thisDoc, p.lines, str, j + key.length, 'found EOF, needed {...} after ' + key);
61
52
  }
62
-
63
53
  if ((key === 'INSERT' || key === 'DELETE') && str.slice(i, i + 4) === 'DATA') {
64
54
  // Some wanted 'DATA'. Whatever
65
55
  j = p.skipSpace(str, i + 4);
66
-
67
56
  if (j < 0) {
68
57
  throw badSyntax(p._thisDoc, p.lines, str, i + 4, 'needed {...} after INSERT DATA ' + key);
69
58
  }
70
-
71
59
  i = j;
72
60
  }
73
-
74
61
  var res2 = [];
75
62
  j = p.node(str, i, res2); // Parse all the complexity of the clause
76
63
 
77
64
  if (j < 0) {
78
65
  throw badSyntax(p._thisDoc, p.lines, str, i, 'bad syntax or EOF in {...} after ' + key);
79
66
  }
80
-
81
67
  clauses[key.toLowerCase()] = res2[0];
82
68
  kb.add(query, SQNS(key.toLowerCase()), res2[0]); // , kb.sym(base)
83
69
  // key is the keyword and res2 has the contents
84
-
85
70
  found = true;
86
71
  i = j;
87
72
  }
88
73
  }
89
-
90
74
  if (!found && str.slice(j, j + 7) === '@prefix') {
91
75
  i = p.directive(str, j);
92
-
93
76
  if (i < 0) {
94
77
  throw badSyntax(p._thisDoc, p.lines, str, i, 'bad syntax or EOF after @prefix ');
95
- } // console.log("P before dot i= " + i)
96
-
97
-
98
- i = p.checkDot(str, i); // console.log("Q after dot i= " + i)
99
-
78
+ }
79
+ // console.log("P before dot i= " + i)
80
+ i = p.checkDot(str, i);
81
+ // console.log("Q after dot i= " + i)
100
82
  found = true;
101
83
  }
102
-
103
84
  if (!found) {
104
85
  // console.log("Bad syntax " + j)
105
86
  throw badSyntax(p._thisDoc, p.lines, str, j, "Unknown syntax at start of statememt: '" + str.slice(j).slice(0, 20) + "'");
106
87
  }
107
88
  } // while
108
89
  // return clauses
109
-
110
90
  }
@@ -1,44 +1,33 @@
1
1
  import log from './log';
2
2
  export default function queryToSPARQL(query) {
3
3
  var indent = 0;
4
-
5
4
  function getSelect(query) {
6
5
  var str = addIndent() + 'SELECT ';
7
-
8
6
  for (var i = 0; i < query.vars.length; i++) {
9
7
  str += query.vars[i] + ' ';
10
8
  }
11
-
12
9
  str += '\n';
13
10
  return str;
14
11
  }
15
-
16
12
  function getPattern(pat) {
17
13
  var str = '';
18
14
  var st = pat.statements;
19
-
20
15
  for (var x in st) {
21
16
  log.debug('Found statement: ' + st);
22
17
  str += addIndent() + st[x] + '\n';
23
18
  }
24
-
25
19
  return str;
26
20
  }
27
-
28
21
  function getConstraints(pat) {
29
22
  var str = '';
30
-
31
23
  for (var v in pat.constraints) {
32
24
  var foo = pat.constraints[v];
33
25
  str += addIndent() + 'FILTER ( ' + foo.describe(v) + ' ) ' + '\n';
34
26
  }
35
-
36
27
  return str;
37
28
  }
38
-
39
29
  function getOptionals(pat) {
40
30
  var str = '';
41
-
42
31
  for (var x = 0; x < pat.optional.length; x++) {
43
32
  // alert(pat.optional.termType)
44
33
  log.debug('Found optional query');
@@ -50,10 +39,8 @@ export default function queryToSPARQL(query) {
50
39
  indent--;
51
40
  str += addIndent() + '}' + '\n';
52
41
  }
53
-
54
42
  return str;
55
43
  }
56
-
57
44
  function getWhere(pat) {
58
45
  var str = addIndent() + 'WHERE \n' + '{ \n';
59
46
  indent++;
@@ -64,20 +51,15 @@ export default function queryToSPARQL(query) {
64
51
  str += '}';
65
52
  return str;
66
53
  }
67
-
68
54
  function addIndent() {
69
55
  var str = '';
70
-
71
56
  for (var i = 0; i < indent; i++) {
72
57
  str += ' ';
73
58
  }
74
-
75
59
  return str;
76
60
  }
77
-
78
61
  function getSPARQL(query) {
79
62
  return getSelect(query) + getWhere(query.pat);
80
63
  }
81
-
82
64
  return getSPARQL(query);
83
65
  }