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