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.
- package/dist/515.rdflib.min.js +3 -0
- package/dist/515.rdflib.min.js.map +1 -0
- package/dist/789.rdflib.min.js +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -2
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +57 -85
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -106
- package/esm/default-graph.js +13 -33
- package/esm/empty.js +8 -26
- package/esm/factories/canonical-data-factory.js +33 -30
- package/esm/factories/extended-term-factory.js +18 -14
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +9 -11
- package/esm/fetcher.js +1364 -1668
- package/esm/formula.js +631 -739
- package/esm/index.js +31 -51
- package/esm/jsonldparser.js +19 -26
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +41 -86
- package/esm/literal.js +120 -157
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1008 -1090
- package/esm/named-node.js +69 -99
- package/esm/namespace.js +2 -4
- package/esm/node-internal.js +73 -97
- package/esm/node.js +1 -2
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -2
- package/esm/query.js +15 -30
- package/esm/rdfaparser.js +775 -846
- package/esm/rdfxmlparser.js +348 -365
- package/esm/serialize.js +2 -3
- package/esm/serializer.js +834 -889
- package/esm/sparql-to-query.js +0 -2
- package/esm/statement.js +52 -72
- package/esm/store.js +852 -963
- package/esm/types.js +26 -21
- package/esm/update-manager.js +963 -1104
- package/esm/updates-via.js +104 -134
- package/esm/uri.js +3 -3
- package/esm/utils/default-graph-uri.js +2 -2
- package/esm/utils/terms.js +4 -5
- package/esm/utils-js.js +5 -6
- package/esm/utils.js +7 -6
- package/esm/variable.js +32 -58
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +56 -83
- package/lib/class-order.js +2 -3
- package/lib/collection.js +69 -104
- package/lib/default-graph.js +13 -32
- package/lib/empty.js +8 -25
- package/lib/factories/canonical-data-factory.js +36 -34
- package/lib/factories/extended-term-factory.js +19 -16
- package/lib/factories/factory-types.js +2 -3
- package/lib/factories/rdflib-data-factory.js +10 -13
- package/lib/fetcher.js +1394 -1693
- package/lib/formula.js +631 -738
- package/lib/index.js +66 -89
- package/lib/jsonldparser.js +21 -32
- package/lib/jsonparser.js +3 -4
- package/lib/lists.js +47 -87
- package/lib/literal.js +120 -156
- package/lib/log.js +8 -9
- package/lib/n3parser.js +1011 -1096
- package/lib/named-node.js +69 -98
- package/lib/namespace.js +2 -4
- package/lib/node-internal.js +72 -95
- package/lib/node.js +2 -4
- package/lib/parse.js +5 -6
- package/lib/patch-parser.js +1 -2
- package/lib/query.js +19 -32
- package/lib/rdfaparser.js +777 -849
- package/lib/rdfxmlparser.js +350 -366
- package/lib/serialize.js +2 -3
- package/lib/serializer.js +838 -892
- package/lib/sparql-to-query.js +0 -2
- package/lib/statement.js +54 -74
- package/lib/store.js +873 -978
- package/lib/types.js +22 -43
- package/lib/update-manager.js +972 -1111
- package/lib/updates-via.js +105 -134
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -4
- package/lib/utils/terms.js +4 -6
- package/lib/utils-js.js +11 -13
- package/lib/utils.js +6 -7
- package/lib/variable.js +34 -60
- package/lib/xsd-internal.js +2 -3
- package/lib/xsd.js +3 -4
- package/package.json +31 -31
- package/src/n3parser.js +1 -1
- package/src/rdfxmlparser.js +2 -1
- package/src/serializer.js +1 -1
- package/.babelrc +0 -20
- package/dist/670.rdflib.min.js +0 -1
- package/dist/730.rdflib.min.js +0 -3
- package/dist/730.rdflib.min.js.map +0 -1
- /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(
|
|
18
|
-
function _interopRequireWildcard(
|
|
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
|
-
|
|
51
|
-
|
|
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
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
return
|
|
195
|
+
if (value === '_:') {
|
|
196
|
+
// the one node
|
|
197
|
+
return this.theOne;
|
|
184
198
|
}
|
|
185
|
-
return
|
|
199
|
+
return this.parseCURIE(value, prefixes, base);
|
|
200
|
+
} else {
|
|
201
|
+
return this.parseCURIEOrURI(value, prefixes, base);
|
|
186
202
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
value
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
244
|
-
|
|
240
|
+
var lcvalue = value.toLowerCase();
|
|
241
|
+
term = terms[lcvalue];
|
|
242
|
+
if (term) {
|
|
243
|
+
return term;
|
|
245
244
|
}
|
|
246
|
-
|
|
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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (!
|
|
282
|
-
|
|
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
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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:
|
|
308
|
+
value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
354
309
|
});
|
|
310
|
+
continue;
|
|
355
311
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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:
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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
|
-
|
|
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
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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 (
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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
|
-
|
|
497
|
+
typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
|
|
490
498
|
}
|
|
491
|
-
if (!
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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 (
|
|
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
|
-
|
|
506
|
-
|
|
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
|
-
|
|
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
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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
|
-
|
|
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
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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
|
-
|
|
571
|
-
|
|
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
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
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
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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
|
-
|
|
639
|
-
|
|
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
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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 (
|
|
666
|
-
|
|
667
|
-
incomplete.push({
|
|
668
|
-
predicate: revAttPredicates[_i12],
|
|
669
|
-
forward: false
|
|
670
|
-
});
|
|
671
|
-
}
|
|
675
|
+
if (content) {
|
|
676
|
+
datatype = RDFaProcessor.objectURI;
|
|
672
677
|
}
|
|
673
678
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
if (
|
|
681
|
-
|
|
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
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
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
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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
|
-
|
|
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
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
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
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
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
|
-
|
|
810
|
-
|
|
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
|
-
|
|
813
|
-
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
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.
|
|
840
|
+
this.setHTMLContext();
|
|
878
841
|
}
|
|
842
|
+
} else {
|
|
843
|
+
this.setXMLContext();
|
|
879
844
|
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
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
|
-
|
|
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 =
|
|
1037
|
-
RDFaProcessor.nameStartChar =
|
|
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
|
-
|
|
1069
|
-
exports.parseRDFaDOM = parseRDFaDOM;
|
|
997
|
+
const parseRDFaDOM = exports.parseRDFaDOM = RDFaProcessor.parseRDFaDOM;
|