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
package/lib/rdfaparser.js CHANGED
@@ -1,43 +1,32 @@
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.parseRDFaDOM = exports.default = void 0;
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
8
  var _blankNode = _interopRequireDefault(require("./blank-node"));
17
-
18
9
  var _literal = _interopRequireDefault(require("./literal"));
19
-
20
10
  var _namedNode = _interopRequireDefault(require("./named-node"));
21
-
22
11
  var Uri = _interopRequireWildcard(require("./uri"));
23
-
24
12
  var Util = _interopRequireWildcard(require("./utils-js"));
25
-
26
13
  var _canonicalDataFactory = _interopRequireDefault(require("./factories/canonical-data-factory"));
27
-
28
- 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); }
29
-
30
- 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; }
31
-
14
+ 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); }
15
+ 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; }
32
16
  // RDFa Parser for rdflib.js
17
+
33
18
  // Originally by: Alex Milowski
34
19
  // From https://github.com/alexmilowski/green-turtle
35
20
  // Converted: timbl 2015-08-25 not yet working
36
21
  // Added wrapper: csarven 2016-05-09 working
22
+
37
23
  // RDFaProcessor.prototype = new Object() // Was URIResolver
24
+
38
25
  // RDFaProcessor.prototype.constructor=RDFaProcessor
26
+
39
27
  // options.base = base URI not really an option, shopuld always be set.
40
28
  //
29
+
41
30
  if (typeof Node === 'undefined') {
42
31
  // @@@@@@ Global. Interface to xmldom.
43
32
  var Node = {
@@ -55,10 +44,8 @@ if (typeof Node === 'undefined') {
55
44
  NOTATION_NODE: 12
56
45
  };
57
46
  }
58
-
59
- var RDFaProcessor = /*#__PURE__*/function () {
60
- function RDFaProcessor(kb, options) {
61
- (0, _classCallCheck2.default)(this, RDFaProcessor);
47
+ class RDFaProcessor {
48
+ constructor(kb, options) {
62
49
  this.options = options || {};
63
50
  this.kb = kb;
64
51
  this.target = options.target || {
@@ -67,10 +54,10 @@ var RDFaProcessor = /*#__PURE__*/function () {
67
54
  prefixes: {},
68
55
  terms: {}
69
56
  }
70
- }; // XXX: Added to track bnodes
71
-
72
- this.blankNodes = []; // XXX: Added for normalisation
73
-
57
+ };
58
+ // XXX: Added to track bnodes
59
+ this.blankNodes = [];
60
+ // XXX: Added for normalisation
74
61
  this.htmlOptions = {
75
62
  'selfClosing': 'br img input area base basefont col colgroup source wbr isindex link meta param hr'
76
63
  };
@@ -87,1104 +74,904 @@ var RDFaProcessor = /*#__PURE__*/function () {
87
74
  this.finishedHandlers = [];
88
75
  this.init();
89
76
  }
90
-
91
- (0, _createClass2.default)(RDFaProcessor, [{
92
- key: "addTriple",
93
- value: function addTriple(origin, subject, predicate, object) {
94
- var su, ob, pr, or;
95
-
96
- if (typeof subject === 'undefined') {
97
- su = _canonicalDataFactory.default.namedNode(this.options.base);
98
- } else {
99
- su = this.toRDFNodeObject(subject);
100
- }
101
-
102
- pr = this.toRDFNodeObject(predicate);
103
- ob = this.toRDFNodeObject(object);
104
- or = _canonicalDataFactory.default.namedNode(this.options.base); // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')
105
-
106
- this.kb.add(su, pr, ob, or);
77
+ addTriple(origin, subject, predicate, object) {
78
+ var su, ob, pr, or;
79
+ if (typeof subject === 'undefined') {
80
+ su = _canonicalDataFactory.default.namedNode(this.options.base);
81
+ } else {
82
+ su = this.toRDFNodeObject(subject);
107
83
  }
108
- }, {
109
- key: "ancestorPath",
110
- value: function ancestorPath(node) {
111
- var path = '';
112
-
113
- while (node && node.nodeType !== Node.DOCUMENT_NODE) {
114
- path = '/' + node.localName + path;
115
- node = node.parentNode;
116
- }
117
-
118
- return path;
84
+ pr = this.toRDFNodeObject(predicate);
85
+ ob = this.toRDFNodeObject(object);
86
+ or = _canonicalDataFactory.default.namedNode(this.options.base);
87
+ // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')
88
+ this.kb.add(su, pr, ob, or);
89
+ }
90
+ ancestorPath(node) {
91
+ var path = '';
92
+ while (node && node.nodeType !== Node.DOCUMENT_NODE) {
93
+ path = '/' + node.localName + path;
94
+ node = node.parentNode;
119
95
  }
120
- }, {
121
- key: "copyMappings",
122
- value: function copyMappings(mappings) {
123
- var newMappings = {};
124
-
125
- for (var k in mappings) {
126
- newMappings[k] = mappings[k];
96
+ return path;
97
+ }
98
+ copyMappings(mappings) {
99
+ var newMappings = {};
100
+ for (var k in mappings) {
101
+ newMappings[k] = mappings[k];
102
+ }
103
+ return newMappings;
104
+ }
105
+ copyProperties() {}
106
+ deriveDateTimeType(value) {
107
+ for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {
108
+ // console.log("Checking "+value+" against "+RDFaProcessor.dateTimeTypes[i].type)
109
+ var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value);
110
+ if (matched && matched[0].length === value.length) {
111
+ // console.log("Matched!")
112
+ return RDFaProcessor.dateTimeTypes[i].type;
127
113
  }
128
-
129
- return newMappings;
130
114
  }
131
- }, {
132
- key: "copyProperties",
133
- value: function copyProperties() {}
134
- }, {
135
- key: "deriveDateTimeType",
136
- value: function deriveDateTimeType(value) {
137
- for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {
138
- // console.log("Checking "+value+" against "+RDFaProcessor.dateTimeTypes[i].type)
139
- var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value);
140
-
141
- if (matched && matched[0].length === value.length) {
142
- // console.log("Matched!")
143
- return RDFaProcessor.dateTimeTypes[i].type;
115
+ return null;
116
+ }
117
+ init() {}
118
+ newBlankNode() {
119
+ this.blankCounter++;
120
+ return '_:' + this.blankCounter;
121
+ }
122
+ newSubjectOrigin(origin, subject) {}
123
+ parseCURIE(value, prefixes, base) {
124
+ var colon = value.indexOf(':');
125
+ var uri;
126
+ if (colon >= 0) {
127
+ var prefix = value.substring(0, colon);
128
+ if (prefix === '') {
129
+ // default prefix
130
+ uri = prefixes[''];
131
+ return uri ? uri + value.substring(colon + 1) : null;
132
+ } else if (prefix === '_') {
133
+ // blank node
134
+ return '_:' + value.substring(colon + 1);
135
+ } else if (RDFaProcessor.NCNAME.test(prefix)) {
136
+ uri = prefixes[prefix];
137
+ if (uri) {
138
+ return uri + value.substring(colon + 1);
144
139
  }
145
140
  }
146
-
147
- return null;
148
141
  }
149
- }, {
150
- key: "init",
151
- value: function init() {}
152
- }, {
153
- key: "newBlankNode",
154
- value: function newBlankNode() {
155
- this.blankCounter++;
156
- return '_:' + this.blankCounter;
142
+ return null;
143
+ }
144
+ parseCURIEOrURI(value, prefixes, base) {
145
+ var curie = this.parseCURIE(value, prefixes, base);
146
+ if (curie) {
147
+ return curie;
157
148
  }
158
- }, {
159
- key: "newSubjectOrigin",
160
- value: function newSubjectOrigin(origin, subject) {}
161
- }, {
162
- key: "parseCURIE",
163
- value: function parseCURIE(value, prefixes, base) {
164
- var colon = value.indexOf(':');
165
- var uri;
166
-
167
- if (colon >= 0) {
168
- var prefix = value.substring(0, colon);
169
-
170
- if (prefix === '') {
171
- // default prefix
172
- uri = prefixes[''];
173
- return uri ? uri + value.substring(colon + 1) : null;
174
- } else if (prefix === '_') {
175
- // blank node
176
- return '_:' + value.substring(colon + 1);
177
- } else if (RDFaProcessor.NCNAME.test(prefix)) {
178
- uri = prefixes[prefix];
179
-
180
- if (uri) {
181
- return uri + value.substring(colon + 1);
182
- }
183
- }
184
- }
185
-
149
+ return this.resolveAndNormalize(base, value);
150
+ }
151
+ parsePredicate(value, defaultVocabulary, terms, prefixes, base, ignoreTerms) {
152
+ if (value === '') {
186
153
  return null;
187
154
  }
188
- }, {
189
- key: "parseCURIEOrURI",
190
- value: function parseCURIEOrURI(value, prefixes, base) {
191
- var curie = this.parseCURIE(value, prefixes, base);
192
-
193
- if (curie) {
194
- return curie;
195
- }
196
-
197
- return this.resolveAndNormalize(base, value);
155
+ var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base);
156
+ if (predicate && predicate.indexOf('_:') === 0) {
157
+ return null;
198
158
  }
199
- }, {
200
- key: "parsePredicate",
201
- value: function parsePredicate(value, defaultVocabulary, terms, prefixes, base, ignoreTerms) {
202
- if (value === '') {
203
- return null;
159
+ return predicate;
160
+ }
161
+ parsePrefixMappings(str, target) {
162
+ var values = this.tokenize(str);
163
+ var prefix = null;
164
+ // var uri = null
165
+ for (var i = 0; i < values.length; i++) {
166
+ if (values[i][values[i].length - 1] === ':') {
167
+ prefix = values[i].substring(0, values[i].length - 1);
168
+ } else if (prefix) {
169
+ target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i];
170
+ prefix = null;
204
171
  }
172
+ }
173
+ }
174
+ static parseRDFaDOM(dom, kb, base) {
175
+ var p = new RDFaProcessor(kb, {
176
+ 'base': base
177
+ });
178
+ // Cannot assign to read only property 'baseURI' of object '#<XMLDocument>':
179
+ if (!dom.baseURI) {
180
+ // Note this became a read-only attribute some time before 2018
181
+ dom.baseURI = base; // oinly set if not already set
182
+ }
205
183
 
206
- var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base);
207
-
208
- if (predicate && predicate.indexOf('_:') === 0) {
184
+ p.process(dom, {
185
+ baseURI: base
186
+ });
187
+ }
188
+ parseSafeCURIEOrCURIEOrURI(value, prefixes, base) {
189
+ value = this.trim(value);
190
+ if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {
191
+ value = value.substring(1, value.length - 1);
192
+ value = value.trim(value);
193
+ if (value.length === 0) {
209
194
  return null;
210
195
  }
211
-
212
- return predicate;
213
- }
214
- }, {
215
- key: "parsePrefixMappings",
216
- value: function parsePrefixMappings(str, target) {
217
- var values = this.tokenize(str);
218
- var prefix = null; // var uri = null
219
-
220
- for (var i = 0; i < values.length; i++) {
221
- if (values[i][values[i].length - 1] === ':') {
222
- prefix = values[i].substring(0, values[i].length - 1);
223
- } else if (prefix) {
224
- target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i];
225
- prefix = null;
226
- }
196
+ if (value === '_:') {
197
+ // the one node
198
+ return this.theOne;
227
199
  }
200
+ return this.parseCURIE(value, prefixes, base);
201
+ } else {
202
+ return this.parseCURIEOrURI(value, prefixes, base);
228
203
  }
229
- }, {
230
- key: "parseSafeCURIEOrCURIEOrURI",
231
- value: function parseSafeCURIEOrCURIEOrURI(value, prefixes, base) {
232
- value = this.trim(value);
233
-
234
- if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {
235
- value = value.substring(1, value.length - 1);
236
- value = value.trim(value);
237
-
238
- if (value.length === 0) {
239
- return null;
240
- }
241
-
242
- if (value === '_:') {
243
- // the one node
244
- return this.theOne;
245
- }
246
-
247
- return this.parseCURIE(value, prefixes, base);
248
- } else {
249
- return this.parseCURIEOrURI(value, prefixes, base);
204
+ }
205
+ parseTermOrCURIEOrAbsURI(value, defaultVocabulary, terms, prefixes, base) {
206
+ // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
207
+ value = this.trim(value);
208
+ var curie = this.parseCURIE(value, prefixes, base);
209
+ if (curie) {
210
+ return curie;
211
+ } else if (terms) {
212
+ if (defaultVocabulary && !this.absURIRE.exec(value)) {
213
+ return defaultVocabulary + value;
250
214
  }
251
- }
252
- }, {
253
- key: "parseTermOrCURIEOrAbsURI",
254
- value: function parseTermOrCURIEOrAbsURI(value, defaultVocabulary, terms, prefixes, base) {
255
- // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
256
- value = this.trim(value);
257
- var curie = this.parseCURIE(value, prefixes, base);
258
-
259
- if (curie) {
260
- return curie;
261
- } else if (terms) {
262
- if (defaultVocabulary && !this.absURIRE.exec(value)) {
263
- return defaultVocabulary + value;
264
- }
265
-
266
- var term = terms[value];
267
-
268
- if (term) {
269
- return term;
270
- }
271
-
272
- var lcvalue = value.toLowerCase();
273
- term = terms[lcvalue];
274
-
275
- if (term) {
276
- return term;
277
- }
215
+ var term = terms[value];
216
+ if (term) {
217
+ return term;
278
218
  }
279
-
280
- if (this.absURIRE.exec(value)) {
281
- return this.resolveAndNormalize(base, value);
219
+ var lcvalue = value.toLowerCase();
220
+ term = terms[lcvalue];
221
+ if (term) {
222
+ return term;
282
223
  }
283
-
284
- return null;
285
224
  }
286
- }, {
287
- key: "parseTermOrCURIEOrURI",
288
- value: function parseTermOrCURIEOrURI(value, defaultVocabulary, terms, prefixes, base) {
289
- // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
290
- value = this.trim(value);
291
- var curie = this.parseCURIE(value, prefixes, base);
292
-
293
- if (curie) {
294
- return curie;
295
- } else {
296
- var term = terms[value];
297
-
298
- if (term) {
299
- return term;
300
- }
301
-
302
- var lcvalue = value.toLowerCase();
303
- term = terms[lcvalue];
304
-
305
- if (term) {
306
- return term;
307
- }
308
-
309
- if (defaultVocabulary && !this.absURIRE.exec(value)) {
310
- return defaultVocabulary + value;
311
- }
312
- }
313
-
225
+ if (this.absURIRE.exec(value)) {
314
226
  return this.resolveAndNormalize(base, value);
315
227
  }
316
- }, {
317
- key: "parseURI",
318
- value: function parseURI(uri) {
319
- return uri; // We just use strings as URIs, not objects now.
228
+ return null;
229
+ }
230
+ parseTermOrCURIEOrURI(value, defaultVocabulary, terms, prefixes, base) {
231
+ // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
232
+ value = this.trim(value);
233
+ var curie = this.parseCURIE(value, prefixes, base);
234
+ if (curie) {
235
+ return curie;
236
+ } else {
237
+ var term = terms[value];
238
+ if (term) {
239
+ return term;
240
+ }
241
+ var lcvalue = value.toLowerCase();
242
+ term = terms[lcvalue];
243
+ if (term) {
244
+ return term;
245
+ }
246
+ if (defaultVocabulary && !this.absURIRE.exec(value)) {
247
+ return defaultVocabulary + value;
248
+ }
320
249
  }
321
- }, {
322
- key: "process",
323
- value: function process(node, options) {
324
- /*
325
- if (!window.console) {
326
- window.console = { log: function() {} }
327
- } */
328
- options = options || {};
329
- var base;
330
-
331
- if (node.nodeType === Node.DOCUMENT_NODE) {
332
- if (node.baseURI && !options.baseURI) {
333
- options.baseURI = node.baseURI; // be defensive as DOM implementations vary
334
- }
335
-
336
- base = node.baseURI;
337
- node = node.documentElement;
338
-
339
- if (!node.baseURI) {
340
- node.baseURI = base;
341
- }
250
+ return this.resolveAndNormalize(base, value);
251
+ }
252
+ parseURI(uri) {
253
+ return uri; // We just use strings as URIs, not objects now.
254
+ }
342
255
 
343
- this.setContext(node);
344
- } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {
345
- this.setContext(node);
256
+ process(node, options) {
257
+ /*
258
+ if (!window.console) {
259
+ window.console = { log: function() {} }
260
+ } */
261
+ options = options || {};
262
+ var base;
263
+ if (node.nodeType === Node.DOCUMENT_NODE) {
264
+ if (node.baseURI && !options.baseURI) {
265
+ options.baseURI = node.baseURI; // be defensive as DOM implementations vary
346
266
  }
347
267
 
348
- var queue = []; // Fix for Firefox that includes the hash in the base URI
349
-
350
- var removeHash = function removeHash(baseURI) {
351
- // Fix for undefined baseURI property
352
- if (!baseURI && options && options.baseURI) {
353
- return options.baseURI;
354
- }
355
-
356
- var hash = baseURI.indexOf('#');
357
-
358
- if (hash >= 0) {
359
- baseURI = baseURI.substring(0, hash);
360
- }
361
-
362
- if (options && options.baseURIMap) {
363
- baseURI = options.baseURIMap(baseURI);
268
+ base = node.baseURI;
269
+ node = node.documentElement;
270
+ if (!node.baseURI) {
271
+ node.baseURI = base;
272
+ }
273
+ this.setContext(node);
274
+ } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {
275
+ this.setContext(node);
276
+ }
277
+ var queue = [];
278
+ // Fix for Firefox that includes the hash in the base URI
279
+ var removeHash = function (baseURI) {
280
+ // Fix for undefined baseURI property
281
+ if (!baseURI && options && options.baseURI) {
282
+ return options.baseURI;
283
+ }
284
+ var hash = baseURI.indexOf('#');
285
+ if (hash >= 0) {
286
+ baseURI = baseURI.substring(0, hash);
287
+ }
288
+ if (options && options.baseURIMap) {
289
+ baseURI = options.baseURIMap(baseURI);
290
+ }
291
+ return baseURI;
292
+ };
293
+ queue.push({
294
+ current: node,
295
+ context: this.push(null, removeHash(node.baseURI))
296
+ });
297
+ while (queue.length > 0) {
298
+ var item = queue.shift();
299
+ if (item.parent) {
300
+ // Sequence Step 14: list triple generation
301
+ if (item.context.parent && item.context.parent.listMapping === item.listMapping) {
302
+ // Skip a child context with exactly the same mapping
303
+ continue;
364
304
  }
365
-
366
- return baseURI;
367
- };
368
-
369
- queue.push({
370
- current: node,
371
- context: this.push(null, removeHash(node.baseURI))
372
- });
373
-
374
- while (queue.length > 0) {
375
- var item = queue.shift();
376
-
377
- if (item.parent) {
378
- // Sequence Step 14: list triple generation
379
- if (item.context.parent && item.context.parent.listMapping === item.listMapping) {
380
- // Skip a child context with exactly the same mapping
381
- continue;
382
- } // console.log("Generating lists for "+item.subject+", tag "+item.parent.localName)
383
-
384
-
385
- for (var _predicate in item.listMapping) {
386
- var list = item.listMapping[_predicate];
387
-
388
- if (list.length === 0) {
389
- this.addTriple(item.parent, item.subject, _predicate, {
390
- type: RDFaProcessor.objectURI,
391
- value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
392
- });
393
- continue;
394
- }
395
-
396
- var bnodes = [];
397
-
398
- for (var _i = 0; _i < list.length; _i++) {
399
- bnodes.push(this.newBlankNode()); // this.newSubject(item.parent,bnodes[i])
400
- }
401
-
402
- for (var _i2 = 0; _i2 < bnodes.length; _i2++) {
403
- this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[_i2]);
404
- this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
405
- type: RDFaProcessor.objectURI,
406
- value: _i2 + 1 < bnodes.length ? bnodes[_i2 + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
407
- });
408
- }
409
-
410
- this.addTriple(item.parent, item.subject, _predicate, {
305
+ // console.log("Generating lists for "+item.subject+", tag "+item.parent.localName)
306
+ for (let predicate in item.listMapping) {
307
+ var list = item.listMapping[predicate];
308
+ if (list.length === 0) {
309
+ this.addTriple(item.parent, item.subject, predicate, {
411
310
  type: RDFaProcessor.objectURI,
412
- value: bnodes[0]
311
+ value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
413
312
  });
313
+ continue;
314
+ }
315
+ var bnodes = [];
316
+ for (let i = 0; i < list.length; i++) {
317
+ bnodes.push(this.newBlankNode());
318
+ // this.newSubject(item.parent,bnodes[i])
414
319
  }
415
320
 
416
- continue;
417
- }
418
-
419
- var current = item.current;
420
- var context = item.context; // console.log("Tag: "+current.localName+", listMapping="+JSON.stringify(context.listMapping))
421
- // Sequence Step 1
422
-
423
- var skip = false;
424
- var newSubject = null;
425
- var currentObjectResource = null;
426
- var typedResource = null;
427
- var prefixes = context.prefixes;
428
- var prefixesCopied = false;
429
- var incomplete = [];
430
- var listMapping = context.listMapping;
431
- var listMappingDifferent = !context.parent;
432
- var language = context.language;
433
- var vocabulary = context.vocabulary; // TODO: the "base" element may be used for HTML+RDFa 1.1
434
-
435
- base = this.parseURI(removeHash(current.baseURI));
436
- current.item = null; // Sequence Step 2: set the default vocabulary
437
-
438
- var vocabAtt = current.getAttributeNode('vocab');
439
-
440
- if (vocabAtt) {
441
- var value = this.trim(vocabAtt.value);
442
-
443
- if (value.length > 0) {
444
- vocabulary = value;
445
- var baseSubject = base.spec; // this.newSubject(current,baseSubject)
446
-
447
- this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', {
321
+ for (let i = 0; i < bnodes.length; i++) {
322
+ this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[i]);
323
+ this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
448
324
  type: RDFaProcessor.objectURI,
449
- value: vocabulary
325
+ value: i + 1 < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
450
326
  });
451
- } else {
452
- vocabulary = this.vocabulary;
453
327
  }
454
- } // Sequence Step 3: IRI mappings
455
- // handle xmlns attributes
456
-
457
-
458
- for (var i = 0; i < current.attributes.length; i++) {
459
- var att = current.attributes[i]; // if (att.namespaceURI=="http://www.w3.org/2000/xmlns/") {
460
-
461
- if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {
462
- if (!prefixesCopied) {
463
- prefixes = this.copyMappings(prefixes);
464
- prefixesCopied = true;
465
- }
466
-
467
- var prefix = att.nodeName.substring(6); // TODO: resolve relative?
468
-
469
- var ref = RDFaProcessor.trim(att.value);
470
- prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref;
471
- }
472
- } // Handle prefix mappings (@prefix)
473
-
474
-
475
- var prefixAtt = current.getAttributeNode('prefix');
476
-
477
- if (prefixAtt) {
328
+ this.addTriple(item.parent, item.subject, predicate, {
329
+ type: RDFaProcessor.objectURI,
330
+ value: bnodes[0]
331
+ });
332
+ }
333
+ continue;
334
+ }
335
+ var current = item.current;
336
+ var context = item.context;
337
+ // console.log("Tag: "+current.localName+", listMapping="+JSON.stringify(context.listMapping))
338
+ // Sequence Step 1
339
+ var skip = false;
340
+ var newSubject = null;
341
+ var currentObjectResource = null;
342
+ var typedResource = null;
343
+ var prefixes = context.prefixes;
344
+ var prefixesCopied = false;
345
+ var incomplete = [];
346
+ var listMapping = context.listMapping;
347
+ var listMappingDifferent = !context.parent;
348
+ var language = context.language;
349
+ var vocabulary = context.vocabulary;
350
+ // TODO: the "base" element may be used for HTML+RDFa 1.1
351
+ base = this.parseURI(removeHash(current.baseURI));
352
+ current.item = null;
353
+ // Sequence Step 2: set the default vocabulary
354
+ var vocabAtt = current.getAttributeNode('vocab');
355
+ if (vocabAtt) {
356
+ let value = this.trim(vocabAtt.value);
357
+ if (value.length > 0) {
358
+ vocabulary = value;
359
+ var baseSubject = base.spec;
360
+ // this.newSubject(current,baseSubject)
361
+ this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', {
362
+ type: RDFaProcessor.objectURI,
363
+ value: vocabulary
364
+ });
365
+ } else {
366
+ vocabulary = this.vocabulary;
367
+ }
368
+ }
369
+ // Sequence Step 3: IRI mappings
370
+ // handle xmlns attributes
371
+ for (var i = 0; i < current.attributes.length; i++) {
372
+ var att = current.attributes[i];
373
+ // if (att.namespaceURI=="http://www.w3.org/2000/xmlns/") {
374
+ if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {
478
375
  if (!prefixesCopied) {
479
376
  prefixes = this.copyMappings(prefixes);
480
377
  prefixesCopied = true;
481
378
  }
482
-
483
- this.parsePrefixMappings(prefixAtt.value, prefixes);
484
- } // Sequence Step 4: language
485
-
486
-
487
- var xmlLangAtt = null;
488
-
489
- for (var _i3 = 0; !xmlLangAtt && _i3 < this.langAttributes.length; _i3++) {
490
- xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[_i3].namespaceURI, this.langAttributes[_i3].localName);
379
+ var prefix = att.nodeName.substring(6);
380
+ // TODO: resolve relative?
381
+ var ref = RDFaProcessor.trim(att.value);
382
+ prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref;
491
383
  }
492
-
493
- if (xmlLangAtt) {
494
- var _value = RDFaProcessor.trim(xmlLangAtt.value);
495
-
496
- if (_value.length > 0) {
497
- language = _value;
498
- } else {
499
- language = null;
500
- }
384
+ }
385
+ // Handle prefix mappings (@prefix)
386
+ var prefixAtt = current.getAttributeNode('prefix');
387
+ if (prefixAtt) {
388
+ if (!prefixesCopied) {
389
+ prefixes = this.copyMappings(prefixes);
390
+ prefixesCopied = true;
501
391
  }
502
-
503
- var relAtt = current.getAttributeNode('rel');
504
- var revAtt = current.getAttributeNode('rev');
505
- var typeofAtt = current.getAttributeNode('typeof');
506
- var propertyAtt = current.getAttributeNode('property');
507
- var datatypeAtt = current.getAttributeNode('datatype');
508
- var datetimeAtt = this.inHTMLMode ? current.getAttributeNode('datetime') : null;
509
- var contentAtt = current.getAttributeNode('content');
510
- var aboutAtt = current.getAttributeNode('about');
511
- var srcAtt = current.getAttributeNode('src');
512
- var resourceAtt = current.getAttributeNode('resource');
513
- var hrefAtt = current.getAttributeNode('href');
514
- var inlistAtt = current.getAttributeNode('inlist');
515
- var relAttPredicates = [];
516
- var predicate, values;
517
-
518
- if (relAtt) {
519
- values = this.tokenize(relAtt.value);
520
-
521
- for (var _i4 = 0; _i4 < values.length; _i4++) {
522
- predicate = this.parsePredicate(values[_i4], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);
523
-
524
- if (predicate) {
525
- relAttPredicates.push(predicate);
526
- }
527
- }
392
+ this.parsePrefixMappings(prefixAtt.value, prefixes);
393
+ }
394
+ // Sequence Step 4: language
395
+ var xmlLangAtt = null;
396
+ for (let i = 0; !xmlLangAtt && i < this.langAttributes.length; i++) {
397
+ xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[i].namespaceURI, this.langAttributes[i].localName);
398
+ }
399
+ if (xmlLangAtt) {
400
+ let value = RDFaProcessor.trim(xmlLangAtt.value);
401
+ if (value.length > 0) {
402
+ language = value;
403
+ } else {
404
+ language = null;
528
405
  }
529
-
530
- var revAttPredicates = [];
531
-
532
- if (revAtt) {
533
- values = this.tokenize(revAtt.value);
534
-
535
- for (var _i5 = 0; _i5 < values.length; _i5++) {
536
- predicate = this.parsePredicate(values[_i5], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt);
537
-
538
- if (predicate) {
539
- revAttPredicates.push(predicate);
540
- }
406
+ }
407
+ var relAtt = current.getAttributeNode('rel');
408
+ var revAtt = current.getAttributeNode('rev');
409
+ var typeofAtt = current.getAttributeNode('typeof');
410
+ var propertyAtt = current.getAttributeNode('property');
411
+ var datatypeAtt = current.getAttributeNode('datatype');
412
+ var datetimeAtt = this.inHTMLMode ? current.getAttributeNode('datetime') : null;
413
+ var contentAtt = current.getAttributeNode('content');
414
+ var aboutAtt = current.getAttributeNode('about');
415
+ var srcAtt = current.getAttributeNode('src');
416
+ var resourceAtt = current.getAttributeNode('resource');
417
+ var hrefAtt = current.getAttributeNode('href');
418
+ var inlistAtt = current.getAttributeNode('inlist');
419
+ var relAttPredicates = [];
420
+ var predicate, values;
421
+ if (relAtt) {
422
+ values = this.tokenize(relAtt.value);
423
+ for (let i = 0; i < values.length; i++) {
424
+ predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);
425
+ if (predicate) {
426
+ relAttPredicates.push(predicate);
541
427
  }
542
- } // Section 3.1, bullet 7
543
-
544
-
545
- if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {
546
- if (relAttPredicates.length === 0) {
547
- relAtt = null;
428
+ }
429
+ }
430
+ var revAttPredicates = [];
431
+ if (revAtt) {
432
+ values = this.tokenize(revAtt.value);
433
+ for (let i = 0; i < values.length; i++) {
434
+ predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt);
435
+ if (predicate) {
436
+ revAttPredicates.push(predicate);
548
437
  }
549
-
550
- if (revAttPredicates.length === 0) {
551
- revAtt = null;
438
+ }
439
+ }
440
+ // Section 3.1, bullet 7
441
+ if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {
442
+ if (relAttPredicates.length === 0) {
443
+ relAtt = null;
444
+ }
445
+ if (revAttPredicates.length === 0) {
446
+ revAtt = null;
447
+ }
448
+ }
449
+ if (relAtt || revAtt) {
450
+ // Sequence Step 6: establish new subject and value
451
+ if (aboutAtt) {
452
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
453
+ }
454
+ if (typeofAtt) {
455
+ typedResource = newSubject;
456
+ }
457
+ if (!newSubject) {
458
+ if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
459
+ newSubject = removeHash(current.baseURI);
460
+ } else if (context.parentObject) {
461
+ // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI
462
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
552
463
  }
553
464
  }
554
-
555
- if (relAtt || revAtt) {
556
- // Sequence Step 6: establish new subject and value
557
- if (aboutAtt) {
558
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
465
+ if (resourceAtt) {
466
+ currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
467
+ }
468
+ if (!currentObjectResource) {
469
+ if (hrefAtt) {
470
+ currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
471
+ } else if (srcAtt) {
472
+ currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
473
+ } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {
474
+ currentObjectResource = this.newBlankNode();
559
475
  }
560
-
476
+ }
477
+ if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {
478
+ typedResource = newSubject;
479
+ } else if (typeofAtt && !aboutAtt) {
480
+ typedResource = currentObjectResource;
481
+ }
482
+ } else if (propertyAtt && !contentAtt && !datatypeAtt) {
483
+ // Sequence Step 5.1: establish a new subject
484
+ if (aboutAtt) {
485
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
561
486
  if (typeofAtt) {
562
487
  typedResource = newSubject;
563
488
  }
564
-
565
- if (!newSubject) {
566
- if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
567
- newSubject = removeHash(current.baseURI);
568
- } else if (context.parentObject) {
569
- // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI
570
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
571
- }
489
+ }
490
+ if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {
491
+ newSubject = removeHash(current.baseURI);
492
+ if (typeofAtt) {
493
+ typedResource = newSubject;
572
494
  }
573
-
495
+ } else if (!newSubject && context.parentObject) {
496
+ // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI
497
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
498
+ }
499
+ if (typeofAtt && !typedResource) {
574
500
  if (resourceAtt) {
575
- currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
501
+ typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
576
502
  }
577
-
578
- if (!currentObjectResource) {
579
- if (hrefAtt) {
580
- currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
581
- } else if (srcAtt) {
582
- currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
583
- } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {
584
- currentObjectResource = this.newBlankNode();
585
- }
503
+ if (!typedResource && hrefAtt) {
504
+ typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
586
505
  }
587
-
588
- if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {
506
+ if (!typedResource && srcAtt) {
507
+ typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
508
+ }
509
+ if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
589
510
  typedResource = newSubject;
590
- } else if (typeofAtt && !aboutAtt) {
591
- typedResource = currentObjectResource;
592
511
  }
593
- } else if (propertyAtt && !contentAtt && !datatypeAtt) {
594
- // Sequence Step 5.1: establish a new subject
595
- if (aboutAtt) {
596
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
597
-
598
- if (typeofAtt) {
599
- typedResource = newSubject;
600
- }
512
+ if (!typedResource) {
513
+ typedResource = this.newBlankNode();
601
514
  }
602
-
603
- if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {
515
+ currentObjectResource = typedResource;
516
+ }
517
+ // console.log(current.localName+", newSubject="+newSubject+", typedResource="+typedResource+", currentObjectResource="+currentObjectResource)
518
+ } else {
519
+ // Sequence Step 5.2: establish a new subject
520
+ if (aboutAtt) {
521
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
522
+ }
523
+ if (!newSubject && resourceAtt) {
524
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
525
+ }
526
+ if (!newSubject && hrefAtt) {
527
+ newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
528
+ }
529
+ if (!newSubject && srcAtt) {
530
+ newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
531
+ }
532
+ if (!newSubject) {
533
+ if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
604
534
  newSubject = removeHash(current.baseURI);
605
-
606
- if (typeofAtt) {
607
- typedResource = newSubject;
608
- }
609
- } else if (!newSubject && context.parentObject) {
535
+ } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
536
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
537
+ } else if (typeofAtt) {
538
+ newSubject = this.newBlankNode();
539
+ } else if (context.parentObject) {
610
540
  // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI
611
541
  newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
612
- }
613
-
614
- if (typeofAtt && !typedResource) {
615
- if (resourceAtt) {
616
- typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
617
- }
618
-
619
- if (!typedResource && hrefAtt) {
620
- typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
621
- }
622
-
623
- if (!typedResource && srcAtt) {
624
- typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
625
- }
626
-
627
- if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
628
- typedResource = newSubject;
542
+ if (!propertyAtt) {
543
+ skip = true;
629
544
  }
630
-
631
- if (!typedResource) {
632
- typedResource = this.newBlankNode();
633
- }
634
-
635
- currentObjectResource = typedResource;
636
- } // console.log(current.localName+", newSubject="+newSubject+", typedResource="+typedResource+", currentObjectResource="+currentObjectResource)
637
-
638
- } else {
639
- // Sequence Step 5.2: establish a new subject
640
- if (aboutAtt) {
641
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
642
545
  }
643
-
644
- if (!newSubject && resourceAtt) {
645
- newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
646
- }
647
-
648
- if (!newSubject && hrefAtt) {
649
- newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
546
+ }
547
+ if (typeofAtt) {
548
+ typedResource = newSubject;
549
+ }
550
+ }
551
+ // console.log(current.tagName+": newSubject="+newSubject+", currentObjectResource="+currentObjectResource+", typedResource="+typedResource+", skip="+skip)
552
+ // var rdfaData = null
553
+ if (newSubject) {
554
+ // this.newSubject(current,newSubject)
555
+ if (aboutAtt || resourceAtt || typedResource) {
556
+ var id = newSubject;
557
+ if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {
558
+ id = currentObjectResource;
559
+ }
560
+ // console.log("Setting data attribute for "+current.localName+" for subject "+id)
561
+ this.newSubjectOrigin(current, id);
562
+ }
563
+ }
564
+ // Sequence Step 7: generate type triple
565
+ if (typedResource) {
566
+ values = this.tokenize(typeofAtt.value);
567
+ for (let i = 0; i < values.length; i++) {
568
+ var object = this.parseTermOrCURIEOrAbsURI(values[i], vocabulary, context.terms, prefixes, base);
569
+ if (object) {
570
+ this.addTriple(current, typedResource, RDFaProcessor.typeURI, {
571
+ type: RDFaProcessor.objectURI,
572
+ value: object
573
+ });
650
574
  }
651
-
652
- if (!newSubject && srcAtt) {
653
- newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
575
+ }
576
+ }
577
+ // Sequence Step 8: new list mappings if there is a new subject
578
+ // console.log("Step 8: newSubject="+newSubject+", context.parentObject="+context.parentObject)
579
+ if (newSubject && newSubject !== context.parentObject) {
580
+ // console.log("Generating new list mapping for "+newSubject)
581
+ listMapping = {};
582
+ listMappingDifferent = true;
583
+ }
584
+ // Sequence Step 9: generate object triple
585
+ if (currentObjectResource) {
586
+ if (relAtt && inlistAtt) {
587
+ for (let i = 0; i < relAttPredicates.length; i++) {
588
+ let list = listMapping[relAttPredicates[i]];
589
+ if (!list) {
590
+ list = [];
591
+ listMapping[relAttPredicates[i]] = list;
592
+ }
593
+ list.push({
594
+ type: RDFaProcessor.objectURI,
595
+ value: currentObjectResource
596
+ });
654
597
  }
655
-
656
- if (!newSubject) {
657
- if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
658
- newSubject = removeHash(current.baseURI);
659
- } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
660
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
661
- } else if (typeofAtt) {
662
- newSubject = this.newBlankNode();
663
- } else if (context.parentObject) {
664
- // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI
665
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
666
-
667
- if (!propertyAtt) {
668
- skip = true;
669
- }
670
- }
598
+ } else if (relAtt) {
599
+ for (let i = 0; i < relAttPredicates.length; i++) {
600
+ this.addTriple(current, newSubject, relAttPredicates[i], {
601
+ type: RDFaProcessor.objectURI,
602
+ value: currentObjectResource
603
+ });
671
604
  }
672
-
673
- if (typeofAtt) {
674
- typedResource = newSubject;
605
+ }
606
+ if (revAtt) {
607
+ for (let i = 0; i < revAttPredicates.length; i++) {
608
+ this.addTriple(current, currentObjectResource, revAttPredicates[i], {
609
+ type: RDFaProcessor.objectURI,
610
+ value: newSubject
611
+ });
675
612
  }
676
- } // console.log(current.tagName+": newSubject="+newSubject+", currentObjectResource="+currentObjectResource+", typedResource="+typedResource+", skip="+skip)
677
- // var rdfaData = null
678
-
679
-
680
- if (newSubject) {
681
- // this.newSubject(current,newSubject)
682
- if (aboutAtt || resourceAtt || typedResource) {
683
- var id = newSubject;
684
-
685
- if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {
686
- id = currentObjectResource;
687
- } // console.log("Setting data attribute for "+current.localName+" for subject "+id)
688
-
613
+ }
614
+ } else {
615
+ // Sequence Step 10: incomplete triples
616
+ if (newSubject && !currentObjectResource && (relAtt || revAtt)) {
617
+ currentObjectResource = this.newBlankNode();
618
+ // alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
619
+ }
689
620
 
690
- this.newSubjectOrigin(current, id);
621
+ if (relAtt && inlistAtt) {
622
+ for (let i = 0; i < relAttPredicates.length; i++) {
623
+ let list = listMapping[relAttPredicates[i]];
624
+ if (!list) {
625
+ list = [];
626
+ listMapping[predicate] = list;
627
+ }
628
+ // console.log("Adding incomplete list for "+predicate)
629
+ incomplete.push({
630
+ predicate: relAttPredicates[i],
631
+ list: list
632
+ });
691
633
  }
692
- } // Sequence Step 7: generate type triple
693
-
694
-
695
- if (typedResource) {
696
- values = this.tokenize(typeofAtt.value);
697
-
698
- for (var _i6 = 0; _i6 < values.length; _i6++) {
699
- var object = this.parseTermOrCURIEOrAbsURI(values[_i6], vocabulary, context.terms, prefixes, base);
700
-
701
- if (object) {
702
- this.addTriple(current, typedResource, RDFaProcessor.typeURI, {
703
- type: RDFaProcessor.objectURI,
704
- value: object
705
- });
706
- }
634
+ } else if (relAtt) {
635
+ for (let i = 0; i < relAttPredicates.length; i++) {
636
+ incomplete.push({
637
+ predicate: relAttPredicates[i],
638
+ forward: true
639
+ });
707
640
  }
708
- } // Sequence Step 8: new list mappings if there is a new subject
709
- // console.log("Step 8: newSubject="+newSubject+", context.parentObject="+context.parentObject)
710
-
711
-
712
- if (newSubject && newSubject !== context.parentObject) {
713
- // console.log("Generating new list mapping for "+newSubject)
714
- listMapping = {};
715
- listMappingDifferent = true;
716
- } // Sequence Step 9: generate object triple
717
-
718
-
719
- if (currentObjectResource) {
720
- if (relAtt && inlistAtt) {
721
- for (var _i7 = 0; _i7 < relAttPredicates.length; _i7++) {
722
- var _list = listMapping[relAttPredicates[_i7]];
723
-
724
- if (!_list) {
725
- _list = [];
726
- listMapping[relAttPredicates[_i7]] = _list;
727
- }
728
-
729
- _list.push({
730
- type: RDFaProcessor.objectURI,
731
- value: currentObjectResource
732
- });
733
- }
734
- } else if (relAtt) {
735
- for (var _i8 = 0; _i8 < relAttPredicates.length; _i8++) {
736
- this.addTriple(current, newSubject, relAttPredicates[_i8], {
737
- type: RDFaProcessor.objectURI,
738
- value: currentObjectResource
739
- });
740
- }
641
+ }
642
+ if (revAtt) {
643
+ for (let i = 0; i < revAttPredicates.length; i++) {
644
+ incomplete.push({
645
+ predicate: revAttPredicates[i],
646
+ forward: false
647
+ });
741
648
  }
742
-
743
- if (revAtt) {
744
- for (var _i9 = 0; _i9 < revAttPredicates.length; _i9++) {
745
- this.addTriple(current, currentObjectResource, revAttPredicates[_i9], {
746
- type: RDFaProcessor.objectURI,
747
- value: newSubject
748
- });
749
- }
649
+ }
650
+ }
651
+ // Step 11: Current property values
652
+ if (propertyAtt) {
653
+ var datatype = null;
654
+ var content = null;
655
+ if (datatypeAtt) {
656
+ datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base);
657
+ if (datetimeAtt && !contentAtt) {
658
+ content = datetimeAtt.value;
659
+ } else {
660
+ content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : contentAtt ? contentAtt.value : current.textContent;
661
+ }
662
+ } else if (contentAtt) {
663
+ datatype = RDFaProcessor.PlainLiteralURI;
664
+ content = contentAtt.value;
665
+ } else if (datetimeAtt) {
666
+ content = datetimeAtt.value;
667
+ datatype = RDFaProcessor.deriveDateTimeType(content);
668
+ if (!datatype) {
669
+ datatype = RDFaProcessor.PlainLiteralURI;
750
670
  }
751
- } else {
752
- // Sequence Step 10: incomplete triples
753
- if (newSubject && !currentObjectResource && (relAtt || revAtt)) {
754
- currentObjectResource = this.newBlankNode(); // alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
671
+ } else if (!relAtt && !revAtt) {
672
+ if (resourceAtt) {
673
+ content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
755
674
  }
756
-
757
- if (relAtt && inlistAtt) {
758
- for (var _i10 = 0; _i10 < relAttPredicates.length; _i10++) {
759
- var _list2 = listMapping[relAttPredicates[_i10]];
760
-
761
- if (!_list2) {
762
- _list2 = [];
763
- listMapping[predicate] = _list2;
764
- } // console.log("Adding incomplete list for "+predicate)
765
-
766
-
767
- incomplete.push({
768
- predicate: relAttPredicates[_i10],
769
- list: _list2
770
- });
771
- }
772
- } else if (relAtt) {
773
- for (var _i11 = 0; _i11 < relAttPredicates.length; _i11++) {
774
- incomplete.push({
775
- predicate: relAttPredicates[_i11],
776
- forward: true
777
- });
778
- }
675
+ if (!content && hrefAtt) {
676
+ content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
677
+ } else if (!content && srcAtt) {
678
+ content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
779
679
  }
780
-
781
- if (revAtt) {
782
- for (var _i12 = 0; _i12 < revAttPredicates.length; _i12++) {
783
- incomplete.push({
784
- predicate: revAttPredicates[_i12],
785
- forward: false
786
- });
787
- }
680
+ if (content) {
681
+ datatype = RDFaProcessor.objectURI;
788
682
  }
789
- } // Step 11: Current property values
790
-
791
-
792
- if (propertyAtt) {
793
- var datatype = null;
794
- var content = null;
795
-
796
- if (datatypeAtt) {
797
- datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base);
798
-
799
- if (datetimeAtt && !contentAtt) {
800
- content = datetimeAtt.value;
801
- } else {
802
- content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : contentAtt ? contentAtt.value : current.textContent;
683
+ }
684
+ if (!datatype) {
685
+ if (typeofAtt && !aboutAtt) {
686
+ datatype = RDFaProcessor.objectURI;
687
+ content = typedResource;
688
+ } else {
689
+ content = current.textContent;
690
+ if (this.inHTMLMode && current.localName === 'time') {
691
+ datatype = RDFaProcessor.deriveDateTimeType(content);
803
692
  }
804
- } else if (contentAtt) {
805
- datatype = RDFaProcessor.PlainLiteralURI;
806
- content = contentAtt.value;
807
- } else if (datetimeAtt) {
808
- content = datetimeAtt.value;
809
- datatype = RDFaProcessor.deriveDateTimeType(content);
810
-
811
693
  if (!datatype) {
812
694
  datatype = RDFaProcessor.PlainLiteralURI;
813
695
  }
814
- } else if (!relAtt && !revAtt) {
815
- if (resourceAtt) {
816
- content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
817
- }
818
-
819
- if (!content && hrefAtt) {
820
- content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
821
- } else if (!content && srcAtt) {
822
- content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
823
- }
824
-
825
- if (content) {
826
- datatype = RDFaProcessor.objectURI;
827
- }
828
696
  }
829
-
830
- if (!datatype) {
831
- if (typeofAtt && !aboutAtt) {
832
- datatype = RDFaProcessor.objectURI;
833
- content = typedResource;
834
- } else {
835
- content = current.textContent;
836
-
837
- if (this.inHTMLMode && current.localName === 'time') {
838
- datatype = RDFaProcessor.deriveDateTimeType(content);
839
- }
840
-
841
- if (!datatype) {
842
- datatype = RDFaProcessor.PlainLiteralURI;
697
+ }
698
+ values = this.tokenize(propertyAtt.value);
699
+ for (let i = 0; i < values.length; i++) {
700
+ let predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base);
701
+ if (predicate) {
702
+ if (inlistAtt) {
703
+ let list = listMapping[predicate];
704
+ if (!list) {
705
+ list = [];
706
+ listMapping[predicate] = list;
843
707
  }
844
- }
845
- }
846
-
847
- values = this.tokenize(propertyAtt.value);
848
-
849
- for (var _i13 = 0; _i13 < values.length; _i13++) {
850
- var _predicate2 = this.parsePredicate(values[_i13], vocabulary, context.terms, prefixes, base);
851
-
852
- if (_predicate2) {
853
- if (inlistAtt) {
854
- var _list3 = listMapping[_predicate2];
855
-
856
- if (!_list3) {
857
- _list3 = [];
858
- listMapping[_predicate2] = _list3;
859
- }
860
-
861
- _list3.push(datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? {
708
+ list.push(datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? {
709
+ type: datatype,
710
+ value: current.childNodes
711
+ } : {
712
+ type: datatype || RDFaProcessor.PlainLiteralURI,
713
+ value: content,
714
+ language: language
715
+ });
716
+ } else {
717
+ if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {
718
+ this.addTriple(current, newSubject, predicate, {
862
719
  type: datatype,
863
720
  value: current.childNodes
864
- } : {
721
+ });
722
+ } else {
723
+ this.addTriple(current, newSubject, predicate, {
865
724
  type: datatype || RDFaProcessor.PlainLiteralURI,
866
725
  value: content,
867
726
  language: language
868
727
  });
869
- } else {
870
- if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {
871
- this.addTriple(current, newSubject, _predicate2, {
872
- type: datatype,
873
- value: current.childNodes
874
- });
875
- } else {
876
- this.addTriple(current, newSubject, _predicate2, {
877
- type: datatype || RDFaProcessor.PlainLiteralURI,
878
- value: content,
879
- language: language
880
- }); // console.log(newSubject+" "+predicate+"="+content)
881
- }
728
+ // console.log(newSubject+" "+predicate+"="+content)
882
729
  }
883
730
  }
884
731
  }
885
- } // Sequence Step 12: complete incomplete triples with new subject
886
-
887
-
888
- if (newSubject && !skip) {
889
- for (var _i14 = 0; _i14 < context.incomplete.length; _i14++) {
890
- if (context.incomplete[_i14].list) {
891
- // console.log("Adding subject "+newSubject+" to list for "+context.incomplete[i].predicate)
892
- // TODO: it is unclear what to do here
893
- context.incomplete[_i14].list.push({
894
- type: RDFaProcessor.objectURI,
895
- value: newSubject
896
- });
897
- } else if (context.incomplete[_i14].forward) {
898
- // console.log(current.tagName+": completing forward triple "+context.incomplete[i].predicate+" with object="+newSubject)
899
- this.addTriple(current, context.subject, context.incomplete[_i14].predicate, {
900
- type: RDFaProcessor.objectURI,
901
- value: newSubject
902
- });
903
- } else {
904
- // console.log(current.tagName+": completing reverse triple with object="+context.subject)
905
- this.addTriple(current, newSubject, context.incomplete[_i14].predicate, {
906
- type: RDFaProcessor.objectURI,
907
- value: context.subject
908
- });
909
- }
910
- }
911
- }
912
-
913
- var childContext = null;
914
- var listSubject = newSubject;
915
-
916
- if (skip) {
917
- // TODO: should subject be null?
918
- childContext = this.push(context, context.subject); // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.
919
- // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change
920
-
921
- childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
922
- childContext.incomplete = context.incomplete;
923
- childContext.language = language;
924
- childContext.prefixes = prefixes;
925
- childContext.vocabulary = vocabulary;
926
- } else {
927
- childContext = this.push(context, newSubject);
928
- childContext.parentObject = currentObjectResource || newSubject || context.subject;
929
- childContext.prefixes = prefixes;
930
- childContext.incomplete = incomplete;
931
-
932
- if (currentObjectResource) {
933
- // console.log("Generating new list mapping for "+currentObjectResource)
934
- listSubject = currentObjectResource;
935
- listMapping = {};
936
- listMappingDifferent = true;
937
- }
938
-
939
- childContext.listMapping = listMapping;
940
- childContext.language = language;
941
- childContext.vocabulary = vocabulary;
942
- }
943
-
944
- if (listMappingDifferent) {
945
- // console.log("Pushing list parent "+current.localName)
946
- queue.unshift({
947
- parent: current,
948
- context: context,
949
- subject: listSubject,
950
- listMapping: listMapping
951
- });
952
732
  }
953
-
954
- for (var child = current.lastChild; child; child = child.previousSibling) {
955
- if (child.nodeType === Node.ELEMENT_NODE) {
956
- // console.log("Pushing child "+child.localName)
957
- // child.baseURI = current.baseURI
958
- queue.unshift({
959
- current: child,
960
- context: childContext
733
+ }
734
+ // Sequence Step 12: complete incomplete triples with new subject
735
+ if (newSubject && !skip) {
736
+ for (let i = 0; i < context.incomplete.length; i++) {
737
+ if (context.incomplete[i].list) {
738
+ // console.log("Adding subject "+newSubject+" to list for "+context.incomplete[i].predicate)
739
+ // TODO: it is unclear what to do here
740
+ context.incomplete[i].list.push({
741
+ type: RDFaProcessor.objectURI,
742
+ value: newSubject
743
+ });
744
+ } else if (context.incomplete[i].forward) {
745
+ // console.log(current.tagName+": completing forward triple "+context.incomplete[i].predicate+" with object="+newSubject)
746
+ this.addTriple(current, context.subject, context.incomplete[i].predicate, {
747
+ type: RDFaProcessor.objectURI,
748
+ value: newSubject
749
+ });
750
+ } else {
751
+ // console.log(current.tagName+": completing reverse triple with object="+context.subject)
752
+ this.addTriple(current, newSubject, context.incomplete[i].predicate, {
753
+ type: RDFaProcessor.objectURI,
754
+ value: context.subject
961
755
  });
962
756
  }
963
757
  }
964
758
  }
965
-
966
- if (this.inHTMLMode) {
967
- this.copyProperties();
759
+ var childContext = null;
760
+ var listSubject = newSubject;
761
+ if (skip) {
762
+ // TODO: should subject be null?
763
+ childContext = this.push(context, context.subject);
764
+ // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.
765
+ // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change
766
+ childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
767
+ childContext.incomplete = context.incomplete;
768
+ childContext.language = language;
769
+ childContext.prefixes = prefixes;
770
+ childContext.vocabulary = vocabulary;
771
+ } else {
772
+ childContext = this.push(context, newSubject);
773
+ childContext.parentObject = currentObjectResource || newSubject || context.subject;
774
+ childContext.prefixes = prefixes;
775
+ childContext.incomplete = incomplete;
776
+ if (currentObjectResource) {
777
+ // console.log("Generating new list mapping for "+currentObjectResource)
778
+ listSubject = currentObjectResource;
779
+ listMapping = {};
780
+ listMappingDifferent = true;
781
+ }
782
+ childContext.listMapping = listMapping;
783
+ childContext.language = language;
784
+ childContext.vocabulary = vocabulary;
968
785
  }
969
-
970
- for (var _i15 = 0; _i15 < this.finishedHandlers.length; _i15++) {
971
- this.finishedHandlers[_i15](node);
786
+ if (listMappingDifferent) {
787
+ // console.log("Pushing list parent "+current.localName)
788
+ queue.unshift({
789
+ parent: current,
790
+ context: context,
791
+ subject: listSubject,
792
+ listMapping: listMapping
793
+ });
794
+ }
795
+ for (var child = current.lastChild; child; child = child.previousSibling) {
796
+ if (child.nodeType === Node.ELEMENT_NODE) {
797
+ // console.log("Pushing child "+child.localName)
798
+ // child.baseURI = current.baseURI
799
+ queue.unshift({
800
+ current: child,
801
+ context: childContext
802
+ });
803
+ }
972
804
  }
973
805
  }
974
- }, {
975
- key: "push",
976
- value: function push(parent, subject) {
977
- return {
978
- parent: parent,
979
- subject: subject || (parent ? parent.subject : null),
980
- parentObject: null,
981
- incomplete: [],
982
- listMapping: parent ? parent.listMapping : {},
983
- language: parent ? parent.language : this.language,
984
- prefixes: parent ? parent.prefixes : this.target.graph.prefixes,
985
- terms: parent ? parent.terms : this.target.graph.terms,
986
- vocabulary: parent ? parent.vocabulary : this.vocabulary
987
- };
806
+ if (this.inHTMLMode) {
807
+ this.copyProperties();
988
808
  }
989
- }, {
990
- key: "resolveAndNormalize",
991
- value: function resolveAndNormalize(base, uri) {
992
- // console.log("Joining " + uri + " to " + base + " making " + Uri.join(uri, base))
993
- return Uri.join(uri, base); // @@ normalize?
809
+ for (let i = 0; i < this.finishedHandlers.length; i++) {
810
+ this.finishedHandlers[i](node);
994
811
  }
995
- }, {
996
- key: "setContext",
997
- value: function setContext(node) {
998
- // We only recognized XHTML+RDFa 1.1 if the version is set propertyly
999
- if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {
1000
- this.setXHTMLContext();
1001
- } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {
1002
- if (typeof document !== 'undefined' && document.doctype) {
1003
- if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {
1004
- console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.');
1005
- this.setHTMLContext();
1006
- } else if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.1//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd') {
1007
- this.setXHTMLContext();
1008
- } else {
1009
- this.setHTMLContext();
1010
- }
812
+ }
813
+ push(parent, subject) {
814
+ return {
815
+ parent: parent,
816
+ subject: subject || (parent ? parent.subject : null),
817
+ parentObject: null,
818
+ incomplete: [],
819
+ listMapping: parent ? parent.listMapping : {},
820
+ language: parent ? parent.language : this.language,
821
+ prefixes: parent ? parent.prefixes : this.target.graph.prefixes,
822
+ terms: parent ? parent.terms : this.target.graph.terms,
823
+ vocabulary: parent ? parent.vocabulary : this.vocabulary
824
+ };
825
+ }
826
+ resolveAndNormalize(base, uri) {
827
+ // console.log("Joining " + uri + " to " + base + " making " + Uri.join(uri, base))
828
+ return Uri.join(uri, base); // @@ normalize?
829
+ }
830
+
831
+ setContext(node) {
832
+ // We only recognized XHTML+RDFa 1.1 if the version is set propertyly
833
+ if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {
834
+ this.setXHTMLContext();
835
+ } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {
836
+ if (typeof document !== 'undefined' && document.doctype) {
837
+ if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {
838
+ console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.');
839
+ this.setHTMLContext();
840
+ } else if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.1//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd') {
841
+ this.setXHTMLContext();
1011
842
  } else {
1012
843
  this.setHTMLContext();
1013
844
  }
1014
845
  } else {
1015
- this.setXMLContext();
846
+ this.setHTMLContext();
1016
847
  }
848
+ } else {
849
+ this.setXMLContext();
1017
850
  }
1018
- }, {
1019
- key: "setHTMLContext",
1020
- value: function setHTMLContext() {
1021
- this.setInitialContext();
1022
- this.langAttributes = [{
1023
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
1024
- localName: 'lang'
1025
- }, {
1026
- namespaceURI: null,
1027
- localName: 'lang'
1028
- }];
1029
- this.inXHTMLMode = false;
1030
- this.inHTMLMode = true;
1031
- }
1032
- }, {
1033
- key: "setInitialContext",
1034
- value: function setInitialContext() {
1035
- this.vocabulary = null; // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor
1036
-
1037
- this.langAttributes = [{
1038
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
1039
- localName: 'lang'
1040
- }];
1041
- }
1042
- }, {
1043
- key: "setXHTMLContext",
1044
- value: function setXHTMLContext() {
1045
- this.setInitialContext();
1046
- this.inXHTMLMode = true;
1047
- this.inHTMLMode = false;
1048
- this.langAttributes = [{
1049
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
1050
- localName: 'lang'
1051
- }, {
1052
- namespaceURI: null,
1053
- localName: 'lang'
1054
- }]; // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
1055
-
1056
- this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';
1057
- this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';
1058
- this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';
1059
- this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';
1060
- this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';
1061
- this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';
1062
- this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';
1063
- this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';
1064
- this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';
1065
- this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';
1066
- this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';
1067
- this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';
1068
- this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';
1069
- this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';
1070
- this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';
1071
- this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';
1072
- this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';
1073
- this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';
1074
- this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';
1075
- this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';
1076
- this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';
1077
- this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';
1078
- this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';
1079
- this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';
1080
- this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1'; // other
1081
-
1082
- this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';
1083
- this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';
1084
- this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';
1085
- }
1086
- }, {
1087
- key: "setXMLContext",
1088
- value: function setXMLContext() {
1089
- this.setInitialContext();
1090
- this.inXHTMLMode = false;
1091
- this.inHTMLMode = false;
1092
- }
1093
- }, {
1094
- key: "tokenize",
1095
- value: function tokenize(str) {
1096
- return this.trim(str).split(/\s+/);
1097
- }
1098
- }, {
1099
- key: "toRDFNodeObject",
1100
- value: function toRDFNodeObject(x) {
1101
- var _this = this;
1102
-
1103
- if (typeof x === 'undefined') return undefined;
1104
-
1105
- if (typeof x === 'string') {
1106
- if (x.substring(0, 2) === '_:') {
1107
- if (typeof this.blankNodes[x.substring(2)] === 'undefined') {
1108
- this.blankNodes[x.substring(2)] = new _blankNode.default(x.substring(2));
1109
- }
1110
-
1111
- return this.blankNodes[x.substring(2)];
851
+ }
852
+ setHTMLContext() {
853
+ this.setInitialContext();
854
+ this.langAttributes = [{
855
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
856
+ localName: 'lang'
857
+ }, {
858
+ namespaceURI: null,
859
+ localName: 'lang'
860
+ }];
861
+ this.inXHTMLMode = false;
862
+ this.inHTMLMode = true;
863
+ }
864
+ setInitialContext() {
865
+ this.vocabulary = null;
866
+ // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor
867
+ this.langAttributes = [{
868
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
869
+ localName: 'lang'
870
+ }];
871
+ }
872
+ setXHTMLContext() {
873
+ this.setInitialContext();
874
+ this.inXHTMLMode = true;
875
+ this.inHTMLMode = false;
876
+ this.langAttributes = [{
877
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
878
+ localName: 'lang'
879
+ }, {
880
+ namespaceURI: null,
881
+ localName: 'lang'
882
+ }];
883
+ // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
884
+ this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';
885
+ this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';
886
+ this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';
887
+ this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';
888
+ this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';
889
+ this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';
890
+ this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';
891
+ this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';
892
+ this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';
893
+ this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';
894
+ this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';
895
+ this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';
896
+ this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';
897
+ this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';
898
+ this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';
899
+ this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';
900
+ this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';
901
+ this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';
902
+ this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';
903
+ this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';
904
+ this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';
905
+ this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';
906
+ this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';
907
+ this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';
908
+ this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1';
909
+ // other
910
+ this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';
911
+ this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';
912
+ this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';
913
+ }
914
+ setXMLContext() {
915
+ this.setInitialContext();
916
+ this.inXHTMLMode = false;
917
+ this.inHTMLMode = false;
918
+ }
919
+ tokenize(str) {
920
+ return this.trim(str).split(/\s+/);
921
+ }
922
+ static tokenize(str) {
923
+ return this.trim(str).split(/\s+/);
924
+ }
925
+ toRDFNodeObject(x) {
926
+ if (typeof x === 'undefined') return undefined;
927
+ if (typeof x === 'string') {
928
+ if (x.substring(0, 2) === '_:') {
929
+ if (typeof this.blankNodes[x.substring(2)] === 'undefined') {
930
+ this.blankNodes[x.substring(2)] = new _blankNode.default(x.substring(2));
1112
931
  }
1113
-
1114
- return _canonicalDataFactory.default.namedNode(x);
1115
- }
1116
-
1117
- switch (x.type) {
1118
- case RDFaProcessor.objectURI:
1119
- if (x.value.substring(0, 2) === '_:') {
1120
- if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {
1121
- this.blankNodes[x.value.substring(2)] = new _blankNode.default(x.value.substring(2));
1122
- }
1123
-
1124
- return this.blankNodes[x.value.substring(2)];
1125
- }
1126
-
1127
- return _canonicalDataFactory.default.namedNode(x.value);
1128
-
1129
- case RDFaProcessor.PlainLiteralURI:
1130
- return new _literal.default(x.value, x.language || '');
1131
-
1132
- case RDFaProcessor.XMLLiteralURI:
1133
- case RDFaProcessor.HTMLLiteralURI:
1134
- var string = '';
1135
- Object.keys(x.value).forEach(function (i) {
1136
- string += Util.domToString(x.value[i], _this.htmlOptions);
1137
- });
1138
- return new _literal.default(string, '', new _namedNode.default(x.type));
1139
-
1140
- default:
1141
- return new _literal.default(x.value, '', new _namedNode.default(x.type));
932
+ return this.blankNodes[x.substring(2)];
1142
933
  }
934
+ return _canonicalDataFactory.default.namedNode(x);
1143
935
  }
1144
- }, {
1145
- key: "trim",
1146
- value: function trim(str) {
1147
- return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
1148
- }
1149
- }], [{
1150
- key: "parseRDFaDOM",
1151
- value: function parseRDFaDOM(dom, kb, base) {
1152
- var p = new RDFaProcessor(kb, {
1153
- 'base': base
1154
- }); // Cannot assign to read only property 'baseURI' of object '#<XMLDocument>':
1155
-
1156
- if (!dom.baseURI) {
1157
- // Note this became a read-only attribute some time before 2018
1158
- dom.baseURI = base; // oinly set if not already set
1159
- }
1160
-
1161
- p.process(dom, {
1162
- baseURI: base
1163
- });
1164
- }
1165
- }, {
1166
- key: "tokenize",
1167
- value: function tokenize(str) {
1168
- return this.trim(str).split(/\s+/);
1169
- }
1170
- }, {
1171
- key: "trim",
1172
- value: function trim(str) {
1173
- return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
936
+ switch (x.type) {
937
+ case RDFaProcessor.objectURI:
938
+ if (x.value.substring(0, 2) === '_:') {
939
+ if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {
940
+ this.blankNodes[x.value.substring(2)] = new _blankNode.default(x.value.substring(2));
941
+ }
942
+ return this.blankNodes[x.value.substring(2)];
943
+ }
944
+ return _canonicalDataFactory.default.namedNode(x.value);
945
+ case RDFaProcessor.PlainLiteralURI:
946
+ return new _literal.default(x.value, x.language || '');
947
+ case RDFaProcessor.XMLLiteralURI:
948
+ case RDFaProcessor.HTMLLiteralURI:
949
+ var string = '';
950
+ Object.keys(x.value).forEach(i => {
951
+ string += Util.domToString(x.value[i], this.htmlOptions);
952
+ });
953
+ return new _literal.default(string, '', new _namedNode.default(x.type));
954
+ default:
955
+ return new _literal.default(x.value, '', new _namedNode.default(x.type));
1174
956
  }
1175
- }]);
1176
- return RDFaProcessor;
1177
- }();
1178
-
957
+ }
958
+ trim(str) {
959
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
960
+ }
961
+ static trim(str) {
962
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
963
+ }
964
+ }
1179
965
  exports.default = RDFaProcessor;
1180
966
  RDFaProcessor.XMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral';
1181
967
  RDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML';
1182
968
  RDFaProcessor.PlainLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral';
1183
969
  RDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object';
1184
970
  RDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
1185
- RDFaProcessor.nameChar = "[-A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u10000-\uEFFFF.0-9\xB7\u0300-\u036F\u203F-\u2040]";
1186
- RDFaProcessor.nameStartChar = "[A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3\u4E00-\u9FA5\u3007\u3021-\u3029_]";
971
+ RDFaProcessor.nameChar = '[-A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u10000-\uEFFFF\.0-9\u00B7\u0300-\u036F\u203F-\u2040]';
972
+ RDFaProcessor.nameStartChar = '[\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3\u4E00-\u9FA5\u3007\u3021-\u3029_]';
1187
973
  RDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar + RDFaProcessor.nameChar + '*$');
974
+
1188
975
  /*
1189
976
  RDFaProcessor.prototype.resolveAndNormalize = function(base,href) {
1190
977
  var u = base.resolve(href)
@@ -1213,5 +1000,5 @@ RDFaProcessor.dateTimeTypes = [{
1213
1000
  pattern: /-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,
1214
1001
  type: 'http://www.w3.org/2001/XMLSchema#gYear'
1215
1002
  }];
1216
- var parseRDFaDOM = RDFaProcessor.parseRDFaDOM;
1003
+ const parseRDFaDOM = RDFaProcessor.parseRDFaDOM;
1217
1004
  exports.parseRDFaDOM = parseRDFaDOM;