rdflib 2.2.21 → 2.2.22-b51259b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +9 -1
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +61 -114
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -128
- package/esm/convert.js +1 -2
- package/esm/default-graph.js +14 -48
- package/esm/empty.js +8 -39
- package/esm/factories/canonical-data-factory.js +33 -65
- package/esm/factories/extended-term-factory.js +18 -25
- package/esm/factories/factory-types.js +3 -2
- package/esm/factories/rdflib-data-factory.js +9 -19
- package/esm/fetcher.js +1341 -1854
- package/esm/formula.js +639 -846
- package/esm/index.js +40 -76
- package/esm/jsonldparser.js +24 -49
- package/esm/jsonparser.js +1 -8
- package/esm/lists.js +47 -110
- package/esm/literal.js +120 -189
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1015 -1412
- package/esm/named-node.js +70 -119
- package/esm/namespace.js +2 -5
- package/esm/node-internal.js +73 -110
- package/esm/node.js +2 -7
- package/esm/parse.js +12 -19
- package/esm/patch-parser.js +10 -30
- package/esm/query-to-sparql.js +0 -18
- package/esm/query.js +63 -147
- package/esm/rdfaparser.js +794 -997
- package/esm/rdfxmlparser.js +347 -461
- package/esm/serialize.js +9 -27
- package/esm/serializer.js +820 -1049
- package/esm/sparql-to-query.js +44 -134
- package/esm/statement.js +54 -85
- package/esm/store.js +830 -1103
- package/esm/types.js +22 -21
- package/esm/update-manager.js +869 -1106
- package/esm/updates-via.js +104 -161
- package/esm/uri.js +9 -53
- package/esm/utils/default-graph-uri.js +3 -2
- package/esm/utils/termValue.js +0 -1
- package/esm/utils/terms.js +19 -21
- package/esm/utils-js.js +20 -61
- package/esm/utils.js +10 -21
- package/esm/variable.js +32 -78
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +60 -113
- package/lib/class-order.js +1 -2
- package/lib/collection.js +69 -131
- package/lib/convert.js +3 -9
- package/lib/default-graph.js +13 -52
- package/lib/empty.js +8 -43
- package/lib/factories/canonical-data-factory.js +35 -79
- package/lib/factories/extended-term-factory.js +18 -32
- package/lib/factories/factory-types.d.ts +6 -6
- package/lib/factories/factory-types.js +1 -4
- package/lib/factories/rdflib-data-factory.js +9 -23
- package/lib/fetcher.d.ts +6 -6
- package/lib/fetcher.js +1370 -1843
- package/lib/formula.js +640 -855
- package/lib/index.js +66 -152
- package/lib/jsonldparser.js +23 -53
- package/lib/jsonparser.js +1 -10
- package/lib/lists.js +55 -112
- package/lib/literal.js +120 -195
- package/lib/log.d.ts +0 -6
- package/lib/log.js +7 -8
- package/lib/n3parser.js +1030 -1436
- package/lib/named-node.js +69 -126
- package/lib/namespace.js +2 -7
- package/lib/node-internal.js +74 -107
- package/lib/node.js +2 -12
- package/lib/parse.d.ts +1 -1
- package/lib/parse.js +12 -32
- package/lib/patch-parser.js +11 -34
- package/lib/query-to-sparql.js +0 -23
- package/lib/query.js +62 -167
- package/lib/rdfaparser.js +796 -1009
- package/lib/rdfxmlparser.js +349 -466
- package/lib/serialize.js +11 -37
- package/lib/serializer.js +823 -1064
- package/lib/sparql-to-query.js +42 -167
- package/lib/statement.js +55 -91
- package/lib/store.d.ts +1 -1
- package/lib/store.js +850 -1112
- package/lib/tf-types.d.ts +4 -4
- package/lib/types.d.ts +8 -8
- package/lib/types.js +23 -23
- package/lib/update-manager.d.ts +1 -1
- package/lib/update-manager.js +865 -1103
- package/lib/updates-via.js +105 -164
- package/lib/uri.js +8 -61
- package/lib/utils/default-graph-uri.js +3 -5
- package/lib/utils/termValue.js +0 -2
- package/lib/utils/terms.js +19 -40
- package/lib/utils-js.js +23 -88
- package/lib/utils.js +10 -27
- package/lib/variable.js +34 -85
- package/lib/xsd-internal.js +0 -3
- package/lib/xsd.js +2 -6
- package/package.json +35 -35
- package/src/fetcher.ts +2 -2
- package/src/update-manager.ts +12 -7
- package/changes.txt +0 -59
package/lib/rdfxmlparser.js
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
7
|
exports.default = void 0;
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
|
|
18
9
|
var uriUtil = _interopRequireWildcard(require("./uri"));
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
24
12
|
/**
|
|
25
13
|
* RDF/XML PARSER
|
|
26
14
|
*
|
|
@@ -72,515 +60,410 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
72
60
|
* associated documentation will at all times remain with copyright
|
|
73
61
|
* holders.
|
|
74
62
|
*/
|
|
75
|
-
|
|
76
63
|
/**
|
|
77
64
|
* @class RDFParser resource object tied to an RDFStore
|
|
78
65
|
*
|
|
79
66
|
* @author David Sheets <dsheets@mit.edu>
|
|
80
67
|
*
|
|
81
68
|
*/
|
|
82
|
-
|
|
69
|
+
|
|
70
|
+
class RDFParser {
|
|
83
71
|
/*
|
|
84
72
|
* @constructor
|
|
85
73
|
* @param {RDFStore} store An RDFStore object
|
|
86
74
|
*/
|
|
87
|
-
|
|
88
|
-
(0, _classCallCheck2.default)(this, RDFParser);
|
|
89
|
-
|
|
75
|
+
constructor(store) {
|
|
90
76
|
/** Our triple store reference @private */
|
|
91
|
-
this.store = store;
|
|
92
|
-
/** Our identified blank nodes @private */
|
|
93
|
-
|
|
94
|
-
this.bnodes = {};
|
|
95
|
-
/** A context for context-aware stores @private */
|
|
96
|
-
|
|
97
|
-
this.why = null;
|
|
98
|
-
/** Reification flag */
|
|
99
77
|
|
|
78
|
+
this.store = store; /** Our identified blank nodes @private */
|
|
79
|
+
this.bnodes = {}; /** A context for context-aware stores @private */
|
|
80
|
+
this.why = null; /** Reification flag */
|
|
100
81
|
this.reify = false;
|
|
101
82
|
}
|
|
83
|
+
|
|
102
84
|
/** Standard namespaces that we know how to handle @final
|
|
103
85
|
* @member RDFParser
|
|
104
86
|
*/
|
|
105
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Frame class for namespace and base URI lookups
|
|
90
|
+
* Base lookups will always resolve because the parser knows
|
|
91
|
+
* the default base.
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
106
95
|
|
|
107
|
-
(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.
|
|
146
|
-
this.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.addSymbol(this.NODE, uri);
|
|
175
|
-
|
|
176
|
-
if (this.isTripleToLoad()) {
|
|
177
|
-
this.loadTriple();
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
/** Add a collection node to this frame */
|
|
182
|
-
'addCollection': function addCollection() {
|
|
183
|
-
this.nodeType = this.NODE;
|
|
184
|
-
this.node = this.store.collection();
|
|
185
|
-
this.collection = true;
|
|
186
|
-
|
|
187
|
-
if (this.isTripleToLoad()) {
|
|
188
|
-
this.loadTriple();
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
/** Add a collection arc to this frame */
|
|
193
|
-
'addCollectionArc': function addCollectionArc() {
|
|
194
|
-
this.nodeType = this.ARC;
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
/** Add a bnode to this frame */
|
|
198
|
-
'addBNode': function addBNode(id) {
|
|
199
|
-
if (id != null) {
|
|
200
|
-
if (this.parser.bnodes[id] != null) {
|
|
201
|
-
this.node = this.parser.bnodes[id];
|
|
202
|
-
} else {
|
|
203
|
-
this.node = this.parser.bnodes[id] = this.store.bnode();
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
206
|
-
this.node = this.store.bnode();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
this.nodeType = this.NODE;
|
|
210
|
-
|
|
211
|
-
if (this.isTripleToLoad()) {
|
|
212
|
-
this.loadTriple();
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
/** Add an arc or property to this frame */
|
|
217
|
-
'addArc': function addArc(uri) {
|
|
218
|
-
if (uri === RDFParser.ns.RDF + 'li') {
|
|
219
|
-
uri = RDFParser.ns.RDF + '_' + this.parent.listIndex;
|
|
220
|
-
this.parent.listIndex++;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
this.addSymbol(this.ARC, uri);
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
/** Add a literal to this frame */
|
|
227
|
-
'addLiteral': function addLiteral(value) {
|
|
228
|
-
if (this.parent.datatype && this.parent.datatype !== RDFParser.ns.RDF + 'langString') {
|
|
229
|
-
this.node = this.store.literal(value, this.store.sym(this.parent.datatype));
|
|
96
|
+
frameFactory(parser, parent, element) {
|
|
97
|
+
return {
|
|
98
|
+
'NODE': 1,
|
|
99
|
+
'ARC': 2,
|
|
100
|
+
'parent': parent,
|
|
101
|
+
'parser': parser,
|
|
102
|
+
'store': parser.store,
|
|
103
|
+
'element': element,
|
|
104
|
+
'lastChild': 0,
|
|
105
|
+
'base': null,
|
|
106
|
+
'lang': null,
|
|
107
|
+
'node': null,
|
|
108
|
+
'nodeType': null,
|
|
109
|
+
'listIndex': 1,
|
|
110
|
+
'rdfid': null,
|
|
111
|
+
'datatype': null,
|
|
112
|
+
'collection': false,
|
|
113
|
+
/** Terminate the frame and notify the store that we're done */
|
|
114
|
+
'terminateFrame': function () {
|
|
115
|
+
if (this.collection) {
|
|
116
|
+
this.node.close();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
/** Add a symbol of a certain type to the this frame */'addSymbol': function (type, uri) {
|
|
120
|
+
uri = uriUtil.join(uri, this.base);
|
|
121
|
+
this.node = this.store.sym(uri);
|
|
122
|
+
this.nodeType = type;
|
|
123
|
+
},
|
|
124
|
+
/** Load any constructed triples into the store */'loadTriple': function () {
|
|
125
|
+
if (this.parent.parent.collection) {
|
|
126
|
+
this.parent.parent.node.append(this.node);
|
|
127
|
+
} else {
|
|
128
|
+
this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why);
|
|
129
|
+
}
|
|
130
|
+
if (this.parent.rdfid != null) {
|
|
131
|
+
// reify
|
|
132
|
+
var triple = this.store.sym(uriUtil.join('#' + this.parent.rdfid, this.base));
|
|
133
|
+
this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(RDFParser.ns.RDF + 'Statement'), this.parser.why);
|
|
134
|
+
this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'subject'), this.parent.parent.node, this.parser.why);
|
|
135
|
+
this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'predicate'), this.parent.node, this.parser.why);
|
|
136
|
+
this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'object'), this.node, this.parser.why);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
/** Check if it's OK to load a triple */'isTripleToLoad': function () {
|
|
140
|
+
return this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType === this.ARC && this.parent.parent.nodeType === this.NODE;
|
|
141
|
+
},
|
|
142
|
+
/** Add a symbolic node to this frame */'addNode': function (uri) {
|
|
143
|
+
this.addSymbol(this.NODE, uri);
|
|
144
|
+
if (this.isTripleToLoad()) {
|
|
145
|
+
this.loadTriple();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
/** Add a collection node to this frame */'addCollection': function () {
|
|
149
|
+
this.nodeType = this.NODE;
|
|
150
|
+
this.node = this.store.collection();
|
|
151
|
+
this.collection = true;
|
|
152
|
+
if (this.isTripleToLoad()) {
|
|
153
|
+
this.loadTriple();
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
/** Add a collection arc to this frame */'addCollectionArc': function () {
|
|
157
|
+
this.nodeType = this.ARC;
|
|
158
|
+
},
|
|
159
|
+
/** Add a bnode to this frame */'addBNode': function (id) {
|
|
160
|
+
if (id != null) {
|
|
161
|
+
if (this.parser.bnodes[id] != null) {
|
|
162
|
+
this.node = this.parser.bnodes[id];
|
|
230
163
|
} else {
|
|
231
|
-
this.node = this.
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
this.nodeType = this.NODE;
|
|
235
|
-
|
|
236
|
-
if (this.isTripleToLoad()) {
|
|
237
|
-
this.loadTriple();
|
|
164
|
+
this.node = this.parser.bnodes[id] = this.store.bnode();
|
|
238
165
|
}
|
|
166
|
+
} else {
|
|
167
|
+
this.node = this.store.bnode();
|
|
239
168
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
attributeNode = potentialNode;
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
169
|
+
this.nodeType = this.NODE;
|
|
170
|
+
if (this.isTripleToLoad()) {
|
|
171
|
+
this.loadTriple();
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
/** Add an arc or property to this frame */'addArc': function (uri) {
|
|
175
|
+
if (uri === RDFParser.ns.RDF + 'li') {
|
|
176
|
+
uri = RDFParser.ns.RDF + '_' + this.parent.listIndex;
|
|
177
|
+
this.parent.listIndex++;
|
|
178
|
+
}
|
|
179
|
+
this.addSymbol(this.ARC, uri);
|
|
180
|
+
},
|
|
181
|
+
/** Add a literal to this frame */'addLiteral': function (value) {
|
|
182
|
+
if (this.parent.datatype && this.parent.datatype !== RDFParser.ns.RDF + 'langString') {
|
|
183
|
+
this.node = this.store.literal(value, this.store.sym(this.parent.datatype));
|
|
184
|
+
} else {
|
|
185
|
+
this.node = this.store.literal(value, this.lang);
|
|
186
|
+
}
|
|
187
|
+
this.nodeType = this.NODE;
|
|
188
|
+
if (this.isTripleToLoad()) {
|
|
189
|
+
this.loadTriple();
|
|
265
190
|
}
|
|
266
191
|
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
267
194
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this.cleanParser(); // figure out the root element
|
|
283
|
-
|
|
284
|
-
var root;
|
|
285
|
-
|
|
286
|
-
if (document.nodeType === RDFParser.nodeType.DOCUMENT) {
|
|
287
|
-
for (var c = 0; c < children.length; c++) {
|
|
288
|
-
if (children[c].nodeType === RDFParser.nodeType.ELEMENT) {
|
|
289
|
-
root = children[c];
|
|
195
|
+
// from the OpenLayers source .. needed to get around IE problems.
|
|
196
|
+
getAttributeNodeNS(node, uri, name) {
|
|
197
|
+
var attributeNode = null;
|
|
198
|
+
if (node.getAttributeNodeNS) {
|
|
199
|
+
attributeNode = node.getAttributeNodeNS(uri, name);
|
|
200
|
+
} else {
|
|
201
|
+
var attributes = node.attributes;
|
|
202
|
+
var potentialNode, fullName;
|
|
203
|
+
for (var i = 0; i < attributes.length; ++i) {
|
|
204
|
+
potentialNode = attributes[i];
|
|
205
|
+
if (potentialNode.namespaceURI === uri) {
|
|
206
|
+
fullName = potentialNode.prefix ? potentialNode.prefix + ':' + name : name;
|
|
207
|
+
if (fullName === potentialNode.nodeName) {
|
|
208
|
+
attributeNode = potentialNode;
|
|
290
209
|
break;
|
|
291
210
|
}
|
|
292
211
|
}
|
|
293
|
-
} else if (document.nodeType === RDFParser.nodeType.ELEMENT) {
|
|
294
|
-
root = document;
|
|
295
|
-
} else {
|
|
296
|
-
throw new Error("RDFParser: can't find root in " + base + '. Halting. '); // return false
|
|
297
212
|
}
|
|
298
|
-
|
|
299
|
-
this.why = why; // our topmost frame
|
|
300
|
-
|
|
301
|
-
var f = this.frameFactory(this);
|
|
302
|
-
this.base = base;
|
|
303
|
-
f.base = base;
|
|
304
|
-
f.lang = null; // was '' but can't have langs like that 2015 (!)
|
|
305
|
-
|
|
306
|
-
this.parseDOM(this.buildFrame(f, root));
|
|
307
|
-
return true;
|
|
308
213
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
value: function parseDOM(frame) {
|
|
312
|
-
// a DOM utility function used in parsing
|
|
313
|
-
var rdfid;
|
|
214
|
+
return attributeNode;
|
|
215
|
+
}
|
|
314
216
|
|
|
315
|
-
|
|
316
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Build our initial scope frame and parse the DOM into triples
|
|
219
|
+
* @param {HTMLDocument} document The DOM to parse
|
|
220
|
+
* @param {String} base The base URL to use
|
|
221
|
+
* @param {Object} why The context to which this resource belongs
|
|
222
|
+
*/
|
|
317
223
|
|
|
318
|
-
|
|
319
|
-
|
|
224
|
+
parse(document, base, why) {
|
|
225
|
+
var children = document.childNodes; // clean up for the next run
|
|
226
|
+
this.cleanParser(); // figure out the root element
|
|
227
|
+
var root;
|
|
228
|
+
if (document.nodeType === RDFParser.nodeType.DOCUMENT) {
|
|
229
|
+
for (var c = 0; c < children.length; c++) {
|
|
230
|
+
if (children[c].nodeType === RDFParser.nodeType.ELEMENT) {
|
|
231
|
+
root = children[c];
|
|
232
|
+
break;
|
|
320
233
|
}
|
|
234
|
+
}
|
|
235
|
+
} else if (document.nodeType === RDFParser.nodeType.ELEMENT) {
|
|
236
|
+
root = document;
|
|
237
|
+
} else {
|
|
238
|
+
throw new Error("RDFParser: can't find root in " + base + '. Halting. ');
|
|
239
|
+
// return false
|
|
240
|
+
}
|
|
321
241
|
|
|
322
|
-
|
|
323
|
-
|
|
242
|
+
this.why = why; // our topmost frame
|
|
243
|
+
var f = this.frameFactory(this);
|
|
244
|
+
this.base = base;
|
|
245
|
+
f.base = base;
|
|
246
|
+
f.lang = null; // was '' but can't have langs like that 2015 (!)
|
|
247
|
+
this.parseDOM(this.buildFrame(f, root));
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
parseDOM(frame) {
|
|
251
|
+
// a DOM utility function used in parsing
|
|
252
|
+
var rdfid;
|
|
253
|
+
var elementURI = function (el) {
|
|
254
|
+
var result = '';
|
|
255
|
+
if (el.namespaceURI == null) {
|
|
256
|
+
throw new Error('RDF/XML syntax error: No namespace for ' + el.localName + ' in ' + this.base);
|
|
257
|
+
}
|
|
258
|
+
if (el.namespaceURI) {
|
|
259
|
+
result = result + el.namespaceURI;
|
|
260
|
+
}
|
|
261
|
+
if (el.localName) {
|
|
262
|
+
result = result + el.localName;
|
|
263
|
+
} else if (el.nodeName) {
|
|
264
|
+
if (el.nodeName.indexOf(':') >= 0) result = result + el.nodeName.split(':')[1];else result = result + el.nodeName;
|
|
265
|
+
}
|
|
266
|
+
return result;
|
|
267
|
+
}.bind(this);
|
|
268
|
+
var dig = true; // if we'll dig down in the tree on the next iter
|
|
269
|
+
while (frame.parent) {
|
|
270
|
+
var dom = frame.element;
|
|
271
|
+
var attrs = dom.attributes;
|
|
272
|
+
if (dom.nodeType === RDFParser.nodeType.TEXT || dom.nodeType === RDFParser.nodeType.CDATA_SECTION) {
|
|
273
|
+
// we have a literal
|
|
274
|
+
if (frame.parent.nodeType === frame.NODE) {
|
|
275
|
+
// must have had attributes, store as rdf:value
|
|
276
|
+
frame.addArc(RDFParser.ns.RDF + 'value');
|
|
277
|
+
frame = this.buildFrame(frame);
|
|
324
278
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
279
|
+
frame.addLiteral(dom.nodeValue);
|
|
280
|
+
} else if (elementURI(dom) !== RDFParser.ns.RDF + 'RDF') {
|
|
281
|
+
// not root
|
|
282
|
+
if (frame.parent && frame.parent.collection) {
|
|
283
|
+
// we're a collection element
|
|
284
|
+
frame.addCollectionArc();
|
|
285
|
+
frame = this.buildFrame(frame, frame.element);
|
|
286
|
+
frame.parent.element = null;
|
|
330
287
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
while (frame.parent) {
|
|
338
|
-
var dom = frame.element;
|
|
339
|
-
var attrs = dom.attributes;
|
|
340
|
-
|
|
341
|
-
if (dom.nodeType === RDFParser.nodeType.TEXT || dom.nodeType === RDFParser.nodeType.CDATA_SECTION) {
|
|
342
|
-
// we have a literal
|
|
343
|
-
if (frame.parent.nodeType === frame.NODE) {
|
|
344
|
-
// must have had attributes, store as rdf:value
|
|
345
|
-
frame.addArc(RDFParser.ns.RDF + 'value');
|
|
346
|
-
frame = this.buildFrame(frame);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
frame.addLiteral(dom.nodeValue);
|
|
350
|
-
} else if (elementURI(dom) !== RDFParser.ns.RDF + 'RDF') {
|
|
351
|
-
// not root
|
|
352
|
-
if (frame.parent && frame.parent.collection) {
|
|
353
|
-
// we're a collection element
|
|
354
|
-
frame.addCollectionArc();
|
|
355
|
-
frame = this.buildFrame(frame, frame.element);
|
|
356
|
-
frame.parent.element = null;
|
|
288
|
+
if (!frame.parent || !frame.parent.nodeType || frame.parent.nodeType === frame.ARC) {
|
|
289
|
+
// we need a node
|
|
290
|
+
var about = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'about');
|
|
291
|
+
rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID');
|
|
292
|
+
if (about && rdfid) {
|
|
293
|
+
throw new Error('RDFParser: ' + dom.nodeName + ' has both rdf:id and rdf:about.' + ' Halting. Only one of these' + ' properties may be specified on a' + ' node.');
|
|
357
294
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (!about && rdfid) {
|
|
369
|
-
frame.addNode('#' + rdfid.nodeValue);
|
|
370
|
-
dom.removeAttributeNode(rdfid);
|
|
371
|
-
} else if (about == null && rdfid == null) {
|
|
372
|
-
var bnid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID');
|
|
373
|
-
|
|
374
|
-
if (bnid) {
|
|
375
|
-
frame.addBNode(bnid.nodeValue);
|
|
376
|
-
dom.removeAttributeNode(bnid);
|
|
377
|
-
} else {
|
|
378
|
-
frame.addBNode();
|
|
379
|
-
}
|
|
295
|
+
if (!about && rdfid) {
|
|
296
|
+
frame.addNode('#' + rdfid.nodeValue);
|
|
297
|
+
dom.removeAttributeNode(rdfid);
|
|
298
|
+
} else if (about == null && rdfid == null) {
|
|
299
|
+
var bnid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID');
|
|
300
|
+
if (bnid) {
|
|
301
|
+
frame.addBNode(bnid.nodeValue);
|
|
302
|
+
dom.removeAttributeNode(bnid);
|
|
380
303
|
} else {
|
|
381
|
-
frame.
|
|
382
|
-
dom.removeAttributeNode(about);
|
|
383
|
-
} // Typed nodes
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
var rdftype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'type');
|
|
387
|
-
|
|
388
|
-
if (RDFParser.ns.RDF + 'Description' !== elementURI(dom)) {
|
|
389
|
-
rdftype = {
|
|
390
|
-
'nodeValue': elementURI(dom)
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (rdftype != null) {
|
|
395
|
-
this.store.add(frame.node, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(uriUtil.join(rdftype.nodeValue, frame.base)), this.why);
|
|
396
|
-
|
|
397
|
-
if (rdftype.nodeName) {
|
|
398
|
-
dom.removeAttributeNode(rdftype);
|
|
399
|
-
}
|
|
400
|
-
} // Property Attributes
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
for (var x = attrs.length - 1; x >= 0; x--) {
|
|
404
|
-
this.store.add(frame.node, this.store.sym(elementURI(attrs[x])), this.store.literal(attrs[x].nodeValue, frame.lang), this.why);
|
|
304
|
+
frame.addBNode();
|
|
405
305
|
}
|
|
406
306
|
} else {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
307
|
+
frame.addNode(about.nodeValue);
|
|
308
|
+
dom.removeAttributeNode(about);
|
|
309
|
+
}
|
|
310
|
+
// Typed nodes
|
|
311
|
+
var rdftype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'type');
|
|
312
|
+
if (RDFParser.ns.RDF + 'Description' !== elementURI(dom)) {
|
|
313
|
+
rdftype = {
|
|
314
|
+
'nodeValue': elementURI(dom)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
if (rdftype != null) {
|
|
318
|
+
this.store.add(frame.node, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(uriUtil.join(rdftype.nodeValue, frame.base)), this.why);
|
|
319
|
+
if (rdftype.nodeName) {
|
|
320
|
+
dom.removeAttributeNode(rdftype);
|
|
417
321
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
322
|
+
}
|
|
323
|
+
// Property Attributes
|
|
324
|
+
for (var x = attrs.length - 1; x >= 0; x--) {
|
|
325
|
+
this.store.add(frame.node, this.store.sym(elementURI(attrs[x])), this.store.literal(attrs[x].nodeValue, frame.lang), this.why);
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
// we should add an arc (or implicit bnode+arc)
|
|
329
|
+
frame.addArc(elementURI(dom)); // save the arc's rdf:ID if it has one
|
|
330
|
+
if (this.reify) {
|
|
331
|
+
rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID');
|
|
332
|
+
if (rdfid) {
|
|
333
|
+
frame.rdfid = rdfid.nodeValue;
|
|
334
|
+
dom.removeAttributeNode(rdfid);
|
|
425
335
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
336
|
+
}
|
|
337
|
+
var parsetype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'parseType');
|
|
338
|
+
var datatype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'datatype');
|
|
339
|
+
if (datatype) {
|
|
340
|
+
frame.datatype = datatype.nodeValue;
|
|
341
|
+
dom.removeAttributeNode(datatype);
|
|
342
|
+
}
|
|
343
|
+
if (parsetype) {
|
|
344
|
+
var nv = parsetype.nodeValue;
|
|
345
|
+
if (nv === 'Literal') {
|
|
346
|
+
frame.datatype = RDFParser.ns.RDF + 'XMLLiteral';
|
|
347
|
+
frame = this.buildFrame(frame);
|
|
348
|
+
// Don't include the literal node, only its children
|
|
349
|
+
frame.addLiteral(dom.childNodes);
|
|
350
|
+
dig = false;
|
|
351
|
+
} else if (nv === 'Resource') {
|
|
352
|
+
frame = this.buildFrame(frame, frame.element);
|
|
353
|
+
frame.parent.element = null;
|
|
354
|
+
frame.addBNode();
|
|
355
|
+
} else if (nv === 'Collection') {
|
|
356
|
+
frame = this.buildFrame(frame, frame.element);
|
|
357
|
+
frame.parent.element = null;
|
|
358
|
+
frame.addCollection();
|
|
359
|
+
}
|
|
360
|
+
dom.removeAttributeNode(parsetype);
|
|
361
|
+
}
|
|
362
|
+
if (attrs.length !== 0) {
|
|
363
|
+
var resource = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'resource');
|
|
364
|
+
var bnid2 = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID');
|
|
365
|
+
frame = this.buildFrame(frame);
|
|
366
|
+
if (resource) {
|
|
367
|
+
frame.addNode(resource.nodeValue);
|
|
368
|
+
dom.removeAttributeNode(resource);
|
|
369
|
+
} else {
|
|
370
|
+
if (bnid2) {
|
|
371
|
+
frame.addBNode(bnid2.nodeValue);
|
|
372
|
+
dom.removeAttributeNode(bnid2);
|
|
373
|
+
} else {
|
|
439
374
|
frame.addBNode();
|
|
440
|
-
} else if (nv === 'Collection') {
|
|
441
|
-
frame = this.buildFrame(frame, frame.element);
|
|
442
|
-
frame.parent.element = null;
|
|
443
|
-
frame.addCollection();
|
|
444
375
|
}
|
|
445
|
-
|
|
446
|
-
dom.removeAttributeNode(parsetype);
|
|
447
376
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (resource) {
|
|
455
|
-
frame.addNode(resource.nodeValue);
|
|
456
|
-
dom.removeAttributeNode(resource);
|
|
377
|
+
for (var x1 = attrs.length - 1; x1 >= 0; x1--) {
|
|
378
|
+
var f = this.buildFrame(frame);
|
|
379
|
+
f.addArc(elementURI(attrs[x1]));
|
|
380
|
+
if (elementURI(attrs[x1]) === RDFParser.ns.RDF + 'type') {
|
|
381
|
+
this.buildFrame(f).addNode(attrs[x1].nodeValue);
|
|
457
382
|
} else {
|
|
458
|
-
|
|
459
|
-
frame.addBNode(bnid2.nodeValue);
|
|
460
|
-
dom.removeAttributeNode(bnid2);
|
|
461
|
-
} else {
|
|
462
|
-
frame.addBNode();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
for (var x1 = attrs.length - 1; x1 >= 0; x1--) {
|
|
467
|
-
var f = this.buildFrame(frame);
|
|
468
|
-
f.addArc(elementURI(attrs[x1]));
|
|
469
|
-
|
|
470
|
-
if (elementURI(attrs[x1]) === RDFParser.ns.RDF + 'type') {
|
|
471
|
-
this.buildFrame(f).addNode(attrs[x1].nodeValue);
|
|
472
|
-
} else {
|
|
473
|
-
this.buildFrame(f).addLiteral(attrs[x1].nodeValue);
|
|
474
|
-
}
|
|
383
|
+
this.buildFrame(f).addLiteral(attrs[x1].nodeValue);
|
|
475
384
|
}
|
|
476
|
-
} else if (dom.childNodes.length === 0) {
|
|
477
|
-
this.buildFrame(frame).addLiteral('');
|
|
478
385
|
}
|
|
386
|
+
} else if (dom.childNodes.length === 0) {
|
|
387
|
+
this.buildFrame(frame).addLiteral('');
|
|
479
388
|
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
while (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
var candidate = dom.childNodes && dom.childNodes[frame.lastChild];
|
|
495
|
-
|
|
496
|
-
if (!candidate || !dig) {
|
|
497
|
-
frame.terminateFrame();
|
|
498
|
-
|
|
499
|
-
if (!(frame = frame.parent)) {
|
|
500
|
-
break;
|
|
501
|
-
} // done
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
dom = frame.element;
|
|
505
|
-
dig = true;
|
|
506
|
-
} else if (candidate.nodeType !== RDFParser.nodeType.ELEMENT && candidate.nodeType !== RDFParser.nodeType.TEXT && candidate.nodeType !== RDFParser.nodeType.CDATA_SECTION || (candidate.nodeType === RDFParser.nodeType.TEXT || candidate.nodeType === RDFParser.nodeType.CDATA_SECTION) && dom.childNodes.length !== 1) {
|
|
507
|
-
frame.lastChild++;
|
|
508
|
-
} else {
|
|
509
|
-
// not a leaf
|
|
510
|
-
frame.lastChild++;
|
|
511
|
-
frame = this.buildFrame(pframe, dom.childNodes[frame.lastChild - 1]);
|
|
389
|
+
}
|
|
390
|
+
} // rdf:RDF
|
|
391
|
+
// dig dug
|
|
392
|
+
dom = frame.element;
|
|
393
|
+
while (frame.parent) {
|
|
394
|
+
var pframe = frame;
|
|
395
|
+
while (dom == null) {
|
|
396
|
+
frame = frame.parent;
|
|
397
|
+
dom = frame.element;
|
|
398
|
+
}
|
|
399
|
+
var candidate = dom.childNodes && dom.childNodes[frame.lastChild];
|
|
400
|
+
if (!candidate || !dig) {
|
|
401
|
+
frame.terminateFrame();
|
|
402
|
+
if (!(frame = frame.parent)) {
|
|
512
403
|
break;
|
|
513
|
-
}
|
|
404
|
+
} // done
|
|
405
|
+
dom = frame.element;
|
|
406
|
+
dig = true;
|
|
407
|
+
} else if (candidate.nodeType !== RDFParser.nodeType.ELEMENT && candidate.nodeType !== RDFParser.nodeType.TEXT && candidate.nodeType !== RDFParser.nodeType.CDATA_SECTION || (candidate.nodeType === RDFParser.nodeType.TEXT || candidate.nodeType === RDFParser.nodeType.CDATA_SECTION) && dom.childNodes.length !== 1) {
|
|
408
|
+
frame.lastChild++;
|
|
409
|
+
} else {
|
|
410
|
+
// not a leaf
|
|
411
|
+
frame.lastChild++;
|
|
412
|
+
frame = this.buildFrame(pframe, dom.childNodes[frame.lastChild - 1]);
|
|
413
|
+
break;
|
|
514
414
|
}
|
|
515
|
-
} // while
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Cleans out state from a previous parse run
|
|
520
|
-
* @private
|
|
521
|
-
*/
|
|
522
|
-
|
|
523
|
-
}, {
|
|
524
|
-
key: "cleanParser",
|
|
525
|
-
value: function cleanParser() {
|
|
526
|
-
this.bnodes = {};
|
|
527
|
-
this.why = null;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Builds scope frame
|
|
531
|
-
* @private
|
|
532
|
-
*/
|
|
533
|
-
|
|
534
|
-
}, {
|
|
535
|
-
key: "buildFrame",
|
|
536
|
-
value: function buildFrame(parent, element) {
|
|
537
|
-
var frame = this.frameFactory(this, parent, element);
|
|
538
|
-
|
|
539
|
-
if (parent) {
|
|
540
|
-
frame.base = parent.base;
|
|
541
|
-
frame.lang = parent.lang;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
if (!element || element.nodeType === RDFParser.nodeType.TEXT || element.nodeType === RDFParser.nodeType.CDATA_SECTION) {
|
|
545
|
-
return frame;
|
|
546
415
|
}
|
|
416
|
+
} // while
|
|
417
|
+
}
|
|
547
418
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
var lang = element.getAttributeNode('xml:lang');
|
|
557
|
-
|
|
558
|
-
if (lang != null) {
|
|
559
|
-
frame.lang = lang.nodeValue;
|
|
560
|
-
element.removeAttribute('xml:lang');
|
|
561
|
-
} // remove all extraneous xml and xmlns attributes
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
for (var x = attrs.length - 1; x >= 0; x--) {
|
|
565
|
-
if (attrs[x].nodeName.substr(0, 3) === 'xml') {
|
|
566
|
-
if (attrs[x].name.slice(0, 6) === 'xmlns:') {
|
|
567
|
-
var uri = attrs[x].nodeValue; // alert('base for namespac attr:'+this.base)
|
|
568
|
-
|
|
569
|
-
if (this.base) uri = uriUtil.join(uri, this.base);
|
|
570
|
-
this.store.setPrefixForURI(attrs[x].name.slice(6), uri);
|
|
571
|
-
} // alert('rdfparser: xml atribute: '+attrs[x].name) //@@
|
|
572
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Cleans out state from a previous parse run
|
|
421
|
+
* @private
|
|
422
|
+
*/
|
|
423
|
+
cleanParser() {
|
|
424
|
+
this.bnodes = {};
|
|
425
|
+
this.why = null;
|
|
426
|
+
}
|
|
573
427
|
|
|
574
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Builds scope frame
|
|
430
|
+
* @private
|
|
431
|
+
*/
|
|
432
|
+
buildFrame(parent, element) {
|
|
433
|
+
var frame = this.frameFactory(this, parent, element);
|
|
434
|
+
if (parent) {
|
|
435
|
+
frame.base = parent.base;
|
|
436
|
+
frame.lang = parent.lang;
|
|
437
|
+
}
|
|
438
|
+
if (!element || element.nodeType === RDFParser.nodeType.TEXT || element.nodeType === RDFParser.nodeType.CDATA_SECTION) {
|
|
439
|
+
return frame;
|
|
440
|
+
}
|
|
441
|
+
var attrs = element.attributes;
|
|
442
|
+
var base = element.getAttributeNode('xml:base');
|
|
443
|
+
if (base != null) {
|
|
444
|
+
frame.base = base.nodeValue;
|
|
445
|
+
element.removeAttribute('xml:base');
|
|
446
|
+
}
|
|
447
|
+
var lang = element.getAttributeNode('xml:lang');
|
|
448
|
+
if (lang != null) {
|
|
449
|
+
frame.lang = lang.nodeValue;
|
|
450
|
+
element.removeAttribute('xml:lang');
|
|
451
|
+
}
|
|
452
|
+
// remove all extraneous xml and xmlns attributes
|
|
453
|
+
for (var x = attrs.length - 1; x >= 0; x--) {
|
|
454
|
+
if (attrs[x].nodeName.substr(0, 3) === 'xml') {
|
|
455
|
+
if (attrs[x].name.slice(0, 6) === 'xmlns:') {
|
|
456
|
+
var uri = attrs[x].nodeValue; // alert('base for namespac attr:'+this.base)
|
|
457
|
+
if (this.base) uri = uriUtil.join(uri, this.base);
|
|
458
|
+
this.store.setPrefixForURI(attrs[x].name.slice(6), uri);
|
|
575
459
|
}
|
|
460
|
+
// alert('rdfparser: xml atribute: '+attrs[x].name) //@@
|
|
461
|
+
element.removeAttributeNode(attrs[x]);
|
|
576
462
|
}
|
|
577
|
-
|
|
578
|
-
return frame;
|
|
579
463
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
|
|
464
|
+
return frame;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
584
467
|
exports.default = RDFParser;
|
|
585
468
|
(0, _defineProperty2.default)(RDFParser, "ns", {
|
|
586
469
|
'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|