rdflib 2.2.31-d71f8cd7 → 2.2.32-a6c694ca
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/670.rdflib.min.js +1 -0
- package/dist/730.rdflib.min.js +3 -0
- package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
- package/dist/730.rdflib.min.js.map +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -59
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +10 -6
- package/esm/collection.js +3 -4
- package/esm/factories/factory-types.js +10 -10
- package/esm/fetcher.js +38 -33
- package/esm/formula.js +10 -13
- package/esm/jsonldparser.js +4 -3
- package/esm/lists.js +2 -1
- package/esm/literal.js +6 -8
- package/esm/node-internal.js +5 -10
- package/esm/rdfxmlparser.js +3 -0
- package/esm/serializer.js +1 -2
- package/esm/statement.js +7 -11
- package/esm/store.js +18 -31
- package/esm/types.js +18 -1
- package/esm/update-manager.js +2 -4
- package/esm/utils.js +0 -1
- package/esm/variable.js +2 -4
- package/lib/blank-node.js +10 -6
- package/lib/collection.js +3 -4
- package/lib/factories/factory-types.js +10 -10
- package/lib/fetcher.js +62 -34
- package/lib/formula.js +10 -13
- package/lib/index.d.ts +1 -1
- package/lib/jsonldparser.js +9 -3
- package/lib/lists.js +15 -1
- package/lib/literal.js +6 -8
- package/lib/node-internal.js +5 -10
- package/lib/query.d.ts +1 -1
- package/lib/rdfxmlparser.js +3 -0
- package/lib/serializer.d.ts +1 -1
- package/lib/serializer.js +1 -2
- package/lib/sparql-to-query.d.ts +1 -1
- package/lib/statement.js +7 -11
- package/lib/store.js +34 -33
- package/lib/types.js +22 -0
- package/lib/update-manager.js +8 -5
- package/lib/utils-js.d.ts +3 -3
- package/lib/variable.js +2 -4
- package/lib/xsd-internal.d.ts +1 -1
- package/package.json +19 -19
- package/src/fetcher.ts +5 -1
- package/src/jsonldparser.js +2 -4
package/esm/blank-node.js
CHANGED
|
@@ -27,7 +27,13 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
27
27
|
_this = _super.call(this, BlankNode.getId(id));
|
|
28
28
|
_defineProperty(_assertThisInitialized(_this), "termType", BlankNodeTermType);
|
|
29
29
|
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.BlankNode);
|
|
30
|
+
/** Whether this is a blank node */
|
|
30
31
|
_defineProperty(_assertThisInitialized(_this), "isBlank", 1);
|
|
32
|
+
/**
|
|
33
|
+
* This type of node is a variable.
|
|
34
|
+
*
|
|
35
|
+
* Note that the existence of this property already indicates that it is a variable.
|
|
36
|
+
*/
|
|
31
37
|
_defineProperty(_assertThisInitialized(_this), "isVar", 1);
|
|
32
38
|
return _this;
|
|
33
39
|
}
|
|
@@ -85,12 +91,7 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
85
91
|
}
|
|
86
92
|
}], [{
|
|
87
93
|
key: "getId",
|
|
88
|
-
value:
|
|
89
|
-
/**
|
|
90
|
-
* The next unique identifier for blank nodes
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
function getId(id) {
|
|
94
|
+
value: function getId(id) {
|
|
94
95
|
if (id) {
|
|
95
96
|
if (typeof id !== 'string') {
|
|
96
97
|
throw new Error('Bad id argument to new blank node: ' + id);
|
|
@@ -107,6 +108,9 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
107
108
|
}]);
|
|
108
109
|
return BlankNode;
|
|
109
110
|
}(Node);
|
|
111
|
+
/**
|
|
112
|
+
* The next unique identifier for blank nodes
|
|
113
|
+
*/
|
|
110
114
|
_defineProperty(BlankNode, "nextId", 0);
|
|
111
115
|
_defineProperty(BlankNode, "NTAnonymousNodePrefix", '_:');
|
|
112
116
|
export { BlankNode as default };
|
package/esm/collection.js
CHANGED
|
@@ -43,10 +43,6 @@ export function fromValue(value) {
|
|
|
43
43
|
var Collection = /*#__PURE__*/function (_Node) {
|
|
44
44
|
_inherits(Collection, _Node);
|
|
45
45
|
var _super = _createSuper(Collection);
|
|
46
|
-
/**
|
|
47
|
-
* The nodes in this collection
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
46
|
function Collection(initial) {
|
|
51
47
|
var _this;
|
|
52
48
|
_classCallCheck(this, Collection);
|
|
@@ -55,6 +51,9 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
55
51
|
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Collection);
|
|
56
52
|
_defineProperty(_assertThisInitialized(_this), "closed", false);
|
|
57
53
|
_defineProperty(_assertThisInitialized(_this), "compareTerm", RdflibBlankNode.prototype.compareTerm);
|
|
54
|
+
/**
|
|
55
|
+
* The nodes in this collection
|
|
56
|
+
*/
|
|
58
57
|
_defineProperty(_assertThisInitialized(_this), "elements", []);
|
|
59
58
|
_defineProperty(_assertThisInitialized(_this), "isVar", 0);
|
|
60
59
|
if (initial && initial.length > 0) {
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/** A set of features that may be supported by a Data Factory */
|
|
2
2
|
|
|
3
|
-
export var Feature
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
|
|
7
|
-
* but with additional extensions
|
|
8
|
-
*
|
|
9
|
-
* bnIndex is optional but useful.
|
|
10
|
-
*/
|
|
11
|
-
(function (Feature) {
|
|
3
|
+
export var Feature = /*#__PURE__*/function (Feature) {
|
|
12
4
|
Feature["collections"] = "COLLECTIONS";
|
|
13
5
|
Feature["defaultGraphType"] = "DEFAULT_GRAPH_TYPE";
|
|
14
6
|
Feature["equalsMethod"] = "EQUALS_METHOD";
|
|
@@ -16,4 +8,12 @@ export var Feature;
|
|
|
16
8
|
Feature["identity"] = "IDENTITY";
|
|
17
9
|
Feature["reversibleId"] = "REVERSIBLE_ID";
|
|
18
10
|
Feature["variableType"] = "VARIABLE_TYPE";
|
|
19
|
-
|
|
11
|
+
return Feature;
|
|
12
|
+
}({});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
|
|
16
|
+
* but with additional extensions
|
|
17
|
+
*
|
|
18
|
+
* bnIndex is optional but useful.
|
|
19
|
+
*/
|
package/esm/fetcher.js
CHANGED
|
@@ -93,14 +93,19 @@ var getNS = function getNS(factory) {
|
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
95
|
var ns = getNS();
|
|
96
|
-
var Handler = /*#__PURE__*/_createClass(
|
|
97
|
-
// TODO: Document, type
|
|
98
96
|
|
|
99
|
-
|
|
97
|
+
/** An extended interface of Response, since RDFlib.js adds some properties. */
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
/** tell typescript that a 'panes' child may exist on Window */
|
|
100
|
+
|
|
101
|
+
/** All valid inputs for initFetchOptions */
|
|
102
|
+
|
|
103
|
+
/** Initiated by initFetchOptions, which runs on load */
|
|
104
|
+
var Handler = /*#__PURE__*/_createClass(function Handler(response, dom) {
|
|
102
105
|
_classCallCheck(this, Handler);
|
|
106
|
+
// TODO: Document, type
|
|
103
107
|
_defineProperty(this, "response", void 0);
|
|
108
|
+
// TODO: Document, type
|
|
104
109
|
_defineProperty(this, "dom", void 0);
|
|
105
110
|
this.response = response;
|
|
106
111
|
// The type assertion operator here might need to be removed.
|
|
@@ -475,7 +480,11 @@ var N3Handler = /*#__PURE__*/function (_Handler7) {
|
|
|
475
480
|
value: function parse(fetcher, responseText, options, response) {
|
|
476
481
|
// Parse the text of this N3 file
|
|
477
482
|
var kb = fetcher.store;
|
|
478
|
-
var
|
|
483
|
+
var baseUrl = options.original.value;
|
|
484
|
+
var isContainer = kb.any(options.original, null, ns.ldp('Container'));
|
|
485
|
+
console.log('@@ isContainer ' + isContainer);
|
|
486
|
+
if (isContainer && !baseUrl.endsWith('/')) baseUrl = baseUrl + '/';
|
|
487
|
+
var p = N3Parser(kb, kb, options.original.value, baseUrl, null, null, '', null);
|
|
479
488
|
// p.loadBuf(xhr.responseText)
|
|
480
489
|
try {
|
|
481
490
|
p.loadBuf(responseText);
|
|
@@ -536,6 +545,10 @@ function isXMLNS(responseText) {
|
|
|
536
545
|
var match = responseText.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/);
|
|
537
546
|
return !!match;
|
|
538
547
|
}
|
|
548
|
+
|
|
549
|
+
// Not sure about the shapes of this. Response? FetchError?
|
|
550
|
+
|
|
551
|
+
/** Differs from normal Fetch, has an extended Response type */
|
|
539
552
|
/** Fetcher
|
|
540
553
|
*
|
|
541
554
|
* The Fetcher object is a helper object for a quadstore
|
|
@@ -545,34 +558,6 @@ function isXMLNS(responseText) {
|
|
|
545
558
|
* and put back the data to the web.
|
|
546
559
|
*/
|
|
547
560
|
var Fetcher = /*#__PURE__*/function () {
|
|
548
|
-
/** Denoting this session */
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* this.requested[uri] states:
|
|
552
|
-
* undefined no record of web access or records reset
|
|
553
|
-
* true has been requested, fetch in progress
|
|
554
|
-
* 'done' received, Ok
|
|
555
|
-
* 401 Not logged in
|
|
556
|
-
* 403 HTTP status unauthorized
|
|
557
|
-
* 404 Resource does not exist. Can be created etc.
|
|
558
|
-
* 'redirected' In attempt to counter CORS problems retried.
|
|
559
|
-
* 'parse_error' Parse error
|
|
560
|
-
* 'unsupported_protocol' URI is not a protocol Fetcher can deal with
|
|
561
|
-
* other strings mean various other errors.
|
|
562
|
-
*/
|
|
563
|
-
|
|
564
|
-
/** List of timeouts associated with a requested URL */
|
|
565
|
-
|
|
566
|
-
/** Redirected from *key uri* to *value uri* */
|
|
567
|
-
|
|
568
|
-
/** fetchCallbacks[uri].push(callback) */
|
|
569
|
-
|
|
570
|
-
/** Keep track of explicit 404s -> we can overwrite etc */
|
|
571
|
-
|
|
572
|
-
// TODO: Document this
|
|
573
|
-
|
|
574
|
-
/** Methods added by calling Util.callbackify in the constructor*/
|
|
575
|
-
|
|
576
561
|
function Fetcher(store) {
|
|
577
562
|
var _this = this;
|
|
578
563
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -581,16 +566,35 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
581
566
|
_defineProperty(this, "timeout", void 0);
|
|
582
567
|
_defineProperty(this, "_fetch", void 0);
|
|
583
568
|
_defineProperty(this, "mediatypes", void 0);
|
|
569
|
+
/** Denoting this session */
|
|
584
570
|
_defineProperty(this, "appNode", void 0);
|
|
571
|
+
/**
|
|
572
|
+
* this.requested[uri] states:
|
|
573
|
+
* undefined no record of web access or records reset
|
|
574
|
+
* true has been requested, fetch in progress
|
|
575
|
+
* 'done' received, Ok
|
|
576
|
+
* 401 Not logged in
|
|
577
|
+
* 403 HTTP status unauthorized
|
|
578
|
+
* 404 Resource does not exist. Can be created etc.
|
|
579
|
+
* 'redirected' In attempt to counter CORS problems retried.
|
|
580
|
+
* 'parse_error' Parse error
|
|
581
|
+
* 'unsupported_protocol' URI is not a protocol Fetcher can deal with
|
|
582
|
+
* other strings mean various other errors.
|
|
583
|
+
*/
|
|
585
584
|
_defineProperty(this, "requested", void 0);
|
|
585
|
+
/** List of timeouts associated with a requested URL */
|
|
586
586
|
_defineProperty(this, "timeouts", void 0);
|
|
587
|
+
/** Redirected from *key uri* to *value uri* */
|
|
587
588
|
_defineProperty(this, "redirectedTo", void 0);
|
|
588
589
|
_defineProperty(this, "fetchQueue", void 0);
|
|
590
|
+
/** fetchCallbacks[uri].push(callback) */
|
|
589
591
|
_defineProperty(this, "fetchCallbacks", void 0);
|
|
592
|
+
/** Keep track of explicit 404s -> we can overwrite etc */
|
|
590
593
|
_defineProperty(this, "nonexistent", void 0);
|
|
591
594
|
_defineProperty(this, "lookedUp", void 0);
|
|
592
595
|
_defineProperty(this, "handlers", void 0);
|
|
593
596
|
_defineProperty(this, "ns", void 0);
|
|
597
|
+
/** Methods added by calling Util.callbackify in the constructor*/
|
|
594
598
|
_defineProperty(this, "fireCallbacks", void 0);
|
|
595
599
|
this.store = store || new IndexedFormula();
|
|
596
600
|
this.ns = getNS(this.store.rdfFactory);
|
|
@@ -1983,6 +1987,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1983
1987
|
}();
|
|
1984
1988
|
_defineProperty(Fetcher, "HANDLERS", void 0);
|
|
1985
1989
|
_defineProperty(Fetcher, "CONTENT_TYPE_BY_EXT", void 0);
|
|
1990
|
+
// TODO: Document this
|
|
1986
1991
|
_defineProperty(Fetcher, "crossSiteProxyTemplate", void 0);
|
|
1987
1992
|
export { Fetcher as default };
|
|
1988
1993
|
Fetcher.HANDLERS = defaultHandlers;
|
package/esm/formula.js
CHANGED
|
@@ -28,19 +28,6 @@ import NamedNode from './named-node';
|
|
|
28
28
|
var Formula = /*#__PURE__*/function (_Node) {
|
|
29
29
|
_inherits(Formula, _Node);
|
|
30
30
|
var _super = _createSuper(Formula);
|
|
31
|
-
/**
|
|
32
|
-
* The accompanying fetcher instance.
|
|
33
|
-
*
|
|
34
|
-
* Is set by the fetcher when initialized.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* A namespace for the specified namespace's URI
|
|
39
|
-
* @param nsuri The URI for the namespace
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/** The factory used to generate statements and terms */
|
|
43
|
-
|
|
44
31
|
/**
|
|
45
32
|
* Initializes this formula
|
|
46
33
|
* @constructor
|
|
@@ -66,9 +53,19 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
66
53
|
_this.optional = optional;
|
|
67
54
|
_defineProperty(_assertThisInitialized(_this), "termType", GraphTermType);
|
|
68
55
|
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Graph);
|
|
56
|
+
/**
|
|
57
|
+
* The accompanying fetcher instance.
|
|
58
|
+
*
|
|
59
|
+
* Is set by the fetcher when initialized.
|
|
60
|
+
*/
|
|
69
61
|
_defineProperty(_assertThisInitialized(_this), "fetcher", void 0);
|
|
70
62
|
_defineProperty(_assertThisInitialized(_this), "isVar", 0);
|
|
63
|
+
/**
|
|
64
|
+
* A namespace for the specified namespace's URI
|
|
65
|
+
* @param nsuri The URI for the namespace
|
|
66
|
+
*/
|
|
71
67
|
_defineProperty(_assertThisInitialized(_this), "ns", Namespace);
|
|
68
|
+
/** The factory used to generate statements and terms */
|
|
72
69
|
_defineProperty(_assertThisInitialized(_this), "rdfFactory", void 0);
|
|
73
70
|
_this.rdfFactory = opts && opts.rdfFactory || CanonicalDataFactory;
|
|
74
71
|
// Enable default factory methods on this while preserving factory context.
|
package/esm/jsonldparser.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import jsonld from 'jsonld';
|
|
2
1
|
import { arrayToStatements } from './utils';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -60,8 +59,10 @@ function listToCollection(kb, obj) {
|
|
|
60
59
|
*/
|
|
61
60
|
export default function jsonldParser(str, kb, base, callback) {
|
|
62
61
|
var baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
|
|
63
|
-
return jsonld.
|
|
64
|
-
|
|
62
|
+
return import('jsonld').then(function (jsonld) {
|
|
63
|
+
return jsonld.flatten(JSON.parse(str), null, {
|
|
64
|
+
base: baseString
|
|
65
|
+
});
|
|
65
66
|
}).then(function (flattened) {
|
|
66
67
|
return flattened.reduce(function (store, flatResource) {
|
|
67
68
|
kb = processResource(kb, base, flatResource);
|
package/esm/lists.js
CHANGED
|
@@ -13,13 +13,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
// import RDFParser from './rdfxmlparser'
|
|
14
14
|
// import sparqlUpdateParser from './patch-parser'
|
|
15
15
|
// import * as Util from './utils-js'
|
|
16
|
-
|
|
17
16
|
// import BlankNode from './blank-node'
|
|
18
17
|
// import NamedNode from './named-node'
|
|
19
18
|
import Collection from './collection';
|
|
20
19
|
import Statement from './statement';
|
|
21
20
|
// import Formula from './formula'
|
|
22
21
|
|
|
22
|
+
// import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'
|
|
23
|
+
// import { Quad } from './tf-types'
|
|
23
24
|
import Namespace from './namespace';
|
|
24
25
|
var RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
25
26
|
|
package/esm/literal.js
CHANGED
|
@@ -21,14 +21,6 @@ import XSD from './xsd-internal';
|
|
|
21
21
|
var Literal = /*#__PURE__*/function (_Node) {
|
|
22
22
|
_inherits(Literal, _Node);
|
|
23
23
|
var _super = _createSuper(Literal);
|
|
24
|
-
/**
|
|
25
|
-
* The literal's datatype as a named node
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The language for the literal
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
24
|
/**
|
|
33
25
|
* Initializes a literal
|
|
34
26
|
* @param value - The literal's lexical value
|
|
@@ -41,8 +33,14 @@ var Literal = /*#__PURE__*/function (_Node) {
|
|
|
41
33
|
_this = _super.call(this, value);
|
|
42
34
|
_defineProperty(_assertThisInitialized(_this), "termType", LiteralTermType);
|
|
43
35
|
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Literal);
|
|
36
|
+
/**
|
|
37
|
+
* The literal's datatype as a named node
|
|
38
|
+
*/
|
|
44
39
|
_defineProperty(_assertThisInitialized(_this), "datatype", XSD.string);
|
|
45
40
|
_defineProperty(_assertThisInitialized(_this), "isVar", 0);
|
|
41
|
+
/**
|
|
42
|
+
* The language for the literal
|
|
43
|
+
*/
|
|
46
44
|
_defineProperty(_assertThisInitialized(_this), "language", '');
|
|
47
45
|
if (language) {
|
|
48
46
|
_this.language = language;
|
package/esm/node-internal.js
CHANGED
|
@@ -10,20 +10,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
10
10
|
* @class Node
|
|
11
11
|
*/
|
|
12
12
|
var Node = /*#__PURE__*/function () {
|
|
13
|
-
// Specified in './node.ts' to prevent circular dependency
|
|
14
|
-
|
|
15
|
-
// Specified in './node.ts' to prevent circular dependency
|
|
16
|
-
|
|
17
|
-
/** The type of node */
|
|
18
|
-
|
|
19
|
-
/** The class order for this node */
|
|
20
|
-
|
|
21
|
-
/** The node's value */
|
|
22
|
-
|
|
23
13
|
function Node(value) {
|
|
24
14
|
_classCallCheck(this, Node);
|
|
15
|
+
/** The type of node */
|
|
25
16
|
_defineProperty(this, "termType", void 0);
|
|
17
|
+
/** The class order for this node */
|
|
26
18
|
_defineProperty(this, "classOrder", void 0);
|
|
19
|
+
/** The node's value */
|
|
27
20
|
_defineProperty(this, "value", void 0);
|
|
28
21
|
this.value = value;
|
|
29
22
|
}
|
|
@@ -132,6 +125,8 @@ var Node = /*#__PURE__*/function () {
|
|
|
132
125
|
}]);
|
|
133
126
|
return Node;
|
|
134
127
|
}();
|
|
128
|
+
// Specified in './node.ts' to prevent circular dependency
|
|
135
129
|
_defineProperty(Node, "fromValue", void 0);
|
|
130
|
+
// Specified in './node.ts' to prevent circular dependency
|
|
136
131
|
_defineProperty(Node, "toJS", void 0);
|
|
137
132
|
export { Node as default };
|
package/esm/rdfxmlparser.js
CHANGED
|
@@ -474,6 +474,9 @@ _defineProperty(RDFParser, "ns", {
|
|
|
474
474
|
'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
475
475
|
'RDFS': 'http://www.w3.org/2000/01/rdf-schema#'
|
|
476
476
|
});
|
|
477
|
+
/** DOM Level 2 node type magic numbers @final
|
|
478
|
+
* @member RDFParser
|
|
479
|
+
*/
|
|
477
480
|
_defineProperty(RDFParser, "nodeType", {
|
|
478
481
|
'ELEMENT': 1,
|
|
479
482
|
'ATTRIBUTE': 2,
|
package/esm/serializer.js
CHANGED
|
@@ -25,6 +25,7 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
25
25
|
_classCallCheck(this, Serializer);
|
|
26
26
|
_defineProperty(this, "_notQNameChars", '\t\r\n !"#$%&\'()*.,+/;<=>?@[\\]^`{|}~');
|
|
27
27
|
_defineProperty(this, "_notNameChars", this._notQNameChars + ':');
|
|
28
|
+
// stringToN3: String escaping for N3
|
|
28
29
|
_defineProperty(this, "validPrefix", new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/));
|
|
29
30
|
_defineProperty(this, "forbidden1", new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm));
|
|
30
31
|
_defineProperty(this, "forbidden3", new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm));
|
|
@@ -588,8 +589,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
588
589
|
throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType);
|
|
589
590
|
}
|
|
590
591
|
}
|
|
591
|
-
|
|
592
|
-
// stringToN3: String escaping for N3
|
|
593
592
|
}, {
|
|
594
593
|
key: "stringToN3",
|
|
595
594
|
value: function stringToN3(str, flags) {
|
package/esm/statement.js
CHANGED
|
@@ -8,17 +8,6 @@ var defaultGraph = new DefaultGraphNode();
|
|
|
8
8
|
|
|
9
9
|
/** A Statement represents an RDF Triple or Quad. */
|
|
10
10
|
var Statement = /*#__PURE__*/function () {
|
|
11
|
-
/** The subject of the triple. What the Statement is about. */
|
|
12
|
-
|
|
13
|
-
/** The relationship which is asserted between the subject and object */
|
|
14
|
-
|
|
15
|
-
/** The thing or data value which is asserted to be related to the subject */
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The graph param is a named node of the document in which the triple when
|
|
19
|
-
* it is stored on the web.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
11
|
/**
|
|
23
12
|
* Construct a new statement
|
|
24
13
|
*
|
|
@@ -38,9 +27,16 @@ var Statement = /*#__PURE__*/function () {
|
|
|
38
27
|
*/
|
|
39
28
|
function Statement(subject, predicate, object, graph) {
|
|
40
29
|
_classCallCheck(this, Statement);
|
|
30
|
+
/** The subject of the triple. What the Statement is about. */
|
|
41
31
|
_defineProperty(this, "subject", void 0);
|
|
32
|
+
/** The relationship which is asserted between the subject and object */
|
|
42
33
|
_defineProperty(this, "predicate", void 0);
|
|
34
|
+
/** The thing or data value which is asserted to be related to the subject */
|
|
43
35
|
_defineProperty(this, "object", void 0);
|
|
36
|
+
/**
|
|
37
|
+
* The graph param is a named node of the document in which the triple when
|
|
38
|
+
* it is stored on the web.
|
|
39
|
+
*/
|
|
44
40
|
_defineProperty(this, "graph", void 0);
|
|
45
41
|
this.subject = Node.fromValue(subject);
|
|
46
42
|
this.predicate = Node.fromValue(predicate);
|
package/esm/store.js
CHANGED
|
@@ -98,37 +98,6 @@ function handleRDFType(formula, subj, pred, obj, why) {
|
|
|
98
98
|
var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
99
99
|
_inherits(IndexedFormula, _Formula);
|
|
100
100
|
var _super = _createSuper(IndexedFormula);
|
|
101
|
-
// IN future - allow pass array of statements to constructor
|
|
102
|
-
/**
|
|
103
|
-
* An UpdateManager initialised to this store
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Dictionary of namespace prefixes
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
/** Map of iri predicates to functions to call when adding { s type X } */
|
|
111
|
-
|
|
112
|
-
/** Map of iri predicates to functions to call when getting statement with {s X o} */
|
|
113
|
-
|
|
114
|
-
/** Redirect to lexically smaller equivalent symbol */
|
|
115
|
-
|
|
116
|
-
/** Reverse mapping to redirection: aliases for this */
|
|
117
|
-
|
|
118
|
-
/** Redirections we got from HTTP */
|
|
119
|
-
|
|
120
|
-
/** Array of statements with this X as subject */
|
|
121
|
-
|
|
122
|
-
/** Array of statements with this X as predicate */
|
|
123
|
-
|
|
124
|
-
/** Array of statements with this X as object */
|
|
125
|
-
|
|
126
|
-
/** Array of statements with X as provenance */
|
|
127
|
-
|
|
128
|
-
/** Function to remove quads from the store arrays with */
|
|
129
|
-
|
|
130
|
-
/** Callbacks which are triggered after a statement has been added to the store */
|
|
131
|
-
|
|
132
101
|
/**
|
|
133
102
|
* Creates a new formula
|
|
134
103
|
* @param features - What sort of automatic processing to do? Array of string
|
|
@@ -143,22 +112,40 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
|
|
|
143
112
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
144
113
|
_classCallCheck(this, IndexedFormula);
|
|
145
114
|
_this = _super.call(this, undefined, undefined, undefined, undefined, opts);
|
|
115
|
+
// IN future - allow pass array of statements to constructor
|
|
116
|
+
/**
|
|
117
|
+
* An UpdateManager initialised to this store
|
|
118
|
+
*/
|
|
146
119
|
_defineProperty(_assertThisInitialized(_this), "updater", void 0);
|
|
120
|
+
/**
|
|
121
|
+
* Dictionary of namespace prefixes
|
|
122
|
+
*/
|
|
147
123
|
_defineProperty(_assertThisInitialized(_this), "namespaces", void 0);
|
|
124
|
+
/** Map of iri predicates to functions to call when adding { s type X } */
|
|
148
125
|
_defineProperty(_assertThisInitialized(_this), "classActions", void 0);
|
|
126
|
+
/** Map of iri predicates to functions to call when getting statement with {s X o} */
|
|
149
127
|
_defineProperty(_assertThisInitialized(_this), "propertyActions", void 0);
|
|
128
|
+
/** Redirect to lexically smaller equivalent symbol */
|
|
150
129
|
_defineProperty(_assertThisInitialized(_this), "redirections", void 0);
|
|
130
|
+
/** Reverse mapping to redirection: aliases for this */
|
|
151
131
|
_defineProperty(_assertThisInitialized(_this), "aliases", void 0);
|
|
132
|
+
/** Redirections we got from HTTP */
|
|
152
133
|
_defineProperty(_assertThisInitialized(_this), "HTTPRedirects", void 0);
|
|
134
|
+
/** Array of statements with this X as subject */
|
|
153
135
|
_defineProperty(_assertThisInitialized(_this), "subjectIndex", void 0);
|
|
136
|
+
/** Array of statements with this X as predicate */
|
|
154
137
|
_defineProperty(_assertThisInitialized(_this), "predicateIndex", void 0);
|
|
138
|
+
/** Array of statements with this X as object */
|
|
155
139
|
_defineProperty(_assertThisInitialized(_this), "objectIndex", void 0);
|
|
140
|
+
/** Array of statements with X as provenance */
|
|
156
141
|
_defineProperty(_assertThisInitialized(_this), "whyIndex", void 0);
|
|
157
142
|
_defineProperty(_assertThisInitialized(_this), "index", void 0);
|
|
158
143
|
_defineProperty(_assertThisInitialized(_this), "features", void 0);
|
|
159
144
|
_defineProperty(_assertThisInitialized(_this), "_universalVariables", void 0);
|
|
160
145
|
_defineProperty(_assertThisInitialized(_this), "_existentialVariables", void 0);
|
|
146
|
+
/** Function to remove quads from the store arrays with */
|
|
161
147
|
_defineProperty(_assertThisInitialized(_this), "rdfArrayRemove", void 0);
|
|
148
|
+
/** Callbacks which are triggered after a statement has been added to the store */
|
|
162
149
|
_defineProperty(_assertThisInitialized(_this), "dataCallbacks", void 0);
|
|
163
150
|
_this.propertyActions = {};
|
|
164
151
|
_this.classActions = {};
|
package/esm/types.js
CHANGED
|
@@ -23,4 +23,21 @@ export var XHTMLContentType = "application/xhtml+xml";
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* A valid mime type header
|
|
26
|
-
*/
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** A type for values that serves as inputs */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* In this project, there exist two types for the same kind of RDF concept.
|
|
32
|
+
* We have RDF/JS spec types (standardized, generic), and RDFlib types (internal, specific).
|
|
33
|
+
* When deciding which type to use in a function, it is preferable to accept generic inputs,
|
|
34
|
+
* whenever possible, and provide strict outputs.
|
|
35
|
+
* In some ways, the TF types in here are a bit more strict.
|
|
36
|
+
* Variables are missing, and the statement requires specific types of terms (e.g. NamedNode instead of Term).
|
|
37
|
+
*/
|
|
38
|
+
/** An RDF/JS Subject */
|
|
39
|
+
/** An RDF/JS Predicate */
|
|
40
|
+
/** An RDF/JS Object */
|
|
41
|
+
/** An RDF/JS Graph */
|
|
42
|
+
// | Formula
|
|
43
|
+
/** All the types that a .fromValue() method might return */
|
package/esm/update-manager.js
CHANGED
|
@@ -28,10 +28,6 @@ import { termValue } from './utils/termValue';
|
|
|
28
28
|
* and also looking out for concurrent updates from other agents
|
|
29
29
|
*/
|
|
30
30
|
var UpdateManager = /*#__PURE__*/function () {
|
|
31
|
-
/** Index of objects for coordinating incoming and outgoing patches */
|
|
32
|
-
|
|
33
|
-
/** Object of namespaces */
|
|
34
|
-
|
|
35
31
|
/**
|
|
36
32
|
* @param store - The quadstore to store data and metadata. Created if not passed.
|
|
37
33
|
*/
|
|
@@ -40,7 +36,9 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
40
36
|
_defineProperty(this, "store", void 0);
|
|
41
37
|
_defineProperty(this, "ifps", void 0);
|
|
42
38
|
_defineProperty(this, "fps", void 0);
|
|
39
|
+
/** Index of objects for coordinating incoming and outgoing patches */
|
|
43
40
|
_defineProperty(this, "patchControl", void 0);
|
|
41
|
+
/** Object of namespaces */
|
|
44
42
|
_defineProperty(this, "ns", void 0);
|
|
45
43
|
store = store || new IndexedFormula();
|
|
46
44
|
if (store.updater) {
|
package/esm/utils.js
CHANGED
package/esm/variable.js
CHANGED
|
@@ -21,10 +21,6 @@ import * as Uri from './uri';
|
|
|
21
21
|
var Variable = /*#__PURE__*/function (_Node) {
|
|
22
22
|
_inherits(Variable, _Node);
|
|
23
23
|
var _super = _createSuper(Variable);
|
|
24
|
-
/** The base string for a variable's name */
|
|
25
|
-
|
|
26
|
-
/** The unique identifier of this variable */
|
|
27
|
-
|
|
28
24
|
/**
|
|
29
25
|
* Initializes this variable
|
|
30
26
|
* @param name The variable's name
|
|
@@ -35,9 +31,11 @@ var Variable = /*#__PURE__*/function (_Node) {
|
|
|
35
31
|
_classCallCheck(this, Variable);
|
|
36
32
|
_this = _super.call(this, name);
|
|
37
33
|
_defineProperty(_assertThisInitialized(_this), "termType", VariableTermType);
|
|
34
|
+
/** The base string for a variable's name */
|
|
38
35
|
_defineProperty(_assertThisInitialized(_this), "base", 'varid:');
|
|
39
36
|
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Variable);
|
|
40
37
|
_defineProperty(_assertThisInitialized(_this), "isVar", 1);
|
|
38
|
+
/** The unique identifier of this variable */
|
|
41
39
|
_defineProperty(_assertThisInitialized(_this), "uri", void 0);
|
|
42
40
|
_this.base = 'varid:';
|
|
43
41
|
_this.uri = Uri.join(name, _this.base);
|
package/lib/blank-node.js
CHANGED
|
@@ -34,7 +34,13 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
34
34
|
_this = _super.call(this, BlankNode.getId(id));
|
|
35
35
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "termType", _types.BlankNodeTermType);
|
|
36
36
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.BlankNode);
|
|
37
|
+
/** Whether this is a blank node */
|
|
37
38
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBlank", 1);
|
|
39
|
+
/**
|
|
40
|
+
* This type of node is a variable.
|
|
41
|
+
*
|
|
42
|
+
* Note that the existence of this property already indicates that it is a variable.
|
|
43
|
+
*/
|
|
38
44
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVar", 1);
|
|
39
45
|
return _this;
|
|
40
46
|
}
|
|
@@ -92,12 +98,7 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
92
98
|
}
|
|
93
99
|
}], [{
|
|
94
100
|
key: "getId",
|
|
95
|
-
value:
|
|
96
|
-
/**
|
|
97
|
-
* The next unique identifier for blank nodes
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
function getId(id) {
|
|
101
|
+
value: function getId(id) {
|
|
101
102
|
if (id) {
|
|
102
103
|
if (typeof id !== 'string') {
|
|
103
104
|
throw new Error('Bad id argument to new blank node: ' + id);
|
|
@@ -115,5 +116,8 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
115
116
|
return BlankNode;
|
|
116
117
|
}(_nodeInternal.default);
|
|
117
118
|
exports.default = BlankNode;
|
|
119
|
+
/**
|
|
120
|
+
* The next unique identifier for blank nodes
|
|
121
|
+
*/
|
|
118
122
|
(0, _defineProperty2.default)(BlankNode, "nextId", 0);
|
|
119
123
|
(0, _defineProperty2.default)(BlankNode, "NTAnonymousNodePrefix", '_:');
|
package/lib/collection.js
CHANGED
|
@@ -51,10 +51,6 @@ function fromValue(value) {
|
|
|
51
51
|
var Collection = /*#__PURE__*/function (_Node) {
|
|
52
52
|
(0, _inherits2.default)(Collection, _Node);
|
|
53
53
|
var _super = _createSuper(Collection);
|
|
54
|
-
/**
|
|
55
|
-
* The nodes in this collection
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
54
|
function Collection(initial) {
|
|
59
55
|
var _this;
|
|
60
56
|
(0, _classCallCheck2.default)(this, Collection);
|
|
@@ -63,6 +59,9 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
63
59
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.Collection);
|
|
64
60
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closed", false);
|
|
65
61
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "compareTerm", _blankNode.default.prototype.compareTerm);
|
|
62
|
+
/**
|
|
63
|
+
* The nodes in this collection
|
|
64
|
+
*/
|
|
66
65
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "elements", []);
|
|
67
66
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVar", 0);
|
|
68
67
|
if (initial && initial.length > 0) {
|
|
@@ -5,15 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Feature = void 0;
|
|
7
7
|
/** A set of features that may be supported by a Data Factory */
|
|
8
|
-
var Feature
|
|
9
|
-
/**
|
|
10
|
-
* Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
|
|
11
|
-
* but with additional extensions
|
|
12
|
-
*
|
|
13
|
-
* bnIndex is optional but useful.
|
|
14
|
-
*/
|
|
15
|
-
exports.Feature = Feature;
|
|
16
|
-
(function (Feature) {
|
|
8
|
+
var Feature = /*#__PURE__*/function (Feature) {
|
|
17
9
|
Feature["collections"] = "COLLECTIONS";
|
|
18
10
|
Feature["defaultGraphType"] = "DEFAULT_GRAPH_TYPE";
|
|
19
11
|
Feature["equalsMethod"] = "EQUALS_METHOD";
|
|
@@ -21,4 +13,12 @@ exports.Feature = Feature;
|
|
|
21
13
|
Feature["identity"] = "IDENTITY";
|
|
22
14
|
Feature["reversibleId"] = "REVERSIBLE_ID";
|
|
23
15
|
Feature["variableType"] = "VARIABLE_TYPE";
|
|
24
|
-
|
|
16
|
+
return Feature;
|
|
17
|
+
}({});
|
|
18
|
+
/**
|
|
19
|
+
* Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
|
|
20
|
+
* but with additional extensions
|
|
21
|
+
*
|
|
22
|
+
* bnIndex is optional but useful.
|
|
23
|
+
*/
|
|
24
|
+
exports.Feature = Feature;
|