rdflib 2.2.35 → 2.2.36
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/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 -82
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -103
- package/esm/default-graph.js +13 -30
- package/esm/empty.js +8 -23
- package/esm/factories/canonical-data-factory.js +33 -29
- package/esm/factories/extended-term-factory.js +18 -13
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +9 -11
- package/esm/fetcher.js +1366 -1651
- package/esm/formula.js +631 -736
- package/esm/index.js +31 -48
- package/esm/jsonldparser.js +19 -26
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +38 -86
- package/esm/literal.js +120 -154
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1009 -1086
- package/esm/named-node.js +69 -96
- package/esm/namespace.js +2 -4
- package/esm/node-internal.js +73 -96
- package/esm/node.js +1 -1
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -1
- package/esm/query.js +15 -16
- package/esm/rdfaparser.js +775 -841
- package/esm/rdfxmlparser.js +348 -364
- package/esm/serialize.js +2 -2
- package/esm/serializer.js +835 -877
- package/esm/statement.js +52 -71
- package/esm/store.js +853 -957
- package/esm/types.js +21 -21
- package/esm/update-manager.js +965 -1100
- package/esm/updates-via.js +104 -132
- 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 -5
- package/esm/utils.js +6 -6
- package/esm/variable.js +32 -55
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +57 -80
- package/lib/class-order.js +1 -1
- package/lib/collection.js +70 -101
- package/lib/default-graph.js +14 -29
- package/lib/empty.js +9 -22
- package/lib/factories/canonical-data-factory.js +35 -31
- package/lib/factories/extended-term-factory.js +18 -13
- package/lib/factories/factory-types.js +1 -1
- package/lib/factories/rdflib-data-factory.js +9 -11
- package/lib/fetcher.js +1375 -1654
- package/lib/formula.js +632 -735
- package/lib/index.js +80 -84
- package/lib/jsonldparser.js +21 -32
- package/lib/jsonparser.js +1 -1
- package/lib/lists.js +47 -87
- package/lib/literal.js +121 -153
- package/lib/log.js +7 -7
- package/lib/n3parser.js +1012 -1090
- package/lib/named-node.js +70 -95
- package/lib/namespace.js +2 -4
- package/lib/node-internal.js +73 -94
- package/lib/node.js +1 -1
- package/lib/parse.js +5 -6
- package/lib/patch-parser.js +1 -1
- package/lib/query.js +20 -18
- package/lib/rdfaparser.js +778 -843
- package/lib/rdfxmlparser.js +351 -365
- package/lib/serialize.js +2 -2
- package/lib/serializer.js +840 -880
- package/lib/statement.js +55 -73
- package/lib/store.js +860 -958
- package/lib/types.js +21 -21
- package/lib/update-manager.js +970 -1102
- package/lib/updates-via.js +107 -132
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -2
- package/lib/utils/terms.js +4 -6
- package/lib/utils-js.js +8 -9
- package/lib/utils.js +6 -6
- package/lib/variable.js +35 -57
- package/lib/xsd.js +2 -2
- package/package.json +2 -2
- package/src/n3parser.js +1 -1
- package/src/serializer.js +1 -1
- package/src/update-manager.ts +2 -1
- package/.babelrc +0 -20
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(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
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,957 +74,896 @@ var RDFaProcessor = exports.default = /*#__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
|
-
base = node.baseURI;
|
|
291
|
-
node = node.documentElement;
|
|
292
|
-
if (!node.baseURI) {
|
|
293
|
-
node.baseURI = base;
|
|
294
|
-
}
|
|
295
|
-
this.setContext(node);
|
|
296
|
-
} else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {
|
|
297
|
-
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;
|
|
298
280
|
}
|
|
299
|
-
var
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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;
|
|
312
301
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
});
|
|
319
|
-
while (queue.length > 0) {
|
|
320
|
-
var item = queue.shift();
|
|
321
|
-
if (item.parent) {
|
|
322
|
-
// Sequence Step 14: list triple generation
|
|
323
|
-
if (item.context.parent && item.context.parent.listMapping === item.listMapping) {
|
|
324
|
-
// Skip a child context with exactly the same mapping
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
// console.log("Generating lists for "+item.subject+", tag "+item.parent.localName)
|
|
328
|
-
for (var _predicate in item.listMapping) {
|
|
329
|
-
var list = item.listMapping[_predicate];
|
|
330
|
-
if (list.length === 0) {
|
|
331
|
-
this.addTriple(item.parent, item.subject, _predicate, {
|
|
332
|
-
type: RDFaProcessor.objectURI,
|
|
333
|
-
value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
334
|
-
});
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
var bnodes = [];
|
|
338
|
-
for (var _i = 0; _i < list.length; _i++) {
|
|
339
|
-
bnodes.push(this.newBlankNode());
|
|
340
|
-
// this.newSubject(item.parent,bnodes[i])
|
|
341
|
-
}
|
|
342
|
-
for (var _i2 = 0; _i2 < bnodes.length; _i2++) {
|
|
343
|
-
this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[_i2]);
|
|
344
|
-
this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
|
|
345
|
-
type: RDFaProcessor.objectURI,
|
|
346
|
-
value: _i2 + 1 < bnodes.length ? bnodes[_i2 + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
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, {
|
|
350
307
|
type: RDFaProcessor.objectURI,
|
|
351
|
-
value:
|
|
308
|
+
value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
352
309
|
});
|
|
310
|
+
continue;
|
|
353
311
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
var currentObjectResource = null;
|
|
363
|
-
var typedResource = null;
|
|
364
|
-
var prefixes = context.prefixes;
|
|
365
|
-
var prefixesCopied = false;
|
|
366
|
-
var incomplete = [];
|
|
367
|
-
var listMapping = context.listMapping;
|
|
368
|
-
var listMappingDifferent = !context.parent;
|
|
369
|
-
var language = context.language;
|
|
370
|
-
var vocabulary = context.vocabulary;
|
|
371
|
-
// TODO: the "base" element may be used for HTML+RDFa 1.1
|
|
372
|
-
base = this.parseURI(removeHash(current.baseURI));
|
|
373
|
-
current.item = null;
|
|
374
|
-
// Sequence Step 2: set the default vocabulary
|
|
375
|
-
var vocabAtt = current.getAttributeNode('vocab');
|
|
376
|
-
if (vocabAtt) {
|
|
377
|
-
var value = this.trim(vocabAtt.value);
|
|
378
|
-
if (value.length > 0) {
|
|
379
|
-
vocabulary = value;
|
|
380
|
-
var baseSubject = base.spec;
|
|
381
|
-
// this.newSubject(current,baseSubject)
|
|
382
|
-
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', {
|
|
383
320
|
type: RDFaProcessor.objectURI,
|
|
384
|
-
value:
|
|
321
|
+
value: i + 1 < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
385
322
|
});
|
|
386
|
-
} else {
|
|
387
|
-
vocabulary = this.vocabulary;
|
|
388
323
|
}
|
|
324
|
+
this.addTriple(item.parent, item.subject, predicate, {
|
|
325
|
+
type: RDFaProcessor.objectURI,
|
|
326
|
+
value: bnodes[0]
|
|
327
|
+
});
|
|
389
328
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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;
|
|
405
363
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
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) {
|
|
409
371
|
if (!prefixesCopied) {
|
|
410
372
|
prefixes = this.copyMappings(prefixes);
|
|
411
373
|
prefixesCopied = true;
|
|
412
374
|
}
|
|
413
|
-
|
|
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;
|
|
414
379
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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;
|
|
419
401
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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);
|
|
426
423
|
}
|
|
427
424
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
var srcAtt = current.getAttributeNode('src');
|
|
437
|
-
var resourceAtt = current.getAttributeNode('resource');
|
|
438
|
-
var hrefAtt = current.getAttributeNode('href');
|
|
439
|
-
var inlistAtt = current.getAttributeNode('inlist');
|
|
440
|
-
var relAttPredicates = [];
|
|
441
|
-
var predicate, values;
|
|
442
|
-
if (relAtt) {
|
|
443
|
-
values = this.tokenize(relAtt.value);
|
|
444
|
-
for (var _i4 = 0; _i4 < values.length; _i4++) {
|
|
445
|
-
predicate = this.parsePredicate(values[_i4], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);
|
|
446
|
-
if (predicate) {
|
|
447
|
-
relAttPredicates.push(predicate);
|
|
448
|
-
}
|
|
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);
|
|
449
433
|
}
|
|
450
434
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
if (predicate) {
|
|
457
|
-
revAttPredicates.push(predicate);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
435
|
+
}
|
|
436
|
+
// Section 3.1, bullet 7
|
|
437
|
+
if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {
|
|
438
|
+
if (relAttPredicates.length === 0) {
|
|
439
|
+
relAtt = null;
|
|
460
440
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
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;
|
|
468
459
|
}
|
|
469
460
|
}
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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();
|
|
474
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);
|
|
475
482
|
if (typeofAtt) {
|
|
476
483
|
typedResource = newSubject;
|
|
477
484
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
|
|
484
|
-
}
|
|
485
|
+
}
|
|
486
|
+
if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {
|
|
487
|
+
newSubject = removeHash(current.baseURI);
|
|
488
|
+
if (typeofAtt) {
|
|
489
|
+
typedResource = newSubject;
|
|
485
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) {
|
|
486
496
|
if (resourceAtt) {
|
|
487
|
-
|
|
497
|
+
typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
|
|
488
498
|
}
|
|
489
|
-
if (!
|
|
490
|
-
|
|
491
|
-
currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
|
|
492
|
-
} else if (srcAtt) {
|
|
493
|
-
currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
|
|
494
|
-
} else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {
|
|
495
|
-
currentObjectResource = this.newBlankNode();
|
|
496
|
-
}
|
|
499
|
+
if (!typedResource && hrefAtt) {
|
|
500
|
+
typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
|
|
497
501
|
}
|
|
498
|
-
if (
|
|
502
|
+
if (!typedResource && srcAtt) {
|
|
503
|
+
typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
|
|
504
|
+
}
|
|
505
|
+
if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
|
|
499
506
|
typedResource = newSubject;
|
|
500
|
-
} else if (typeofAtt && !aboutAtt) {
|
|
501
|
-
typedResource = currentObjectResource;
|
|
502
507
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (aboutAtt) {
|
|
506
|
-
newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
|
|
507
|
-
if (typeofAtt) {
|
|
508
|
-
typedResource = newSubject;
|
|
509
|
-
}
|
|
508
|
+
if (!typedResource) {
|
|
509
|
+
typedResource = this.newBlankNode();
|
|
510
510
|
}
|
|
511
|
-
|
|
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) {
|
|
512
530
|
newSubject = removeHash(current.baseURI);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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) {
|
|
517
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
|
|
518
537
|
newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (resourceAtt) {
|
|
522
|
-
typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
|
|
523
|
-
}
|
|
524
|
-
if (!typedResource && hrefAtt) {
|
|
525
|
-
typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
|
|
526
|
-
}
|
|
527
|
-
if (!typedResource && srcAtt) {
|
|
528
|
-
typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
|
|
538
|
+
if (!propertyAtt) {
|
|
539
|
+
skip = true;
|
|
529
540
|
}
|
|
530
|
-
if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {
|
|
531
|
-
typedResource = newSubject;
|
|
532
|
-
}
|
|
533
|
-
if (!typedResource) {
|
|
534
|
-
typedResource = this.newBlankNode();
|
|
535
|
-
}
|
|
536
|
-
currentObjectResource = typedResource;
|
|
537
|
-
}
|
|
538
|
-
// console.log(current.localName+", newSubject="+newSubject+", typedResource="+typedResource+", currentObjectResource="+currentObjectResource)
|
|
539
|
-
} else {
|
|
540
|
-
// Sequence Step 5.2: establish a new subject
|
|
541
|
-
if (aboutAtt) {
|
|
542
|
-
newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);
|
|
543
541
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
+
});
|
|
552
570
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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
|
+
});
|
|
567
593
|
}
|
|
568
|
-
|
|
569
|
-
|
|
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
|
+
});
|
|
570
600
|
}
|
|
571
601
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {
|
|
579
|
-
id = currentObjectResource;
|
|
580
|
-
}
|
|
581
|
-
// console.log("Setting data attribute for "+current.localName+" for subject "+id)
|
|
582
|
-
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
|
+
});
|
|
583
608
|
}
|
|
584
609
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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
|
+
});
|
|
596
635
|
}
|
|
597
636
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
637
|
+
if (revAtt) {
|
|
638
|
+
for (let i = 0; i < revAttPredicates.length; i++) {
|
|
639
|
+
incomplete.push({
|
|
640
|
+
predicate: revAttPredicates[i],
|
|
641
|
+
forward: false
|
|
642
|
+
});
|
|
643
|
+
}
|
|
604
644
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
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;
|
|
626
665
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
type: RDFaProcessor.objectURI,
|
|
631
|
-
value: newSubject
|
|
632
|
-
});
|
|
633
|
-
}
|
|
666
|
+
} else if (!relAtt && !revAtt) {
|
|
667
|
+
if (resourceAtt) {
|
|
668
|
+
content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
|
|
634
669
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
// alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
|
|
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));
|
|
640
674
|
}
|
|
641
|
-
if (
|
|
642
|
-
|
|
643
|
-
var _list2 = listMapping[relAttPredicates[_i10]];
|
|
644
|
-
if (!_list2) {
|
|
645
|
-
_list2 = [];
|
|
646
|
-
listMapping[predicate] = _list2;
|
|
647
|
-
}
|
|
648
|
-
// console.log("Adding incomplete list for "+predicate)
|
|
649
|
-
incomplete.push({
|
|
650
|
-
predicate: relAttPredicates[_i10],
|
|
651
|
-
list: _list2
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
} else if (relAtt) {
|
|
655
|
-
for (var _i11 = 0; _i11 < relAttPredicates.length; _i11++) {
|
|
656
|
-
incomplete.push({
|
|
657
|
-
predicate: relAttPredicates[_i11],
|
|
658
|
-
forward: true
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
if (revAtt) {
|
|
663
|
-
for (var _i12 = 0; _i12 < revAttPredicates.length; _i12++) {
|
|
664
|
-
incomplete.push({
|
|
665
|
-
predicate: revAttPredicates[_i12],
|
|
666
|
-
forward: false
|
|
667
|
-
});
|
|
668
|
-
}
|
|
675
|
+
if (content) {
|
|
676
|
+
datatype = RDFaProcessor.objectURI;
|
|
669
677
|
}
|
|
670
678
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
} else {
|
|
680
|
-
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);
|
|
681
687
|
}
|
|
682
|
-
} else if (contentAtt) {
|
|
683
|
-
datatype = RDFaProcessor.PlainLiteralURI;
|
|
684
|
-
content = contentAtt.value;
|
|
685
|
-
} else if (datetimeAtt) {
|
|
686
|
-
content = datetimeAtt.value;
|
|
687
|
-
datatype = RDFaProcessor.deriveDateTimeType(content);
|
|
688
688
|
if (!datatype) {
|
|
689
689
|
datatype = RDFaProcessor.PlainLiteralURI;
|
|
690
690
|
}
|
|
691
|
-
} else if (!relAtt && !revAtt) {
|
|
692
|
-
if (resourceAtt) {
|
|
693
|
-
content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);
|
|
694
|
-
}
|
|
695
|
-
if (!content && hrefAtt) {
|
|
696
|
-
content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));
|
|
697
|
-
} else if (!content && srcAtt) {
|
|
698
|
-
content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));
|
|
699
|
-
}
|
|
700
|
-
if (content) {
|
|
701
|
-
datatype = RDFaProcessor.objectURI;
|
|
702
|
-
}
|
|
703
691
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
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;
|
|
715
702
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
_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, {
|
|
729
714
|
type: datatype,
|
|
730
715
|
value: current.childNodes
|
|
731
|
-
}
|
|
716
|
+
});
|
|
717
|
+
} else {
|
|
718
|
+
this.addTriple(current, newSubject, predicate, {
|
|
732
719
|
type: datatype || RDFaProcessor.PlainLiteralURI,
|
|
733
720
|
value: content,
|
|
734
721
|
language: language
|
|
735
722
|
});
|
|
736
|
-
|
|
737
|
-
if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {
|
|
738
|
-
this.addTriple(current, newSubject, _predicate2, {
|
|
739
|
-
type: datatype,
|
|
740
|
-
value: current.childNodes
|
|
741
|
-
});
|
|
742
|
-
} else {
|
|
743
|
-
this.addTriple(current, newSubject, _predicate2, {
|
|
744
|
-
type: datatype || RDFaProcessor.PlainLiteralURI,
|
|
745
|
-
value: content,
|
|
746
|
-
language: language
|
|
747
|
-
});
|
|
748
|
-
// console.log(newSubject+" "+predicate+"="+content)
|
|
749
|
-
}
|
|
723
|
+
// console.log(newSubject+" "+predicate+"="+content)
|
|
750
724
|
}
|
|
751
725
|
}
|
|
752
726
|
}
|
|
753
727
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
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
|
+
});
|
|
777
751
|
}
|
|
778
752
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
childContext.listMapping = listMapping;
|
|
803
|
-
childContext.language = language;
|
|
804
|
-
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;
|
|
805
776
|
}
|
|
806
|
-
|
|
807
|
-
|
|
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
|
|
808
794
|
queue.unshift({
|
|
809
|
-
|
|
810
|
-
context:
|
|
811
|
-
subject: listSubject,
|
|
812
|
-
listMapping: listMapping
|
|
795
|
+
current: child,
|
|
796
|
+
context: childContext
|
|
813
797
|
});
|
|
814
798
|
}
|
|
815
|
-
for (var child = current.lastChild; child; child = child.previousSibling) {
|
|
816
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
817
|
-
// console.log("Pushing child "+child.localName)
|
|
818
|
-
// child.baseURI = current.baseURI
|
|
819
|
-
queue.unshift({
|
|
820
|
-
current: child,
|
|
821
|
-
context: childContext
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
if (this.inHTMLMode) {
|
|
827
|
-
this.copyProperties();
|
|
828
|
-
}
|
|
829
|
-
for (var _i15 = 0; _i15 < this.finishedHandlers.length; _i15++) {
|
|
830
|
-
this.finishedHandlers[_i15](node);
|
|
831
799
|
}
|
|
832
800
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
value: function push(parent, subject) {
|
|
836
|
-
return {
|
|
837
|
-
parent: parent,
|
|
838
|
-
subject: subject || (parent ? parent.subject : null),
|
|
839
|
-
parentObject: null,
|
|
840
|
-
incomplete: [],
|
|
841
|
-
listMapping: parent ? parent.listMapping : {},
|
|
842
|
-
language: parent ? parent.language : this.language,
|
|
843
|
-
prefixes: parent ? parent.prefixes : this.target.graph.prefixes,
|
|
844
|
-
terms: parent ? parent.terms : this.target.graph.terms,
|
|
845
|
-
vocabulary: parent ? parent.vocabulary : this.vocabulary
|
|
846
|
-
};
|
|
801
|
+
if (this.inHTMLMode) {
|
|
802
|
+
this.copyProperties();
|
|
847
803
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
value: function resolveAndNormalize(base, uri) {
|
|
851
|
-
// console.log("Joining " + uri + " to " + base + " making " + Uri.join(uri, base))
|
|
852
|
-
return Uri.join(uri, base); // @@ normalize?
|
|
804
|
+
for (let i = 0; i < this.finishedHandlers.length; i++) {
|
|
805
|
+
this.finishedHandlers[i](node);
|
|
853
806
|
}
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
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();
|
|
870
836
|
} else {
|
|
871
837
|
this.setHTMLContext();
|
|
872
838
|
}
|
|
873
839
|
} else {
|
|
874
|
-
this.
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}, {
|
|
878
|
-
key: "setHTMLContext",
|
|
879
|
-
value: function setHTMLContext() {
|
|
880
|
-
this.setInitialContext();
|
|
881
|
-
this.langAttributes = [{
|
|
882
|
-
namespaceURI: 'http://www.w3.org/XML/1998/namespace',
|
|
883
|
-
localName: 'lang'
|
|
884
|
-
}, {
|
|
885
|
-
namespaceURI: null,
|
|
886
|
-
localName: 'lang'
|
|
887
|
-
}];
|
|
888
|
-
this.inXHTMLMode = false;
|
|
889
|
-
this.inHTMLMode = true;
|
|
890
|
-
}
|
|
891
|
-
}, {
|
|
892
|
-
key: "setInitialContext",
|
|
893
|
-
value: function setInitialContext() {
|
|
894
|
-
this.vocabulary = null;
|
|
895
|
-
// By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor
|
|
896
|
-
this.langAttributes = [{
|
|
897
|
-
namespaceURI: 'http://www.w3.org/XML/1998/namespace',
|
|
898
|
-
localName: 'lang'
|
|
899
|
-
}];
|
|
900
|
-
}
|
|
901
|
-
}, {
|
|
902
|
-
key: "setXHTMLContext",
|
|
903
|
-
value: function setXHTMLContext() {
|
|
904
|
-
this.setInitialContext();
|
|
905
|
-
this.inXHTMLMode = true;
|
|
906
|
-
this.inHTMLMode = false;
|
|
907
|
-
this.langAttributes = [{
|
|
908
|
-
namespaceURI: 'http://www.w3.org/XML/1998/namespace',
|
|
909
|
-
localName: 'lang'
|
|
910
|
-
}, {
|
|
911
|
-
namespaceURI: null,
|
|
912
|
-
localName: 'lang'
|
|
913
|
-
}];
|
|
914
|
-
// From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1
|
|
915
|
-
this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';
|
|
916
|
-
this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';
|
|
917
|
-
this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';
|
|
918
|
-
this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';
|
|
919
|
-
this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';
|
|
920
|
-
this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';
|
|
921
|
-
this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';
|
|
922
|
-
this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';
|
|
923
|
-
this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';
|
|
924
|
-
this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';
|
|
925
|
-
this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';
|
|
926
|
-
this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';
|
|
927
|
-
this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';
|
|
928
|
-
this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';
|
|
929
|
-
this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';
|
|
930
|
-
this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';
|
|
931
|
-
this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';
|
|
932
|
-
this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';
|
|
933
|
-
this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';
|
|
934
|
-
this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';
|
|
935
|
-
this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';
|
|
936
|
-
this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';
|
|
937
|
-
this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';
|
|
938
|
-
this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';
|
|
939
|
-
this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1';
|
|
940
|
-
// other
|
|
941
|
-
this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';
|
|
942
|
-
this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';
|
|
943
|
-
this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';
|
|
944
|
-
}
|
|
945
|
-
}, {
|
|
946
|
-
key: "setXMLContext",
|
|
947
|
-
value: function setXMLContext() {
|
|
948
|
-
this.setInitialContext();
|
|
949
|
-
this.inXHTMLMode = false;
|
|
950
|
-
this.inHTMLMode = false;
|
|
951
|
-
}
|
|
952
|
-
}, {
|
|
953
|
-
key: "tokenize",
|
|
954
|
-
value: function tokenize(str) {
|
|
955
|
-
return this.trim(str).split(/\s+/);
|
|
956
|
-
}
|
|
957
|
-
}, {
|
|
958
|
-
key: "toRDFNodeObject",
|
|
959
|
-
value: function toRDFNodeObject(x) {
|
|
960
|
-
var _this = this;
|
|
961
|
-
if (typeof x === 'undefined') return undefined;
|
|
962
|
-
if (typeof x === 'string') {
|
|
963
|
-
if (x.substring(0, 2) === '_:') {
|
|
964
|
-
if (typeof this.blankNodes[x.substring(2)] === 'undefined') {
|
|
965
|
-
this.blankNodes[x.substring(2)] = new _blankNode.default(x.substring(2));
|
|
966
|
-
}
|
|
967
|
-
return this.blankNodes[x.substring(2)];
|
|
968
|
-
}
|
|
969
|
-
return _canonicalDataFactory.default.namedNode(x);
|
|
840
|
+
this.setHTMLContext();
|
|
970
841
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (x.value.substring(0, 2) === '_:') {
|
|
974
|
-
if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {
|
|
975
|
-
this.blankNodes[x.value.substring(2)] = new _blankNode.default(x.value.substring(2));
|
|
976
|
-
}
|
|
977
|
-
return this.blankNodes[x.value.substring(2)];
|
|
978
|
-
}
|
|
979
|
-
return _canonicalDataFactory.default.namedNode(x.value);
|
|
980
|
-
case RDFaProcessor.PlainLiteralURI:
|
|
981
|
-
return new _literal.default(x.value, x.language || '');
|
|
982
|
-
case RDFaProcessor.XMLLiteralURI:
|
|
983
|
-
case RDFaProcessor.HTMLLiteralURI:
|
|
984
|
-
var string = '';
|
|
985
|
-
Object.keys(x.value).forEach(function (i) {
|
|
986
|
-
string += Util.domToString(x.value[i], _this.htmlOptions);
|
|
987
|
-
});
|
|
988
|
-
return new _literal.default(string, '', new _namedNode.default(x.type));
|
|
989
|
-
default:
|
|
990
|
-
return new _literal.default(x.value, '', new _namedNode.default(x.type));
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}, {
|
|
994
|
-
key: "trim",
|
|
995
|
-
value: function trim(str) {
|
|
996
|
-
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
|
842
|
+
} else {
|
|
843
|
+
this.setXMLContext();
|
|
997
844
|
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
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)];
|
|
1008
927
|
}
|
|
1009
|
-
|
|
1010
|
-
baseURI: base
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
}, {
|
|
1014
|
-
key: "tokenize",
|
|
1015
|
-
value: function tokenize(str) {
|
|
1016
|
-
return this.trim(str).split(/\s+/);
|
|
928
|
+
return _canonicalDataFactory.default.namedNode(x);
|
|
1017
929
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
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));
|
|
1022
950
|
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
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
|
+
}
|
|
959
|
+
exports.default = RDFaProcessor;
|
|
1025
960
|
RDFaProcessor.XMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral';
|
|
1026
961
|
RDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML';
|
|
1027
962
|
RDFaProcessor.PlainLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral';
|
|
1028
963
|
RDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object';
|
|
1029
964
|
RDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
|
|
1030
|
-
RDFaProcessor.nameChar =
|
|
1031
|
-
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_]';
|
|
1032
967
|
RDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar + RDFaProcessor.nameChar + '*$');
|
|
1033
968
|
|
|
1034
969
|
/*
|
|
@@ -1059,4 +994,4 @@ RDFaProcessor.dateTimeTypes = [{
|
|
|
1059
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]/,
|
|
1060
995
|
type: 'http://www.w3.org/2001/XMLSchema#gYear'
|
|
1061
996
|
}];
|
|
1062
|
-
|
|
997
|
+
const parseRDFaDOM = exports.parseRDFaDOM = RDFaProcessor.parseRDFaDOM;
|