rdflib 2.2.34 → 2.2.35-2bb9ed0b

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 (100) hide show
  1. package/dist/515.rdflib.min.js +3 -0
  2. package/dist/515.rdflib.min.js.map +1 -0
  3. package/dist/789.rdflib.min.js +1 -0
  4. package/dist/rdflib.min.js +1 -1
  5. package/dist/rdflib.min.js.LICENSE.txt +0 -2
  6. package/dist/rdflib.min.js.map +1 -1
  7. package/esm/blank-node.js +57 -85
  8. package/esm/class-order.js +1 -1
  9. package/esm/collection.js +70 -106
  10. package/esm/default-graph.js +13 -33
  11. package/esm/empty.js +8 -26
  12. package/esm/factories/canonical-data-factory.js +33 -30
  13. package/esm/factories/extended-term-factory.js +18 -14
  14. package/esm/factories/factory-types.js +1 -1
  15. package/esm/factories/rdflib-data-factory.js +9 -11
  16. package/esm/fetcher.js +1364 -1668
  17. package/esm/formula.js +631 -739
  18. package/esm/index.js +31 -51
  19. package/esm/jsonldparser.js +19 -26
  20. package/esm/jsonparser.js +1 -1
  21. package/esm/lists.js +41 -86
  22. package/esm/literal.js +120 -157
  23. package/esm/log.js +7 -7
  24. package/esm/n3parser.js +1008 -1090
  25. package/esm/named-node.js +69 -99
  26. package/esm/namespace.js +2 -4
  27. package/esm/node-internal.js +73 -97
  28. package/esm/node.js +1 -2
  29. package/esm/parse.js +3 -3
  30. package/esm/patch-parser.js +1 -2
  31. package/esm/query.js +15 -30
  32. package/esm/rdfaparser.js +775 -846
  33. package/esm/rdfxmlparser.js +348 -365
  34. package/esm/serialize.js +2 -3
  35. package/esm/serializer.js +834 -889
  36. package/esm/sparql-to-query.js +0 -2
  37. package/esm/statement.js +52 -72
  38. package/esm/store.js +852 -963
  39. package/esm/types.js +26 -21
  40. package/esm/update-manager.js +963 -1104
  41. package/esm/updates-via.js +104 -134
  42. package/esm/uri.js +3 -3
  43. package/esm/utils/default-graph-uri.js +2 -2
  44. package/esm/utils/terms.js +4 -5
  45. package/esm/utils-js.js +5 -6
  46. package/esm/utils.js +7 -6
  47. package/esm/variable.js +32 -58
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +56 -83
  50. package/lib/class-order.js +2 -3
  51. package/lib/collection.js +69 -104
  52. package/lib/default-graph.js +13 -32
  53. package/lib/empty.js +8 -25
  54. package/lib/factories/canonical-data-factory.js +36 -34
  55. package/lib/factories/extended-term-factory.js +19 -16
  56. package/lib/factories/factory-types.js +2 -3
  57. package/lib/factories/rdflib-data-factory.js +10 -13
  58. package/lib/fetcher.js +1394 -1693
  59. package/lib/formula.js +631 -738
  60. package/lib/index.js +66 -89
  61. package/lib/jsonldparser.js +21 -32
  62. package/lib/jsonparser.js +3 -4
  63. package/lib/lists.js +47 -87
  64. package/lib/literal.js +120 -156
  65. package/lib/log.js +8 -9
  66. package/lib/n3parser.js +1011 -1096
  67. package/lib/named-node.js +69 -98
  68. package/lib/namespace.js +2 -4
  69. package/lib/node-internal.js +72 -95
  70. package/lib/node.js +2 -4
  71. package/lib/parse.js +5 -6
  72. package/lib/patch-parser.js +1 -2
  73. package/lib/query.js +19 -32
  74. package/lib/rdfaparser.js +777 -849
  75. package/lib/rdfxmlparser.js +350 -366
  76. package/lib/serialize.js +2 -3
  77. package/lib/serializer.js +838 -892
  78. package/lib/sparql-to-query.js +0 -2
  79. package/lib/statement.js +54 -74
  80. package/lib/store.js +873 -978
  81. package/lib/types.js +22 -43
  82. package/lib/update-manager.js +972 -1111
  83. package/lib/updates-via.js +105 -134
  84. package/lib/uri.js +3 -3
  85. package/lib/utils/default-graph-uri.js +2 -4
  86. package/lib/utils/terms.js +4 -6
  87. package/lib/utils-js.js +11 -13
  88. package/lib/utils.js +6 -7
  89. package/lib/variable.js +34 -60
  90. package/lib/xsd-internal.js +2 -3
  91. package/lib/xsd.js +3 -4
  92. package/package.json +31 -31
  93. package/src/n3parser.js +1 -1
  94. package/src/rdfxmlparser.js +2 -1
  95. package/src/serializer.js +1 -1
  96. package/.babelrc +0 -20
  97. package/dist/670.rdflib.min.js +0 -1
  98. package/dist/730.rdflib.min.js +0 -3
  99. package/dist/730.rdflib.min.js.map +0 -1
  100. /package/dist/{730.rdflib.min.js.LICENSE.txt → 515.rdflib.min.js.LICENSE.txt} +0 -0
package/lib/rdfaparser.js CHANGED
@@ -1,21 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.parseRDFaDOM = exports.default = void 0;
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
8
  var _blankNode = _interopRequireDefault(require("./blank-node"));
12
9
  var _literal = _interopRequireDefault(require("./literal"));
13
10
  var _namedNode = _interopRequireDefault(require("./named-node"));
14
11
  var Uri = _interopRequireWildcard(require("./uri"));
15
12
  var Util = _interopRequireWildcard(require("./utils-js"));
16
13
  var _canonicalDataFactory = _interopRequireDefault(require("./factories/canonical-data-factory"));
17
- 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); }
18
- 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; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
16
  // RDFa Parser for rdflib.js
20
17
 
21
18
  // Originally by: Alex Milowski
@@ -47,9 +44,8 @@ if (typeof Node === 'undefined') {
47
44
  NOTATION_NODE: 12
48
45
  };
49
46
  }
50
- var RDFaProcessor = /*#__PURE__*/function () {
51
- function RDFaProcessor(kb, options) {
52
- (0, _classCallCheck2.default)(this, RDFaProcessor);
47
+ class RDFaProcessor {
48
+ constructor(kb, options) {
53
49
  this.options = options || {};
54
50
  this.kb = kb;
55
51
  this.target = options.target || {
@@ -78,963 +74,896 @@ var RDFaProcessor = /*#__PURE__*/function () {
78
74
  this.finishedHandlers = [];
79
75
  this.init();
80
76
  }
81
- (0, _createClass2.default)(RDFaProcessor, [{
82
- key: "addTriple",
83
- value: function addTriple(origin, subject, predicate, object) {
84
- var su, ob, pr, or;
85
- if (typeof subject === 'undefined') {
86
- su = _canonicalDataFactory.default.namedNode(this.options.base);
87
- } else {
88
- su = this.toRDFNodeObject(subject);
89
- }
90
- pr = this.toRDFNodeObject(predicate);
91
- ob = this.toRDFNodeObject(object);
92
- or = _canonicalDataFactory.default.namedNode(this.options.base);
93
- // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')
94
- 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);
95
83
  }
96
- }, {
97
- key: "ancestorPath",
98
- value: function ancestorPath(node) {
99
- var path = '';
100
- while (node && node.nodeType !== Node.DOCUMENT_NODE) {
101
- path = '/' + node.localName + path;
102
- node = node.parentNode;
103
- }
104
- 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;
105
95
  }
106
- }, {
107
- key: "copyMappings",
108
- value: function copyMappings(mappings) {
109
- var newMappings = {};
110
- for (var k in mappings) {
111
- 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;
112
113
  }
113
- return newMappings;
114
114
  }
115
- }, {
116
- key: "copyProperties",
117
- value: function copyProperties() {}
118
- }, {
119
- key: "deriveDateTimeType",
120
- value: function deriveDateTimeType(value) {
121
- for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {
122
- // console.log("Checking "+value+" against "+RDFaProcessor.dateTimeTypes[i].type)
123
- var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value);
124
- if (matched && matched[0].length === value.length) {
125
- // console.log("Matched!")
126
- 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);
127
139
  }
128
140
  }
129
- return null;
130
141
  }
131
- }, {
132
- key: "init",
133
- value: function init() {}
134
- }, {
135
- key: "newBlankNode",
136
- value: function newBlankNode() {
137
- this.blankCounter++;
138
- 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;
139
148
  }
140
- }, {
141
- key: "newSubjectOrigin",
142
- value: function newSubjectOrigin(origin, subject) {}
143
- }, {
144
- key: "parseCURIE",
145
- value: function parseCURIE(value, prefixes, base) {
146
- var colon = value.indexOf(':');
147
- var uri;
148
- if (colon >= 0) {
149
- var prefix = value.substring(0, colon);
150
- if (prefix === '') {
151
- // default prefix
152
- uri = prefixes[''];
153
- return uri ? uri + value.substring(colon + 1) : null;
154
- } else if (prefix === '_') {
155
- // blank node
156
- return '_:' + value.substring(colon + 1);
157
- } else if (RDFaProcessor.NCNAME.test(prefix)) {
158
- uri = prefixes[prefix];
159
- if (uri) {
160
- return uri + value.substring(colon + 1);
161
- }
162
- }
163
- }
149
+ return this.resolveAndNormalize(base, value);
150
+ }
151
+ parsePredicate(value, defaultVocabulary, terms, prefixes, base, ignoreTerms) {
152
+ if (value === '') {
153
+ return null;
154
+ }
155
+ var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base);
156
+ if (predicate && predicate.indexOf('_:') === 0) {
164
157
  return null;
165
158
  }
166
- }, {
167
- key: "parseCURIEOrURI",
168
- value: function parseCURIEOrURI(value, prefixes, base) {
169
- var curie = this.parseCURIE(value, prefixes, base);
170
- if (curie) {
171
- return curie;
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;
172
171
  }
173
- return this.resolveAndNormalize(base, value);
174
172
  }
175
- }, {
176
- key: "parsePredicate",
177
- value: function parsePredicate(value, defaultVocabulary, terms, prefixes, base, ignoreTerms) {
178
- if (value === '') {
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
+ }
183
+ p.process(dom, {
184
+ baseURI: base
185
+ });
186
+ }
187
+ parseSafeCURIEOrCURIEOrURI(value, prefixes, base) {
188
+ value = this.trim(value);
189
+ if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {
190
+ value = value.substring(1, value.length - 1);
191
+ value = value.trim(value);
192
+ if (value.length === 0) {
179
193
  return null;
180
194
  }
181
- var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base);
182
- if (predicate && predicate.indexOf('_:') === 0) {
183
- return null;
195
+ if (value === '_:') {
196
+ // the one node
197
+ return this.theOne;
184
198
  }
185
- return predicate;
199
+ return this.parseCURIE(value, prefixes, base);
200
+ } else {
201
+ return this.parseCURIEOrURI(value, prefixes, base);
186
202
  }
187
- }, {
188
- key: "parsePrefixMappings",
189
- value: function parsePrefixMappings(str, target) {
190
- var values = this.tokenize(str);
191
- var prefix = null;
192
- // var uri = null
193
- for (var i = 0; i < values.length; i++) {
194
- if (values[i][values[i].length - 1] === ':') {
195
- prefix = values[i].substring(0, values[i].length - 1);
196
- } else if (prefix) {
197
- target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i];
198
- prefix = null;
199
- }
203
+ }
204
+ parseTermOrCURIEOrAbsURI(value, defaultVocabulary, terms, prefixes, base) {
205
+ // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
206
+ value = this.trim(value);
207
+ var curie = this.parseCURIE(value, prefixes, base);
208
+ if (curie) {
209
+ return curie;
210
+ } else if (terms) {
211
+ if (defaultVocabulary && !this.absURIRE.exec(value)) {
212
+ return defaultVocabulary + value;
200
213
  }
201
- }
202
- }, {
203
- key: "parseSafeCURIEOrCURIEOrURI",
204
- value: function parseSafeCURIEOrCURIEOrURI(value, prefixes, base) {
205
- value = this.trim(value);
206
- if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {
207
- value = value.substring(1, value.length - 1);
208
- value = value.trim(value);
209
- if (value.length === 0) {
210
- return null;
211
- }
212
- if (value === '_:') {
213
- // the one node
214
- return this.theOne;
215
- }
216
- return this.parseCURIE(value, prefixes, base);
217
- } else {
218
- return this.parseCURIEOrURI(value, prefixes, base);
214
+ var term = terms[value];
215
+ if (term) {
216
+ return term;
217
+ }
218
+ var lcvalue = value.toLowerCase();
219
+ term = terms[lcvalue];
220
+ if (term) {
221
+ return term;
219
222
  }
220
223
  }
221
- }, {
222
- key: "parseTermOrCURIEOrAbsURI",
223
- value: function parseTermOrCURIEOrAbsURI(value, defaultVocabulary, terms, prefixes, base) {
224
- // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
225
- value = this.trim(value);
226
- var curie = this.parseCURIE(value, prefixes, base);
227
- if (curie) {
228
- return curie;
229
- } else if (terms) {
230
- if (defaultVocabulary && !this.absURIRE.exec(value)) {
231
- return defaultVocabulary + value;
232
- }
233
- var term = terms[value];
234
- if (term) {
235
- return term;
236
- }
237
- var lcvalue = value.toLowerCase();
238
- term = terms[lcvalue];
239
- if (term) {
240
- return term;
241
- }
224
+ if (this.absURIRE.exec(value)) {
225
+ return this.resolveAndNormalize(base, value);
226
+ }
227
+ return null;
228
+ }
229
+ parseTermOrCURIEOrURI(value, defaultVocabulary, terms, prefixes, base) {
230
+ // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
231
+ value = this.trim(value);
232
+ var curie = this.parseCURIE(value, prefixes, base);
233
+ if (curie) {
234
+ return curie;
235
+ } else {
236
+ var term = terms[value];
237
+ if (term) {
238
+ return term;
242
239
  }
243
- if (this.absURIRE.exec(value)) {
244
- return this.resolveAndNormalize(base, value);
240
+ var lcvalue = value.toLowerCase();
241
+ term = terms[lcvalue];
242
+ if (term) {
243
+ return term;
245
244
  }
246
- return null;
247
- }
248
- }, {
249
- key: "parseTermOrCURIEOrURI",
250
- value: function parseTermOrCURIEOrURI(value, defaultVocabulary, terms, prefixes, base) {
251
- // alert("Parsing "+value+" with default vocab "+defaultVocabulary)
252
- value = this.trim(value);
253
- var curie = this.parseCURIE(value, prefixes, base);
254
- if (curie) {
255
- return curie;
256
- } else {
257
- var term = terms[value];
258
- if (term) {
259
- return term;
260
- }
261
- var lcvalue = value.toLowerCase();
262
- term = terms[lcvalue];
263
- if (term) {
264
- return term;
265
- }
266
- if (defaultVocabulary && !this.absURIRE.exec(value)) {
267
- return defaultVocabulary + value;
268
- }
245
+ if (defaultVocabulary && !this.absURIRE.exec(value)) {
246
+ return defaultVocabulary + value;
269
247
  }
270
- return this.resolveAndNormalize(base, value);
271
248
  }
272
- }, {
273
- key: "parseURI",
274
- value: function parseURI(uri) {
275
- return uri; // We just use strings as URIs, not objects now.
249
+ return this.resolveAndNormalize(base, value);
250
+ }
251
+ parseURI(uri) {
252
+ return uri; // We just use strings as URIs, not objects now.
253
+ }
254
+ process(node, options) {
255
+ /*
256
+ if (!window.console) {
257
+ window.console = { log: function() {} }
258
+ } */
259
+ options = options || {};
260
+ var base;
261
+ if (node.nodeType === Node.DOCUMENT_NODE) {
262
+ if (node.baseURI && !options.baseURI) {
263
+ options.baseURI = node.baseURI; // be defensive as DOM implementations vary
264
+ }
265
+ base = node.baseURI;
266
+ node = node.documentElement;
267
+ if (!node.baseURI) {
268
+ node.baseURI = base;
269
+ }
270
+ this.setContext(node);
271
+ } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {
272
+ this.setContext(node);
276
273
  }
277
- }, {
278
- key: "process",
279
- value: function process(node, options) {
280
- /*
281
- if (!window.console) {
282
- window.console = { log: function() {} }
283
- } */
284
- options = options || {};
285
- var base;
286
- if (node.nodeType === Node.DOCUMENT_NODE) {
287
- if (node.baseURI && !options.baseURI) {
288
- options.baseURI = node.baseURI; // be defensive as DOM implementations vary
289
- }
290
-
291
- base = node.baseURI;
292
- node = node.documentElement;
293
- if (!node.baseURI) {
294
- node.baseURI = base;
295
- }
296
- this.setContext(node);
297
- } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {
298
- this.setContext(node);
274
+ var queue = [];
275
+ // Fix for Firefox that includes the hash in the base URI
276
+ var removeHash = function (baseURI) {
277
+ // Fix for undefined baseURI property
278
+ if (!baseURI && options && options.baseURI) {
279
+ return options.baseURI;
299
280
  }
300
- var queue = [];
301
- // Fix for Firefox that includes the hash in the base URI
302
- var removeHash = function removeHash(baseURI) {
303
- // Fix for undefined baseURI property
304
- if (!baseURI && options && options.baseURI) {
305
- return options.baseURI;
306
- }
307
- var hash = baseURI.indexOf('#');
308
- if (hash >= 0) {
309
- baseURI = baseURI.substring(0, hash);
310
- }
311
- if (options && options.baseURIMap) {
312
- baseURI = options.baseURIMap(baseURI);
281
+ var hash = baseURI.indexOf('#');
282
+ if (hash >= 0) {
283
+ baseURI = baseURI.substring(0, hash);
284
+ }
285
+ if (options && options.baseURIMap) {
286
+ baseURI = options.baseURIMap(baseURI);
287
+ }
288
+ return baseURI;
289
+ };
290
+ queue.push({
291
+ current: node,
292
+ context: this.push(null, removeHash(node.baseURI))
293
+ });
294
+ while (queue.length > 0) {
295
+ var item = queue.shift();
296
+ if (item.parent) {
297
+ // Sequence Step 14: list triple generation
298
+ if (item.context.parent && item.context.parent.listMapping === item.listMapping) {
299
+ // Skip a child context with exactly the same mapping
300
+ continue;
313
301
  }
314
- return baseURI;
315
- };
316
- queue.push({
317
- current: node,
318
- context: this.push(null, removeHash(node.baseURI))
319
- });
320
- while (queue.length > 0) {
321
- var item = queue.shift();
322
- if (item.parent) {
323
- // Sequence Step 14: list triple generation
324
- if (item.context.parent && item.context.parent.listMapping === item.listMapping) {
325
- // Skip a child context with exactly the same mapping
326
- continue;
327
- }
328
- // console.log("Generating lists for "+item.subject+", tag "+item.parent.localName)
329
- for (var _predicate in item.listMapping) {
330
- var list = item.listMapping[_predicate];
331
- if (list.length === 0) {
332
- this.addTriple(item.parent, item.subject, _predicate, {
333
- type: RDFaProcessor.objectURI,
334
- value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
335
- });
336
- continue;
337
- }
338
- var bnodes = [];
339
- for (var _i = 0; _i < list.length; _i++) {
340
- bnodes.push(this.newBlankNode());
341
- // this.newSubject(item.parent,bnodes[i])
342
- }
343
-
344
- for (var _i2 = 0; _i2 < bnodes.length; _i2++) {
345
- this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[_i2]);
346
- this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
347
- type: RDFaProcessor.objectURI,
348
- value: _i2 + 1 < bnodes.length ? bnodes[_i2 + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
349
- });
350
- }
351
- this.addTriple(item.parent, item.subject, _predicate, {
302
+ // console.log("Generating lists for "+item.subject+", tag "+item.parent.localName)
303
+ for (let predicate in item.listMapping) {
304
+ var list = item.listMapping[predicate];
305
+ if (list.length === 0) {
306
+ this.addTriple(item.parent, item.subject, predicate, {
352
307
  type: RDFaProcessor.objectURI,
353
- value: bnodes[0]
308
+ value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
354
309
  });
310
+ continue;
355
311
  }
356
- continue;
357
- }
358
- var current = item.current;
359
- var context = item.context;
360
- // console.log("Tag: "+current.localName+", listMapping="+JSON.stringify(context.listMapping))
361
- // Sequence Step 1
362
- var skip = false;
363
- var newSubject = null;
364
- var currentObjectResource = null;
365
- var typedResource = null;
366
- var prefixes = context.prefixes;
367
- var prefixesCopied = false;
368
- var incomplete = [];
369
- var listMapping = context.listMapping;
370
- var listMappingDifferent = !context.parent;
371
- var language = context.language;
372
- var vocabulary = context.vocabulary;
373
- // TODO: the "base" element may be used for HTML+RDFa 1.1
374
- base = this.parseURI(removeHash(current.baseURI));
375
- current.item = null;
376
- // Sequence Step 2: set the default vocabulary
377
- var vocabAtt = current.getAttributeNode('vocab');
378
- if (vocabAtt) {
379
- var value = this.trim(vocabAtt.value);
380
- if (value.length > 0) {
381
- vocabulary = value;
382
- var baseSubject = base.spec;
383
- // this.newSubject(current,baseSubject)
384
- this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', {
312
+ var bnodes = [];
313
+ for (let i = 0; i < list.length; i++) {
314
+ bnodes.push(this.newBlankNode());
315
+ // this.newSubject(item.parent,bnodes[i])
316
+ }
317
+ for (let i = 0; i < bnodes.length; i++) {
318
+ this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[i]);
319
+ this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
385
320
  type: RDFaProcessor.objectURI,
386
- value: vocabulary
321
+ value: i + 1 < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
387
322
  });
388
- } else {
389
- vocabulary = this.vocabulary;
390
323
  }
324
+ this.addTriple(item.parent, item.subject, predicate, {
325
+ type: RDFaProcessor.objectURI,
326
+ value: bnodes[0]
327
+ });
391
328
  }
392
- // Sequence Step 3: IRI mappings
393
- // handle xmlns attributes
394
- for (var i = 0; i < current.attributes.length; i++) {
395
- var att = current.attributes[i];
396
- // if (att.namespaceURI=="http://www.w3.org/2000/xmlns/") {
397
- if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {
398
- if (!prefixesCopied) {
399
- prefixes = this.copyMappings(prefixes);
400
- prefixesCopied = true;
401
- }
402
- var prefix = att.nodeName.substring(6);
403
- // TODO: resolve relative?
404
- var ref = RDFaProcessor.trim(att.value);
405
- prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref;
406
- }
329
+ continue;
330
+ }
331
+ var current = item.current;
332
+ var context = item.context;
333
+ // console.log("Tag: "+current.localName+", listMapping="+JSON.stringify(context.listMapping))
334
+ // Sequence Step 1
335
+ var skip = false;
336
+ var newSubject = null;
337
+ var currentObjectResource = null;
338
+ var typedResource = null;
339
+ var prefixes = context.prefixes;
340
+ var prefixesCopied = false;
341
+ var incomplete = [];
342
+ var listMapping = context.listMapping;
343
+ var listMappingDifferent = !context.parent;
344
+ var language = context.language;
345
+ var vocabulary = context.vocabulary;
346
+ // TODO: the "base" element may be used for HTML+RDFa 1.1
347
+ base = this.parseURI(removeHash(current.baseURI));
348
+ current.item = null;
349
+ // Sequence Step 2: set the default vocabulary
350
+ var vocabAtt = current.getAttributeNode('vocab');
351
+ if (vocabAtt) {
352
+ let value = this.trim(vocabAtt.value);
353
+ if (value.length > 0) {
354
+ vocabulary = value;
355
+ var baseSubject = base.spec;
356
+ // this.newSubject(current,baseSubject)
357
+ this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', {
358
+ type: RDFaProcessor.objectURI,
359
+ value: vocabulary
360
+ });
361
+ } else {
362
+ vocabulary = this.vocabulary;
407
363
  }
408
- // Handle prefix mappings (@prefix)
409
- var prefixAtt = current.getAttributeNode('prefix');
410
- if (prefixAtt) {
364
+ }
365
+ // Sequence Step 3: IRI mappings
366
+ // handle xmlns attributes
367
+ for (var i = 0; i < current.attributes.length; i++) {
368
+ var att = current.attributes[i];
369
+ // if (att.namespaceURI=="http://www.w3.org/2000/xmlns/") {
370
+ if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {
411
371
  if (!prefixesCopied) {
412
372
  prefixes = this.copyMappings(prefixes);
413
373
  prefixesCopied = true;
414
374
  }
415
- this.parsePrefixMappings(prefixAtt.value, prefixes);
375
+ var prefix = att.nodeName.substring(6);
376
+ // TODO: resolve relative?
377
+ var ref = RDFaProcessor.trim(att.value);
378
+ prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref;
416
379
  }
417
- // Sequence Step 4: language
418
- var xmlLangAtt = null;
419
- for (var _i3 = 0; !xmlLangAtt && _i3 < this.langAttributes.length; _i3++) {
420
- xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[_i3].namespaceURI, this.langAttributes[_i3].localName);
380
+ }
381
+ // Handle prefix mappings (@prefix)
382
+ var prefixAtt = current.getAttributeNode('prefix');
383
+ if (prefixAtt) {
384
+ if (!prefixesCopied) {
385
+ prefixes = this.copyMappings(prefixes);
386
+ prefixesCopied = true;
387
+ }
388
+ this.parsePrefixMappings(prefixAtt.value, prefixes);
389
+ }
390
+ // Sequence Step 4: language
391
+ var xmlLangAtt = null;
392
+ for (let i = 0; !xmlLangAtt && i < this.langAttributes.length; i++) {
393
+ xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[i].namespaceURI, this.langAttributes[i].localName);
394
+ }
395
+ if (xmlLangAtt) {
396
+ let value = RDFaProcessor.trim(xmlLangAtt.value);
397
+ if (value.length > 0) {
398
+ language = value;
399
+ } else {
400
+ language = null;
421
401
  }
422
- if (xmlLangAtt) {
423
- var _value = RDFaProcessor.trim(xmlLangAtt.value);
424
- if (_value.length > 0) {
425
- language = _value;
426
- } else {
427
- language = null;
402
+ }
403
+ var relAtt = current.getAttributeNode('rel');
404
+ var revAtt = current.getAttributeNode('rev');
405
+ var typeofAtt = current.getAttributeNode('typeof');
406
+ var propertyAtt = current.getAttributeNode('property');
407
+ var datatypeAtt = current.getAttributeNode('datatype');
408
+ var datetimeAtt = this.inHTMLMode ? current.getAttributeNode('datetime') : null;
409
+ var contentAtt = current.getAttributeNode('content');
410
+ var aboutAtt = current.getAttributeNode('about');
411
+ var srcAtt = current.getAttributeNode('src');
412
+ var resourceAtt = current.getAttributeNode('resource');
413
+ var hrefAtt = current.getAttributeNode('href');
414
+ var inlistAtt = current.getAttributeNode('inlist');
415
+ var relAttPredicates = [];
416
+ var predicate, values;
417
+ if (relAtt) {
418
+ values = this.tokenize(relAtt.value);
419
+ for (let i = 0; i < values.length; i++) {
420
+ predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);
421
+ if (predicate) {
422
+ relAttPredicates.push(predicate);
428
423
  }
429
424
  }
430
- var relAtt = current.getAttributeNode('rel');
431
- var revAtt = current.getAttributeNode('rev');
432
- var typeofAtt = current.getAttributeNode('typeof');
433
- var propertyAtt = current.getAttributeNode('property');
434
- var datatypeAtt = current.getAttributeNode('datatype');
435
- var datetimeAtt = this.inHTMLMode ? current.getAttributeNode('datetime') : null;
436
- var contentAtt = current.getAttributeNode('content');
437
- var aboutAtt = current.getAttributeNode('about');
438
- var srcAtt = current.getAttributeNode('src');
439
- var resourceAtt = current.getAttributeNode('resource');
440
- var hrefAtt = current.getAttributeNode('href');
441
- var inlistAtt = current.getAttributeNode('inlist');
442
- var relAttPredicates = [];
443
- var predicate, values;
444
- if (relAtt) {
445
- values = this.tokenize(relAtt.value);
446
- for (var _i4 = 0; _i4 < values.length; _i4++) {
447
- predicate = this.parsePredicate(values[_i4], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);
448
- if (predicate) {
449
- relAttPredicates.push(predicate);
450
- }
425
+ }
426
+ var revAttPredicates = [];
427
+ if (revAtt) {
428
+ values = this.tokenize(revAtt.value);
429
+ for (let i = 0; i < values.length; i++) {
430
+ predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt);
431
+ if (predicate) {
432
+ revAttPredicates.push(predicate);
451
433
  }
452
434
  }
453
- var revAttPredicates = [];
454
- if (revAtt) {
455
- values = this.tokenize(revAtt.value);
456
- for (var _i5 = 0; _i5 < values.length; _i5++) {
457
- predicate = this.parsePredicate(values[_i5], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt);
458
- if (predicate) {
459
- revAttPredicates.push(predicate);
460
- }
461
- }
435
+ }
436
+ // Section 3.1, bullet 7
437
+ if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {
438
+ if (relAttPredicates.length === 0) {
439
+ relAtt = null;
462
440
  }
463
- // Section 3.1, bullet 7
464
- if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {
465
- if (relAttPredicates.length === 0) {
466
- relAtt = null;
467
- }
468
- if (revAttPredicates.length === 0) {
469
- revAtt = null;
441
+ if (revAttPredicates.length === 0) {
442
+ revAtt = null;
443
+ }
444
+ }
445
+ if (relAtt || revAtt) {
446
+ // Sequence Step 6: establish new subject and value
447
+ if (aboutAtt) {
448
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
449
+ }
450
+ if (typeofAtt) {
451
+ typedResource = newSubject;
452
+ }
453
+ if (!newSubject) {
454
+ if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
455
+ newSubject = removeHash(current.baseURI);
456
+ } else if (context.parentObject) {
457
+ // 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
458
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
470
459
  }
471
460
  }
472
- if (relAtt || revAtt) {
473
- // Sequence Step 6: establish new subject and value
474
- if (aboutAtt) {
475
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
461
+ if (resourceAtt) {
462
+ currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
463
+ }
464
+ if (!currentObjectResource) {
465
+ if (hrefAtt) {
466
+ currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
467
+ } else if (srcAtt) {
468
+ currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
469
+ } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {
470
+ currentObjectResource = this.newBlankNode();
476
471
  }
472
+ }
473
+ if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {
474
+ typedResource = newSubject;
475
+ } else if (typeofAtt && !aboutAtt) {
476
+ typedResource = currentObjectResource;
477
+ }
478
+ } else if (propertyAtt && !contentAtt && !datatypeAtt) {
479
+ // Sequence Step 5.1: establish a new subject
480
+ if (aboutAtt) {
481
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
477
482
  if (typeofAtt) {
478
483
  typedResource = newSubject;
479
484
  }
480
- if (!newSubject) {
481
- if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
482
- newSubject = removeHash(current.baseURI);
483
- } else if (context.parentObject) {
484
- // 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
485
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
486
- }
485
+ }
486
+ if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {
487
+ newSubject = removeHash(current.baseURI);
488
+ if (typeofAtt) {
489
+ typedResource = newSubject;
487
490
  }
491
+ } else if (!newSubject && context.parentObject) {
492
+ // 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
493
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
494
+ }
495
+ if (typeofAtt && !typedResource) {
488
496
  if (resourceAtt) {
489
- currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
497
+ typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
490
498
  }
491
- if (!currentObjectResource) {
492
- if (hrefAtt) {
493
- currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
494
- } else if (srcAtt) {
495
- currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
496
- } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {
497
- currentObjectResource = this.newBlankNode();
498
- }
499
+ if (!typedResource && hrefAtt) {
500
+ typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
501
+ }
502
+ if (!typedResource && srcAtt) {
503
+ typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
499
504
  }
500
- if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {
505
+ if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
501
506
  typedResource = newSubject;
502
- } else if (typeofAtt && !aboutAtt) {
503
- typedResource = currentObjectResource;
504
507
  }
505
- } else if (propertyAtt && !contentAtt && !datatypeAtt) {
506
- // Sequence Step 5.1: establish a new subject
507
- if (aboutAtt) {
508
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
509
- if (typeofAtt) {
510
- typedResource = newSubject;
511
- }
508
+ if (!typedResource) {
509
+ typedResource = this.newBlankNode();
512
510
  }
513
- if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {
511
+ currentObjectResource = typedResource;
512
+ }
513
+ // console.log(current.localName+", newSubject="+newSubject+", typedResource="+typedResource+", currentObjectResource="+currentObjectResource)
514
+ } else {
515
+ // Sequence Step 5.2: establish a new subject
516
+ if (aboutAtt) {
517
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
518
+ }
519
+ if (!newSubject && resourceAtt) {
520
+ newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
521
+ }
522
+ if (!newSubject && hrefAtt) {
523
+ newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
524
+ }
525
+ if (!newSubject && srcAtt) {
526
+ newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
527
+ }
528
+ if (!newSubject) {
529
+ if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
514
530
  newSubject = removeHash(current.baseURI);
515
- if (typeofAtt) {
516
- typedResource = newSubject;
517
- }
518
- } else if (!newSubject && context.parentObject) {
531
+ } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
532
+ newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
533
+ } else if (typeofAtt) {
534
+ newSubject = this.newBlankNode();
535
+ } else if (context.parentObject) {
519
536
  // 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
520
537
  newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
521
- }
522
- if (typeofAtt && !typedResource) {
523
- if (resourceAtt) {
524
- typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
525
- }
526
- if (!typedResource && hrefAtt) {
527
- typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
528
- }
529
- if (!typedResource && srcAtt) {
530
- typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
538
+ if (!propertyAtt) {
539
+ skip = true;
531
540
  }
532
- if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
533
- typedResource = newSubject;
534
- }
535
- if (!typedResource) {
536
- typedResource = this.newBlankNode();
537
- }
538
- currentObjectResource = typedResource;
539
- }
540
- // console.log(current.localName+", newSubject="+newSubject+", typedResource="+typedResource+", currentObjectResource="+currentObjectResource)
541
- } else {
542
- // Sequence Step 5.2: establish a new subject
543
- if (aboutAtt) {
544
- newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
545
541
  }
546
- if (!newSubject && resourceAtt) {
547
- newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
548
- }
549
- if (!newSubject && hrefAtt) {
550
- newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
551
- }
552
- if (!newSubject && srcAtt) {
553
- newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
542
+ }
543
+ if (typeofAtt) {
544
+ typedResource = newSubject;
545
+ }
546
+ }
547
+ // console.log(current.tagName+": newSubject="+newSubject+", currentObjectResource="+currentObjectResource+", typedResource="+typedResource+", skip="+skip)
548
+ // var rdfaData = null
549
+ if (newSubject) {
550
+ // this.newSubject(current,newSubject)
551
+ if (aboutAtt || resourceAtt || typedResource) {
552
+ var id = newSubject;
553
+ if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {
554
+ id = currentObjectResource;
555
+ }
556
+ // console.log("Setting data attribute for "+current.localName+" for subject "+id)
557
+ this.newSubjectOrigin(current, id);
558
+ }
559
+ }
560
+ // Sequence Step 7: generate type triple
561
+ if (typedResource) {
562
+ values = this.tokenize(typeofAtt.value);
563
+ for (let i = 0; i < values.length; i++) {
564
+ var object = this.parseTermOrCURIEOrAbsURI(values[i], vocabulary, context.terms, prefixes, base);
565
+ if (object) {
566
+ this.addTriple(current, typedResource, RDFaProcessor.typeURI, {
567
+ type: RDFaProcessor.objectURI,
568
+ value: object
569
+ });
554
570
  }
555
- if (!newSubject) {
556
- if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {
557
- newSubject = removeHash(current.baseURI);
558
- } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
559
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
560
- } else if (typeofAtt) {
561
- newSubject = this.newBlankNode();
562
- } else if (context.parentObject) {
563
- // 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
564
- newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
565
- if (!propertyAtt) {
566
- skip = true;
567
- }
568
- }
571
+ }
572
+ }
573
+ // Sequence Step 8: new list mappings if there is a new subject
574
+ // console.log("Step 8: newSubject="+newSubject+", context.parentObject="+context.parentObject)
575
+ if (newSubject && newSubject !== context.parentObject) {
576
+ // console.log("Generating new list mapping for "+newSubject)
577
+ listMapping = {};
578
+ listMappingDifferent = true;
579
+ }
580
+ // Sequence Step 9: generate object triple
581
+ if (currentObjectResource) {
582
+ if (relAtt && inlistAtt) {
583
+ for (let i = 0; i < relAttPredicates.length; i++) {
584
+ let list = listMapping[relAttPredicates[i]];
585
+ if (!list) {
586
+ list = [];
587
+ listMapping[relAttPredicates[i]] = list;
588
+ }
589
+ list.push({
590
+ type: RDFaProcessor.objectURI,
591
+ value: currentObjectResource
592
+ });
569
593
  }
570
- if (typeofAtt) {
571
- typedResource = newSubject;
594
+ } else if (relAtt) {
595
+ for (let i = 0; i < relAttPredicates.length; i++) {
596
+ this.addTriple(current, newSubject, relAttPredicates[i], {
597
+ type: RDFaProcessor.objectURI,
598
+ value: currentObjectResource
599
+ });
572
600
  }
573
601
  }
574
- // console.log(current.tagName+": newSubject="+newSubject+", currentObjectResource="+currentObjectResource+", typedResource="+typedResource+", skip="+skip)
575
- // var rdfaData = null
576
- if (newSubject) {
577
- // this.newSubject(current,newSubject)
578
- if (aboutAtt || resourceAtt || typedResource) {
579
- var id = newSubject;
580
- if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {
581
- id = currentObjectResource;
582
- }
583
- // console.log("Setting data attribute for "+current.localName+" for subject "+id)
584
- this.newSubjectOrigin(current, id);
602
+ if (revAtt) {
603
+ for (let i = 0; i < revAttPredicates.length; i++) {
604
+ this.addTriple(current, currentObjectResource, revAttPredicates[i], {
605
+ type: RDFaProcessor.objectURI,
606
+ value: newSubject
607
+ });
585
608
  }
586
609
  }
587
- // Sequence Step 7: generate type triple
588
- if (typedResource) {
589
- values = this.tokenize(typeofAtt.value);
590
- for (var _i6 = 0; _i6 < values.length; _i6++) {
591
- var object = this.parseTermOrCURIEOrAbsURI(values[_i6], vocabulary, context.terms, prefixes, base);
592
- if (object) {
593
- this.addTriple(current, typedResource, RDFaProcessor.typeURI, {
594
- type: RDFaProcessor.objectURI,
595
- value: object
596
- });
597
- }
610
+ } else {
611
+ // Sequence Step 10: incomplete triples
612
+ if (newSubject && !currentObjectResource && (relAtt || revAtt)) {
613
+ currentObjectResource = this.newBlankNode();
614
+ // alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
615
+ }
616
+ if (relAtt && inlistAtt) {
617
+ for (let i = 0; i < relAttPredicates.length; i++) {
618
+ let list = listMapping[relAttPredicates[i]];
619
+ if (!list) {
620
+ list = [];
621
+ listMapping[predicate] = list;
622
+ }
623
+ // console.log("Adding incomplete list for "+predicate)
624
+ incomplete.push({
625
+ predicate: relAttPredicates[i],
626
+ list: list
627
+ });
628
+ }
629
+ } else if (relAtt) {
630
+ for (let i = 0; i < relAttPredicates.length; i++) {
631
+ incomplete.push({
632
+ predicate: relAttPredicates[i],
633
+ forward: true
634
+ });
598
635
  }
599
636
  }
600
- // Sequence Step 8: new list mappings if there is a new subject
601
- // console.log("Step 8: newSubject="+newSubject+", context.parentObject="+context.parentObject)
602
- if (newSubject && newSubject !== context.parentObject) {
603
- // console.log("Generating new list mapping for "+newSubject)
604
- listMapping = {};
605
- listMappingDifferent = true;
606
- }
607
- // Sequence Step 9: generate object triple
608
- if (currentObjectResource) {
609
- if (relAtt && inlistAtt) {
610
- for (var _i7 = 0; _i7 < relAttPredicates.length; _i7++) {
611
- var _list = listMapping[relAttPredicates[_i7]];
612
- if (!_list) {
613
- _list = [];
614
- listMapping[relAttPredicates[_i7]] = _list;
615
- }
616
- _list.push({
617
- type: RDFaProcessor.objectURI,
618
- value: currentObjectResource
619
- });
620
- }
621
- } else if (relAtt) {
622
- for (var _i8 = 0; _i8 < relAttPredicates.length; _i8++) {
623
- this.addTriple(current, newSubject, relAttPredicates[_i8], {
624
- type: RDFaProcessor.objectURI,
625
- value: currentObjectResource
626
- });
627
- }
637
+ if (revAtt) {
638
+ for (let i = 0; i < revAttPredicates.length; i++) {
639
+ incomplete.push({
640
+ predicate: revAttPredicates[i],
641
+ forward: false
642
+ });
628
643
  }
629
- if (revAtt) {
630
- for (var _i9 = 0; _i9 < revAttPredicates.length; _i9++) {
631
- this.addTriple(current, currentObjectResource, revAttPredicates[_i9], {
632
- type: RDFaProcessor.objectURI,
633
- value: newSubject
634
- });
635
- }
644
+ }
645
+ }
646
+ // Step 11: Current property values
647
+ if (propertyAtt) {
648
+ var datatype = null;
649
+ var content = null;
650
+ if (datatypeAtt) {
651
+ datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base);
652
+ if (datetimeAtt && !contentAtt) {
653
+ content = datetimeAtt.value;
654
+ } else {
655
+ content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : contentAtt ? contentAtt.value : current.textContent;
656
+ }
657
+ } else if (contentAtt) {
658
+ datatype = RDFaProcessor.PlainLiteralURI;
659
+ content = contentAtt.value;
660
+ } else if (datetimeAtt) {
661
+ content = datetimeAtt.value;
662
+ datatype = RDFaProcessor.deriveDateTimeType(content);
663
+ if (!datatype) {
664
+ datatype = RDFaProcessor.PlainLiteralURI;
636
665
  }
637
- } else {
638
- // Sequence Step 10: incomplete triples
639
- if (newSubject && !currentObjectResource && (relAtt || revAtt)) {
640
- currentObjectResource = this.newBlankNode();
641
- // alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
666
+ } else if (!relAtt && !revAtt) {
667
+ if (resourceAtt) {
668
+ content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
642
669
  }
643
-
644
- if (relAtt && inlistAtt) {
645
- for (var _i10 = 0; _i10 < relAttPredicates.length; _i10++) {
646
- var _list2 = listMapping[relAttPredicates[_i10]];
647
- if (!_list2) {
648
- _list2 = [];
649
- listMapping[predicate] = _list2;
650
- }
651
- // console.log("Adding incomplete list for "+predicate)
652
- incomplete.push({
653
- predicate: relAttPredicates[_i10],
654
- list: _list2
655
- });
656
- }
657
- } else if (relAtt) {
658
- for (var _i11 = 0; _i11 < relAttPredicates.length; _i11++) {
659
- incomplete.push({
660
- predicate: relAttPredicates[_i11],
661
- forward: true
662
- });
663
- }
670
+ if (!content && hrefAtt) {
671
+ content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
672
+ } else if (!content && srcAtt) {
673
+ content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
664
674
  }
665
- if (revAtt) {
666
- for (var _i12 = 0; _i12 < revAttPredicates.length; _i12++) {
667
- incomplete.push({
668
- predicate: revAttPredicates[_i12],
669
- forward: false
670
- });
671
- }
675
+ if (content) {
676
+ datatype = RDFaProcessor.objectURI;
672
677
  }
673
678
  }
674
- // Step 11: Current property values
675
- if (propertyAtt) {
676
- var datatype = null;
677
- var content = null;
678
- if (datatypeAtt) {
679
- datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base);
680
- if (datetimeAtt && !contentAtt) {
681
- content = datetimeAtt.value;
682
- } else {
683
- content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : contentAtt ? contentAtt.value : current.textContent;
679
+ if (!datatype) {
680
+ if (typeofAtt && !aboutAtt) {
681
+ datatype = RDFaProcessor.objectURI;
682
+ content = typedResource;
683
+ } else {
684
+ content = current.textContent;
685
+ if (this.inHTMLMode && current.localName === 'time') {
686
+ datatype = RDFaProcessor.deriveDateTimeType(content);
684
687
  }
685
- } else if (contentAtt) {
686
- datatype = RDFaProcessor.PlainLiteralURI;
687
- content = contentAtt.value;
688
- } else if (datetimeAtt) {
689
- content = datetimeAtt.value;
690
- datatype = RDFaProcessor.deriveDateTimeType(content);
691
688
  if (!datatype) {
692
689
  datatype = RDFaProcessor.PlainLiteralURI;
693
690
  }
694
- } else if (!relAtt && !revAtt) {
695
- if (resourceAtt) {
696
- content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
697
- }
698
- if (!content && hrefAtt) {
699
- content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
700
- } else if (!content && srcAtt) {
701
- content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
702
- }
703
- if (content) {
704
- datatype = RDFaProcessor.objectURI;
705
- }
706
691
  }
707
- if (!datatype) {
708
- if (typeofAtt && !aboutAtt) {
709
- datatype = RDFaProcessor.objectURI;
710
- content = typedResource;
711
- } else {
712
- content = current.textContent;
713
- if (this.inHTMLMode && current.localName === 'time') {
714
- datatype = RDFaProcessor.deriveDateTimeType(content);
715
- }
716
- if (!datatype) {
717
- datatype = RDFaProcessor.PlainLiteralURI;
692
+ }
693
+ values = this.tokenize(propertyAtt.value);
694
+ for (let i = 0; i < values.length; i++) {
695
+ let predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base);
696
+ if (predicate) {
697
+ if (inlistAtt) {
698
+ let list = listMapping[predicate];
699
+ if (!list) {
700
+ list = [];
701
+ listMapping[predicate] = list;
718
702
  }
719
- }
720
- }
721
- values = this.tokenize(propertyAtt.value);
722
- for (var _i13 = 0; _i13 < values.length; _i13++) {
723
- var _predicate2 = this.parsePredicate(values[_i13], vocabulary, context.terms, prefixes, base);
724
- if (_predicate2) {
725
- if (inlistAtt) {
726
- var _list3 = listMapping[_predicate2];
727
- if (!_list3) {
728
- _list3 = [];
729
- listMapping[_predicate2] = _list3;
730
- }
731
- _list3.push(datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? {
703
+ list.push(datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? {
704
+ type: datatype,
705
+ value: current.childNodes
706
+ } : {
707
+ type: datatype || RDFaProcessor.PlainLiteralURI,
708
+ value: content,
709
+ language: language
710
+ });
711
+ } else {
712
+ if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {
713
+ this.addTriple(current, newSubject, predicate, {
732
714
  type: datatype,
733
715
  value: current.childNodes
734
- } : {
716
+ });
717
+ } else {
718
+ this.addTriple(current, newSubject, predicate, {
735
719
  type: datatype || RDFaProcessor.PlainLiteralURI,
736
720
  value: content,
737
721
  language: language
738
722
  });
739
- } else {
740
- if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {
741
- this.addTriple(current, newSubject, _predicate2, {
742
- type: datatype,
743
- value: current.childNodes
744
- });
745
- } else {
746
- this.addTriple(current, newSubject, _predicate2, {
747
- type: datatype || RDFaProcessor.PlainLiteralURI,
748
- value: content,
749
- language: language
750
- });
751
- // console.log(newSubject+" "+predicate+"="+content)
752
- }
723
+ // console.log(newSubject+" "+predicate+"="+content)
753
724
  }
754
725
  }
755
726
  }
756
727
  }
757
- // Sequence Step 12: complete incomplete triples with new subject
758
- if (newSubject && !skip) {
759
- for (var _i14 = 0; _i14 < context.incomplete.length; _i14++) {
760
- if (context.incomplete[_i14].list) {
761
- // console.log("Adding subject "+newSubject+" to list for "+context.incomplete[i].predicate)
762
- // TODO: it is unclear what to do here
763
- context.incomplete[_i14].list.push({
764
- type: RDFaProcessor.objectURI,
765
- value: newSubject
766
- });
767
- } else if (context.incomplete[_i14].forward) {
768
- // console.log(current.tagName+": completing forward triple "+context.incomplete[i].predicate+" with object="+newSubject)
769
- this.addTriple(current, context.subject, context.incomplete[_i14].predicate, {
770
- type: RDFaProcessor.objectURI,
771
- value: newSubject
772
- });
773
- } else {
774
- // console.log(current.tagName+": completing reverse triple with object="+context.subject)
775
- this.addTriple(current, newSubject, context.incomplete[_i14].predicate, {
776
- type: RDFaProcessor.objectURI,
777
- value: context.subject
778
- });
779
- }
728
+ }
729
+ // Sequence Step 12: complete incomplete triples with new subject
730
+ if (newSubject && !skip) {
731
+ for (let i = 0; i < context.incomplete.length; i++) {
732
+ if (context.incomplete[i].list) {
733
+ // console.log("Adding subject "+newSubject+" to list for "+context.incomplete[i].predicate)
734
+ // TODO: it is unclear what to do here
735
+ context.incomplete[i].list.push({
736
+ type: RDFaProcessor.objectURI,
737
+ value: newSubject
738
+ });
739
+ } else if (context.incomplete[i].forward) {
740
+ // console.log(current.tagName+": completing forward triple "+context.incomplete[i].predicate+" with object="+newSubject)
741
+ this.addTriple(current, context.subject, context.incomplete[i].predicate, {
742
+ type: RDFaProcessor.objectURI,
743
+ value: newSubject
744
+ });
745
+ } else {
746
+ // console.log(current.tagName+": completing reverse triple with object="+context.subject)
747
+ this.addTriple(current, newSubject, context.incomplete[i].predicate, {
748
+ type: RDFaProcessor.objectURI,
749
+ value: context.subject
750
+ });
780
751
  }
781
752
  }
782
- var childContext = null;
783
- var listSubject = newSubject;
784
- if (skip) {
785
- // TODO: should subject be null?
786
- childContext = this.push(context, context.subject);
787
- // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.
788
- // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change
789
- childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
790
- childContext.incomplete = context.incomplete;
791
- childContext.language = language;
792
- childContext.prefixes = prefixes;
793
- childContext.vocabulary = vocabulary;
794
- } else {
795
- childContext = this.push(context, newSubject);
796
- childContext.parentObject = currentObjectResource || newSubject || context.subject;
797
- childContext.prefixes = prefixes;
798
- childContext.incomplete = incomplete;
799
- if (currentObjectResource) {
800
- // console.log("Generating new list mapping for "+currentObjectResource)
801
- listSubject = currentObjectResource;
802
- listMapping = {};
803
- listMappingDifferent = true;
804
- }
805
- childContext.listMapping = listMapping;
806
- childContext.language = language;
807
- childContext.vocabulary = vocabulary;
753
+ }
754
+ var childContext = null;
755
+ var listSubject = newSubject;
756
+ if (skip) {
757
+ // TODO: should subject be null?
758
+ childContext = this.push(context, context.subject);
759
+ // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.
760
+ // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change
761
+ childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
762
+ childContext.incomplete = context.incomplete;
763
+ childContext.language = language;
764
+ childContext.prefixes = prefixes;
765
+ childContext.vocabulary = vocabulary;
766
+ } else {
767
+ childContext = this.push(context, newSubject);
768
+ childContext.parentObject = currentObjectResource || newSubject || context.subject;
769
+ childContext.prefixes = prefixes;
770
+ childContext.incomplete = incomplete;
771
+ if (currentObjectResource) {
772
+ // console.log("Generating new list mapping for "+currentObjectResource)
773
+ listSubject = currentObjectResource;
774
+ listMapping = {};
775
+ listMappingDifferent = true;
808
776
  }
809
- if (listMappingDifferent) {
810
- // console.log("Pushing list parent "+current.localName)
777
+ childContext.listMapping = listMapping;
778
+ childContext.language = language;
779
+ childContext.vocabulary = vocabulary;
780
+ }
781
+ if (listMappingDifferent) {
782
+ // console.log("Pushing list parent "+current.localName)
783
+ queue.unshift({
784
+ parent: current,
785
+ context: context,
786
+ subject: listSubject,
787
+ listMapping: listMapping
788
+ });
789
+ }
790
+ for (var child = current.lastChild; child; child = child.previousSibling) {
791
+ if (child.nodeType === Node.ELEMENT_NODE) {
792
+ // console.log("Pushing child "+child.localName)
793
+ // child.baseURI = current.baseURI
811
794
  queue.unshift({
812
- parent: current,
813
- context: context,
814
- subject: listSubject,
815
- listMapping: listMapping
795
+ current: child,
796
+ context: childContext
816
797
  });
817
798
  }
818
- for (var child = current.lastChild; child; child = child.previousSibling) {
819
- if (child.nodeType === Node.ELEMENT_NODE) {
820
- // console.log("Pushing child "+child.localName)
821
- // child.baseURI = current.baseURI
822
- queue.unshift({
823
- current: child,
824
- context: childContext
825
- });
826
- }
827
- }
828
- }
829
- if (this.inHTMLMode) {
830
- this.copyProperties();
831
- }
832
- for (var _i15 = 0; _i15 < this.finishedHandlers.length; _i15++) {
833
- this.finishedHandlers[_i15](node);
834
799
  }
835
800
  }
836
- }, {
837
- key: "push",
838
- value: function push(parent, subject) {
839
- return {
840
- parent: parent,
841
- subject: subject || (parent ? parent.subject : null),
842
- parentObject: null,
843
- incomplete: [],
844
- listMapping: parent ? parent.listMapping : {},
845
- language: parent ? parent.language : this.language,
846
- prefixes: parent ? parent.prefixes : this.target.graph.prefixes,
847
- terms: parent ? parent.terms : this.target.graph.terms,
848
- vocabulary: parent ? parent.vocabulary : this.vocabulary
849
- };
801
+ if (this.inHTMLMode) {
802
+ this.copyProperties();
850
803
  }
851
- }, {
852
- key: "resolveAndNormalize",
853
- value: function resolveAndNormalize(base, uri) {
854
- // console.log("Joining " + uri + " to " + base + " making " + Uri.join(uri, base))
855
- return Uri.join(uri, base); // @@ normalize?
804
+ for (let i = 0; i < this.finishedHandlers.length; i++) {
805
+ this.finishedHandlers[i](node);
856
806
  }
857
- }, {
858
- key: "setContext",
859
- value: function setContext(node) {
860
- // We only recognized XHTML+RDFa 1.1 if the version is set propertyly
861
- if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {
862
- this.setXHTMLContext();
863
- } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {
864
- if (typeof document !== 'undefined' && document.doctype) {
865
- if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {
866
- console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.');
867
- this.setHTMLContext();
868
- } 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') {
869
- this.setXHTMLContext();
870
- } else {
871
- this.setHTMLContext();
872
- }
807
+ }
808
+ push(parent, subject) {
809
+ return {
810
+ parent: parent,
811
+ subject: subject || (parent ? parent.subject : null),
812
+ parentObject: null,
813
+ incomplete: [],
814
+ listMapping: parent ? parent.listMapping : {},
815
+ language: parent ? parent.language : this.language,
816
+ prefixes: parent ? parent.prefixes : this.target.graph.prefixes,
817
+ terms: parent ? parent.terms : this.target.graph.terms,
818
+ vocabulary: parent ? parent.vocabulary : this.vocabulary
819
+ };
820
+ }
821
+ resolveAndNormalize(base, uri) {
822
+ // console.log("Joining " + uri + " to " + base + " making " + Uri.join(uri, base))
823
+ return Uri.join(uri, base); // @@ normalize?
824
+ }
825
+ setContext(node) {
826
+ // We only recognized XHTML+RDFa 1.1 if the version is set propertyly
827
+ if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {
828
+ this.setXHTMLContext();
829
+ } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {
830
+ if (typeof document !== 'undefined' && document.doctype) {
831
+ if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {
832
+ console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.');
833
+ this.setHTMLContext();
834
+ } 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') {
835
+ this.setXHTMLContext();
873
836
  } else {
874
837
  this.setHTMLContext();
875
838
  }
876
839
  } else {
877
- this.setXMLContext();
840
+ this.setHTMLContext();
878
841
  }
842
+ } else {
843
+ this.setXMLContext();
879
844
  }
880
- }, {
881
- key: "setHTMLContext",
882
- value: function setHTMLContext() {
883
- this.setInitialContext();
884
- this.langAttributes = [{
885
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
886
- localName: 'lang'
887
- }, {
888
- namespaceURI: null,
889
- localName: 'lang'
890
- }];
891
- this.inXHTMLMode = false;
892
- this.inHTMLMode = true;
893
- }
894
- }, {
895
- key: "setInitialContext",
896
- value: function setInitialContext() {
897
- this.vocabulary = null;
898
- // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor
899
- this.langAttributes = [{
900
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
901
- localName: 'lang'
902
- }];
903
- }
904
- }, {
905
- key: "setXHTMLContext",
906
- value: function setXHTMLContext() {
907
- this.setInitialContext();
908
- this.inXHTMLMode = true;
909
- this.inHTMLMode = false;
910
- this.langAttributes = [{
911
- namespaceURI: 'http://www.w3.org/XML/1998/namespace',
912
- localName: 'lang'
913
- }, {
914
- namespaceURI: null,
915
- localName: 'lang'
916
- }];
917
- // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
918
- this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';
919
- this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';
920
- this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';
921
- this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';
922
- this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';
923
- this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';
924
- this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';
925
- this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';
926
- this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';
927
- this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';
928
- this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';
929
- this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';
930
- this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';
931
- this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';
932
- this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';
933
- this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';
934
- this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';
935
- this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';
936
- this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';
937
- this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';
938
- this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';
939
- this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';
940
- this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';
941
- this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';
942
- this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1';
943
- // other
944
- this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';
945
- this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';
946
- this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';
947
- }
948
- }, {
949
- key: "setXMLContext",
950
- value: function setXMLContext() {
951
- this.setInitialContext();
952
- this.inXHTMLMode = false;
953
- this.inHTMLMode = false;
954
- }
955
- }, {
956
- key: "tokenize",
957
- value: function tokenize(str) {
958
- return this.trim(str).split(/\s+/);
959
- }
960
- }, {
961
- key: "toRDFNodeObject",
962
- value: function toRDFNodeObject(x) {
963
- var _this = this;
964
- if (typeof x === 'undefined') return undefined;
965
- if (typeof x === 'string') {
966
- if (x.substring(0, 2) === '_:') {
967
- if (typeof this.blankNodes[x.substring(2)] === 'undefined') {
968
- this.blankNodes[x.substring(2)] = new _blankNode.default(x.substring(2));
969
- }
970
- return this.blankNodes[x.substring(2)];
971
- }
972
- return _canonicalDataFactory.default.namedNode(x);
973
- }
974
- switch (x.type) {
975
- case RDFaProcessor.objectURI:
976
- if (x.value.substring(0, 2) === '_:') {
977
- if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {
978
- this.blankNodes[x.value.substring(2)] = new _blankNode.default(x.value.substring(2));
979
- }
980
- return this.blankNodes[x.value.substring(2)];
981
- }
982
- return _canonicalDataFactory.default.namedNode(x.value);
983
- case RDFaProcessor.PlainLiteralURI:
984
- return new _literal.default(x.value, x.language || '');
985
- case RDFaProcessor.XMLLiteralURI:
986
- case RDFaProcessor.HTMLLiteralURI:
987
- var string = '';
988
- Object.keys(x.value).forEach(function (i) {
989
- string += Util.domToString(x.value[i], _this.htmlOptions);
990
- });
991
- return new _literal.default(string, '', new _namedNode.default(x.type));
992
- default:
993
- return new _literal.default(x.value, '', new _namedNode.default(x.type));
994
- }
995
- }
996
- }, {
997
- key: "trim",
998
- value: function trim(str) {
999
- return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
1000
- }
1001
- }], [{
1002
- key: "parseRDFaDOM",
1003
- value: function parseRDFaDOM(dom, kb, base) {
1004
- var p = new RDFaProcessor(kb, {
1005
- 'base': base
1006
- });
1007
- // Cannot assign to read only property 'baseURI' of object '#<XMLDocument>':
1008
- if (!dom.baseURI) {
1009
- // Note this became a read-only attribute some time before 2018
1010
- dom.baseURI = base; // oinly set if not already set
845
+ }
846
+ setHTMLContext() {
847
+ this.setInitialContext();
848
+ this.langAttributes = [{
849
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
850
+ localName: 'lang'
851
+ }, {
852
+ namespaceURI: null,
853
+ localName: 'lang'
854
+ }];
855
+ this.inXHTMLMode = false;
856
+ this.inHTMLMode = true;
857
+ }
858
+ setInitialContext() {
859
+ this.vocabulary = null;
860
+ // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor
861
+ this.langAttributes = [{
862
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
863
+ localName: 'lang'
864
+ }];
865
+ }
866
+ setXHTMLContext() {
867
+ this.setInitialContext();
868
+ this.inXHTMLMode = true;
869
+ this.inHTMLMode = false;
870
+ this.langAttributes = [{
871
+ namespaceURI: 'http://www.w3.org/XML/1998/namespace',
872
+ localName: 'lang'
873
+ }, {
874
+ namespaceURI: null,
875
+ localName: 'lang'
876
+ }];
877
+ // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
878
+ this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';
879
+ this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';
880
+ this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';
881
+ this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';
882
+ this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';
883
+ this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';
884
+ this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';
885
+ this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';
886
+ this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';
887
+ this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';
888
+ this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';
889
+ this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';
890
+ this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';
891
+ this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';
892
+ this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';
893
+ this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';
894
+ this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';
895
+ this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';
896
+ this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';
897
+ this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';
898
+ this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';
899
+ this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';
900
+ this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';
901
+ this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';
902
+ this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1';
903
+ // other
904
+ this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';
905
+ this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';
906
+ this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';
907
+ }
908
+ setXMLContext() {
909
+ this.setInitialContext();
910
+ this.inXHTMLMode = false;
911
+ this.inHTMLMode = false;
912
+ }
913
+ tokenize(str) {
914
+ return this.trim(str).split(/\s+/);
915
+ }
916
+ static tokenize(str) {
917
+ return this.trim(str).split(/\s+/);
918
+ }
919
+ toRDFNodeObject(x) {
920
+ if (typeof x === 'undefined') return undefined;
921
+ if (typeof x === 'string') {
922
+ if (x.substring(0, 2) === '_:') {
923
+ if (typeof this.blankNodes[x.substring(2)] === 'undefined') {
924
+ this.blankNodes[x.substring(2)] = new _blankNode.default(x.substring(2));
925
+ }
926
+ return this.blankNodes[x.substring(2)];
1011
927
  }
1012
-
1013
- p.process(dom, {
1014
- baseURI: base
1015
- });
1016
- }
1017
- }, {
1018
- key: "tokenize",
1019
- value: function tokenize(str) {
1020
- return this.trim(str).split(/\s+/);
928
+ return _canonicalDataFactory.default.namedNode(x);
1021
929
  }
1022
- }, {
1023
- key: "trim",
1024
- value: function trim(str) {
1025
- return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
930
+ switch (x.type) {
931
+ case RDFaProcessor.objectURI:
932
+ if (x.value.substring(0, 2) === '_:') {
933
+ if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {
934
+ this.blankNodes[x.value.substring(2)] = new _blankNode.default(x.value.substring(2));
935
+ }
936
+ return this.blankNodes[x.value.substring(2)];
937
+ }
938
+ return _canonicalDataFactory.default.namedNode(x.value);
939
+ case RDFaProcessor.PlainLiteralURI:
940
+ return new _literal.default(x.value, x.language || '');
941
+ case RDFaProcessor.XMLLiteralURI:
942
+ case RDFaProcessor.HTMLLiteralURI:
943
+ var string = '';
944
+ Object.keys(x.value).forEach(i => {
945
+ string += Util.domToString(x.value[i], this.htmlOptions);
946
+ });
947
+ return new _literal.default(string, '', new _namedNode.default(x.type));
948
+ default:
949
+ return new _literal.default(x.value, '', new _namedNode.default(x.type));
1026
950
  }
1027
- }]);
1028
- return RDFaProcessor;
1029
- }();
951
+ }
952
+ trim(str) {
953
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
954
+ }
955
+ static trim(str) {
956
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
957
+ }
958
+ }
1030
959
  exports.default = RDFaProcessor;
1031
960
  RDFaProcessor.XMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral';
1032
961
  RDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML';
1033
962
  RDFaProcessor.PlainLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral';
1034
963
  RDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object';
1035
964
  RDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
1036
- 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]";
1037
- 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_]";
965
+ 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]';
966
+ 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_]';
1038
967
  RDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar + RDFaProcessor.nameChar + '*$');
1039
968
 
1040
969
  /*
@@ -1065,5 +994,4 @@ RDFaProcessor.dateTimeTypes = [{
1065
994
  pattern: /-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,
1066
995
  type: 'http://www.w3.org/2001/XMLSchema#gYear'
1067
996
  }];
1068
- var parseRDFaDOM = RDFaProcessor.parseRDFaDOM;
1069
- exports.parseRDFaDOM = parseRDFaDOM;
997
+ const parseRDFaDOM = exports.parseRDFaDOM = RDFaProcessor.parseRDFaDOM;