rdflib 2.3.7 → 2.3.8
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.map +1 -1
- package/esm/factories/canonical-data-factory.js +5 -0
- package/esm/factories/extended-term-factory.js +1 -3
- package/lib/factories/canonical-data-factory.js +5 -0
- package/lib/factories/extended-term-factory.js +1 -3
- package/package.json +1 -1
- package/src/factories/canonical-data-factory.ts +4 -0
- package/src/factories/extended-term-factory.ts +1 -2
|
@@ -7,6 +7,7 @@ import { EmptyTermType, DefaultGraphTermType, VariableTermType, BlankNodeTermTyp
|
|
|
7
7
|
import DefaultGraph from '../default-graph';
|
|
8
8
|
import { Feature } from './factory-types';
|
|
9
9
|
import { isQuad, isTerm } from '../utils/terms';
|
|
10
|
+
import Collection from "../collection";
|
|
10
11
|
export { defaultGraphURI } from '../utils/default-graph-uri';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -69,6 +70,10 @@ const CanonicalDataFactory = {
|
|
|
69
70
|
switch (term.termType) {
|
|
70
71
|
case DefaultGraphTermType:
|
|
71
72
|
return 'defaultGraph';
|
|
73
|
+
case CollectionTermType:
|
|
74
|
+
// Collections are mutable (elements can change), so ID must be stable.
|
|
75
|
+
// Use the collection's blank-node-like identifier, not element content.
|
|
76
|
+
return Collection.toNT(term);
|
|
72
77
|
case VariableTermType:
|
|
73
78
|
return Variable.toString(term);
|
|
74
79
|
default:
|
|
@@ -29,9 +29,7 @@ const ExtendedTermFactory = {
|
|
|
29
29
|
},
|
|
30
30
|
id(term) {
|
|
31
31
|
if (isCollection(term)) {
|
|
32
|
-
return
|
|
33
|
-
return this.id(e);
|
|
34
|
-
}).join(', ')} )`;
|
|
32
|
+
return Collection.toNT(term);
|
|
35
33
|
}
|
|
36
34
|
if (isVariable(term)) {
|
|
37
35
|
return Variable.toString(term);
|
|
@@ -20,6 +20,7 @@ var _types = require("../types");
|
|
|
20
20
|
var _defaultGraph = _interopRequireDefault(require("../default-graph"));
|
|
21
21
|
var _factoryTypes = require("./factory-types");
|
|
22
22
|
var _terms = require("../utils/terms");
|
|
23
|
+
var _collection = _interopRequireDefault(require("../collection"));
|
|
23
24
|
var _defaultGraphUri = require("../utils/default-graph-uri");
|
|
24
25
|
/**
|
|
25
26
|
* Gets the default graph
|
|
@@ -81,6 +82,10 @@ const CanonicalDataFactory = {
|
|
|
81
82
|
switch (term.termType) {
|
|
82
83
|
case _types.DefaultGraphTermType:
|
|
83
84
|
return 'defaultGraph';
|
|
85
|
+
case _types.CollectionTermType:
|
|
86
|
+
// Collections are mutable (elements can change), so ID must be stable.
|
|
87
|
+
// Use the collection's blank-node-like identifier, not element content.
|
|
88
|
+
return _collection.default.toNT(term);
|
|
84
89
|
case _types.VariableTermType:
|
|
85
90
|
return _variable.default.toString(term);
|
|
86
91
|
default:
|
|
@@ -36,9 +36,7 @@ const ExtendedTermFactory = {
|
|
|
36
36
|
},
|
|
37
37
|
id(term) {
|
|
38
38
|
if ((0, _terms.isCollection)(term)) {
|
|
39
|
-
return
|
|
40
|
-
return this.id(e);
|
|
41
|
-
}).join(', ')} )`;
|
|
39
|
+
return _collection.default.toNT(term);
|
|
42
40
|
}
|
|
43
41
|
if ((0, _terms.isVariable)(term)) {
|
|
44
42
|
return _variable.default.toString(term);
|
package/package.json
CHANGED
|
@@ -106,6 +106,10 @@ const CanonicalDataFactory: DataFactory = {
|
|
|
106
106
|
switch (term.termType) {
|
|
107
107
|
case DefaultGraphTermType:
|
|
108
108
|
return 'defaultGraph'
|
|
109
|
+
case CollectionTermType:
|
|
110
|
+
// Collections are mutable (elements can change), so ID must be stable.
|
|
111
|
+
// Use the collection's blank-node-like identifier, not element content.
|
|
112
|
+
return Collection.toNT(term as Collection)
|
|
109
113
|
case VariableTermType:
|
|
110
114
|
return Variable.toString(term)
|
|
111
115
|
default:
|
|
@@ -38,8 +38,7 @@ const ExtendedTermFactory: CollectionFactory = {
|
|
|
38
38
|
|
|
39
39
|
id (term: Term | DefaultFactoryTypes): Indexable {
|
|
40
40
|
if (isCollection(term)) {
|
|
41
|
-
return
|
|
42
|
-
return this.id(e) }).join(', ')} )`
|
|
41
|
+
return Collection.toNT(term)
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
if (isVariable(term)) {
|