@_linked/rdf-mem-store 0.0.1

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +285 -0
  3. package/lib/cjs/Datafactory.d.ts +29 -0
  4. package/lib/cjs/Datafactory.js +101 -0
  5. package/lib/cjs/Datafactory.js.map +1 -0
  6. package/lib/cjs/InMemoryStore.d.ts +35 -0
  7. package/lib/cjs/InMemoryStore.js +98 -0
  8. package/lib/cjs/InMemoryStore.js.map +1 -0
  9. package/lib/cjs/collections/NodeMap.d.ts +35 -0
  10. package/lib/cjs/collections/NodeMap.js +244 -0
  11. package/lib/cjs/collections/NodeMap.js.map +1 -0
  12. package/lib/cjs/collections/NodeSet.d.ts +55 -0
  13. package/lib/cjs/collections/NodeSet.js +296 -0
  14. package/lib/cjs/collections/NodeSet.js.map +1 -0
  15. package/lib/cjs/collections/NodeURIMappings.d.ts +20 -0
  16. package/lib/cjs/collections/NodeURIMappings.js +65 -0
  17. package/lib/cjs/collections/NodeURIMappings.js.map +1 -0
  18. package/lib/cjs/collections/NodeValuesSet.d.ts +63 -0
  19. package/lib/cjs/collections/NodeValuesSet.js +100 -0
  20. package/lib/cjs/collections/NodeValuesSet.js.map +1 -0
  21. package/lib/cjs/collections/QuadArray.d.ts +17 -0
  22. package/lib/cjs/collections/QuadArray.js +67 -0
  23. package/lib/cjs/collections/QuadArray.js.map +1 -0
  24. package/lib/cjs/collections/QuadMap.d.ts +64 -0
  25. package/lib/cjs/collections/QuadMap.js +155 -0
  26. package/lib/cjs/collections/QuadMap.js.map +1 -0
  27. package/lib/cjs/collections/QuadSet.d.ts +22 -0
  28. package/lib/cjs/collections/QuadSet.js +106 -0
  29. package/lib/cjs/collections/QuadSet.js.map +1 -0
  30. package/lib/cjs/collections/SearchMap.d.ts +5 -0
  31. package/lib/cjs/collections/SearchMap.js +13 -0
  32. package/lib/cjs/collections/SearchMap.js.map +1 -0
  33. package/lib/cjs/events/EventBatcher.d.ts +20 -0
  34. package/lib/cjs/events/EventBatcher.js +97 -0
  35. package/lib/cjs/events/EventBatcher.js.map +1 -0
  36. package/lib/cjs/events/EventEmitter.d.ts +15 -0
  37. package/lib/cjs/events/EventEmitter.js +102 -0
  38. package/lib/cjs/events/EventEmitter.js.map +1 -0
  39. package/lib/cjs/index.d.ts +14 -0
  40. package/lib/cjs/index.js +48 -0
  41. package/lib/cjs/index.js.map +1 -0
  42. package/lib/cjs/interfaces/IGraphObject.d.ts +29 -0
  43. package/lib/cjs/interfaces/IGraphObject.js +3 -0
  44. package/lib/cjs/interfaces/IGraphObject.js.map +1 -0
  45. package/lib/cjs/interfaces/IGraphObjectSet.d.ts +24 -0
  46. package/lib/cjs/interfaces/IGraphObjectSet.js +3 -0
  47. package/lib/cjs/interfaces/IGraphObjectSet.js.map +1 -0
  48. package/lib/cjs/interfaces/IShape.d.ts +22 -0
  49. package/lib/cjs/interfaces/IShape.js +3 -0
  50. package/lib/cjs/interfaces/IShape.js.map +1 -0
  51. package/lib/cjs/interfaces/ISingleGraphObject.d.ts +3 -0
  52. package/lib/cjs/interfaces/ISingleGraphObject.js +3 -0
  53. package/lib/cjs/interfaces/ISingleGraphObject.js.map +1 -0
  54. package/lib/cjs/models.d.ts +1167 -0
  55. package/lib/cjs/models.js +2668 -0
  56. package/lib/cjs/models.js.map +1 -0
  57. package/lib/cjs/package.json +3 -0
  58. package/lib/cjs/utils/Debug.d.ts +3 -0
  59. package/lib/cjs/utils/Debug.js +46 -0
  60. package/lib/cjs/utils/Debug.js.map +1 -0
  61. package/lib/cjs/utils/LocalQueryResolver.d.ts +21 -0
  62. package/lib/cjs/utils/LocalQueryResolver.js +1442 -0
  63. package/lib/cjs/utils/LocalQueryResolver.js.map +1 -0
  64. package/lib/cjs/utils/URI.d.ts +18 -0
  65. package/lib/cjs/utils/URI.js +42 -0
  66. package/lib/cjs/utils/URI.js.map +1 -0
  67. package/lib/cjs/utils/toNamedNode.d.ts +8 -0
  68. package/lib/cjs/utils/toNamedNode.js +15 -0
  69. package/lib/cjs/utils/toNamedNode.js.map +1 -0
  70. package/lib/esm/Datafactory.d.ts +29 -0
  71. package/lib/esm/Datafactory.js +97 -0
  72. package/lib/esm/Datafactory.js.map +1 -0
  73. package/lib/esm/InMemoryStore.d.ts +35 -0
  74. package/lib/esm/InMemoryStore.js +94 -0
  75. package/lib/esm/InMemoryStore.js.map +1 -0
  76. package/lib/esm/collections/NodeMap.d.ts +35 -0
  77. package/lib/esm/collections/NodeMap.js +240 -0
  78. package/lib/esm/collections/NodeMap.js.map +1 -0
  79. package/lib/esm/collections/NodeSet.d.ts +55 -0
  80. package/lib/esm/collections/NodeSet.js +292 -0
  81. package/lib/esm/collections/NodeSet.js.map +1 -0
  82. package/lib/esm/collections/NodeURIMappings.d.ts +20 -0
  83. package/lib/esm/collections/NodeURIMappings.js +61 -0
  84. package/lib/esm/collections/NodeURIMappings.js.map +1 -0
  85. package/lib/esm/collections/NodeValuesSet.d.ts +63 -0
  86. package/lib/esm/collections/NodeValuesSet.js +96 -0
  87. package/lib/esm/collections/NodeValuesSet.js.map +1 -0
  88. package/lib/esm/collections/QuadArray.d.ts +17 -0
  89. package/lib/esm/collections/QuadArray.js +63 -0
  90. package/lib/esm/collections/QuadArray.js.map +1 -0
  91. package/lib/esm/collections/QuadMap.d.ts +64 -0
  92. package/lib/esm/collections/QuadMap.js +151 -0
  93. package/lib/esm/collections/QuadMap.js.map +1 -0
  94. package/lib/esm/collections/QuadSet.d.ts +22 -0
  95. package/lib/esm/collections/QuadSet.js +102 -0
  96. package/lib/esm/collections/QuadSet.js.map +1 -0
  97. package/lib/esm/collections/SearchMap.d.ts +5 -0
  98. package/lib/esm/collections/SearchMap.js +9 -0
  99. package/lib/esm/collections/SearchMap.js.map +1 -0
  100. package/lib/esm/events/EventBatcher.d.ts +20 -0
  101. package/lib/esm/events/EventBatcher.js +90 -0
  102. package/lib/esm/events/EventBatcher.js.map +1 -0
  103. package/lib/esm/events/EventEmitter.d.ts +15 -0
  104. package/lib/esm/events/EventEmitter.js +98 -0
  105. package/lib/esm/events/EventEmitter.js.map +1 -0
  106. package/lib/esm/index.d.ts +14 -0
  107. package/lib/esm/index.js +22 -0
  108. package/lib/esm/index.js.map +1 -0
  109. package/lib/esm/interfaces/IGraphObject.d.ts +29 -0
  110. package/lib/esm/interfaces/IGraphObject.js +2 -0
  111. package/lib/esm/interfaces/IGraphObject.js.map +1 -0
  112. package/lib/esm/interfaces/IGraphObjectSet.d.ts +24 -0
  113. package/lib/esm/interfaces/IGraphObjectSet.js +2 -0
  114. package/lib/esm/interfaces/IGraphObjectSet.js.map +1 -0
  115. package/lib/esm/interfaces/IShape.d.ts +22 -0
  116. package/lib/esm/interfaces/IShape.js +2 -0
  117. package/lib/esm/interfaces/IShape.js.map +1 -0
  118. package/lib/esm/interfaces/ISingleGraphObject.d.ts +3 -0
  119. package/lib/esm/interfaces/ISingleGraphObject.js +2 -0
  120. package/lib/esm/interfaces/ISingleGraphObject.js.map +1 -0
  121. package/lib/esm/models.d.ts +1167 -0
  122. package/lib/esm/models.js +2659 -0
  123. package/lib/esm/models.js.map +1 -0
  124. package/lib/esm/package.json +3 -0
  125. package/lib/esm/utils/Debug.d.ts +3 -0
  126. package/lib/esm/utils/Debug.js +42 -0
  127. package/lib/esm/utils/Debug.js.map +1 -0
  128. package/lib/esm/utils/LocalQueryResolver.d.ts +21 -0
  129. package/lib/esm/utils/LocalQueryResolver.js +1434 -0
  130. package/lib/esm/utils/LocalQueryResolver.js.map +1 -0
  131. package/lib/esm/utils/URI.d.ts +18 -0
  132. package/lib/esm/utils/URI.js +38 -0
  133. package/lib/esm/utils/URI.js.map +1 -0
  134. package/lib/esm/utils/toNamedNode.d.ts +8 -0
  135. package/lib/esm/utils/toNamedNode.js +12 -0
  136. package/lib/esm/utils/toNamedNode.js.map +1 -0
  137. package/package.json +57 -0
@@ -0,0 +1,240 @@
1
+ /*
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { CoreMap } from '@_linked/core/collections/CoreMap';
7
+ import { QuadSet } from './QuadSet.js';
8
+ import { QuadArray } from './QuadArray.js';
9
+ import { NodeSet } from './NodeSet.js';
10
+ export class NodeMap extends CoreMap {
11
+ constructor(iterable) {
12
+ super(iterable);
13
+ }
14
+ getQuads(property) {
15
+ var res = new QuadSet();
16
+ for (var [key, node] of this) {
17
+ for (var quad of node.getQuads(property)) {
18
+ res.add(quad);
19
+ }
20
+ }
21
+ return res;
22
+ }
23
+ getInverseQuads(property) {
24
+ var res = new QuadSet();
25
+ for (var [key, node] of this) {
26
+ for (var quad of node.getInverseQuads(property)) {
27
+ res.add(quad);
28
+ }
29
+ }
30
+ return res;
31
+ }
32
+ getAll(property) {
33
+ var res = new NodeSet();
34
+ for (var [key, node] of this) {
35
+ res = res.concat(node.getAll(property));
36
+ }
37
+ return res;
38
+ }
39
+ getAllInverse(property) {
40
+ var res = new NodeSet();
41
+ for (var [key, node] of this) {
42
+ res = res.concat(node.getAllInverse(property));
43
+ }
44
+ return res;
45
+ }
46
+ getMultipleInverse(properties) {
47
+ var res = new NodeSet();
48
+ for (var [key, node] of this) {
49
+ for (var property of properties) {
50
+ res = res.concat(node.getAllInverse(property));
51
+ }
52
+ }
53
+ return res;
54
+ }
55
+ getMultiple(properties) {
56
+ var res = new NodeSet();
57
+ for (var [key, node] of this) {
58
+ for (var property of properties) {
59
+ res = res.concat(node.getAll(property));
60
+ }
61
+ }
62
+ return res;
63
+ }
64
+ getDeep(property, maxDepth = Infinity) {
65
+ var result = new NodeSet();
66
+ var stack = new NodeSet(this.values());
67
+ while (stack.size > 0 && maxDepth > 0) {
68
+ var nextLevelStack = new NodeSet();
69
+ for (let node of stack) {
70
+ for (var value of node.getAll(property)) {
71
+ if (!result.has(value)) {
72
+ result.add(value);
73
+ nextLevelStack.add(value);
74
+ }
75
+ }
76
+ }
77
+ stack = nextLevelStack;
78
+ maxDepth--;
79
+ }
80
+ return result;
81
+ }
82
+ getOneFromPath(...properties) {
83
+ //NOTE: same implementation as in NamedNode
84
+ //we just need one, so we do a depth-first algorithm which will be more performant, so:
85
+ //take first property
86
+ var property = properties.shift();
87
+ //if more properties left
88
+ if (properties.length > 0) {
89
+ var res;
90
+ //check if any of the values of that property for this node
91
+ //has a path to the rest of the properties, and if so return the found value
92
+ for (var value of this.getAll(property)) {
93
+ if ((res = value.getOneFromPath(...properties))) {
94
+ return res;
95
+ }
96
+ }
97
+ }
98
+ else {
99
+ //return the first value possible
100
+ return this.getOne(property);
101
+ }
102
+ }
103
+ getAllFromPath(...properties) {
104
+ //we just need all paths, so we can do a breadth first implementation
105
+ //take first property
106
+ var property = properties.shift();
107
+ if (properties.length > 0) {
108
+ //and ask the whole set of values to return all values of the rest of the path
109
+ return this.getAll(property).getAllFromPath(...properties);
110
+ }
111
+ else {
112
+ return this.getAll(property);
113
+ }
114
+ }
115
+ getProperties(includeFromIncomingArcs = false) {
116
+ var res = new NodeSet();
117
+ for (var [key, node] of this) {
118
+ res = res.concat(node.getProperties(includeFromIncomingArcs));
119
+ }
120
+ return res;
121
+ }
122
+ getInverseProperties() {
123
+ var res = new NodeSet();
124
+ for (var [key, node] of this) {
125
+ res = res.concat(node.getInverseProperties());
126
+ }
127
+ return res;
128
+ }
129
+ getOne(property) {
130
+ for (var [key, node] of this) {
131
+ if (node.hasProperty(property)) {
132
+ return node.getOne(property);
133
+ }
134
+ }
135
+ }
136
+ getOneInverse(property) {
137
+ for (var [key, node] of this) {
138
+ if (node.hasInverseProperty(property)) {
139
+ return node.getOneInverse(property);
140
+ }
141
+ }
142
+ }
143
+ getAllQuads(includeAsObject = false, includeImplicit = false) {
144
+ var res = new QuadArray();
145
+ for (var [key, node] of this) {
146
+ for (var item of node.getAllQuads(includeAsObject, includeImplicit)) {
147
+ if (res.indexOf(item) === -1) {
148
+ res.push(item);
149
+ }
150
+ }
151
+ }
152
+ return res;
153
+ }
154
+ getAllInverseQuads(includeImplicit) {
155
+ var res = new QuadArray();
156
+ for (var [key, node] of this) {
157
+ for (var item of node.getAllInverseQuads(includeImplicit)) {
158
+ if (res.indexOf(item) === -1) {
159
+ res.push(item);
160
+ }
161
+ }
162
+ }
163
+ return res;
164
+ }
165
+ where(property, value) {
166
+ //TODO: test performance with
167
+ //return this.filter(r => r.has(property,value));
168
+ var res = this.createNew();
169
+ for (var [key, node] of this) {
170
+ if (node.has(property, value)) {
171
+ //as any apparently needed, strange that NamedNode is not seen as matching to R?
172
+ res.set(key, node);
173
+ }
174
+ }
175
+ return res;
176
+ }
177
+ getWhere(property, value) {
178
+ for (var [key, node] of this) {
179
+ if (node.has(property, value)) {
180
+ return node;
181
+ }
182
+ }
183
+ return undefined;
184
+ }
185
+ setEach(property, value) {
186
+ let res = false;
187
+ for (var [key, node] of this) {
188
+ res = node.set(property, value) && res;
189
+ }
190
+ return res;
191
+ }
192
+ msetEach(property, values) {
193
+ let res = false;
194
+ for (var [key, node] of this) {
195
+ res = node.mset(property, values) && res;
196
+ }
197
+ return res;
198
+ }
199
+ updateEach(property, value) {
200
+ let res = false;
201
+ for (var [key, node] of this) {
202
+ res = node.overwrite(property, value) && res;
203
+ }
204
+ return res;
205
+ }
206
+ mupdateEach(property, values) {
207
+ let res = false;
208
+ for (var [key, node] of this) {
209
+ res = node.moverwrite(property, values) && res;
210
+ }
211
+ return res;
212
+ }
213
+ unsetEach(property, value) {
214
+ let res = false;
215
+ for (var [key, node] of this) {
216
+ res = node.unset(property, value) && res;
217
+ }
218
+ return res;
219
+ }
220
+ unsetAllEach(property) {
221
+ let res = false;
222
+ for (var [key, node] of this) {
223
+ res = node.unsetAll(property) && res;
224
+ }
225
+ return res;
226
+ }
227
+ promiseLoaded(loadInverseProperties = false) {
228
+ return Promise.all([...this.values()].map((node) => node.promiseLoaded(loadInverseProperties)))
229
+ .then((res) => {
230
+ return res.every((result) => result === true);
231
+ })
232
+ .catch(() => {
233
+ return false;
234
+ });
235
+ }
236
+ isLoaded(includingInverseProperties = false) {
237
+ return [...this.values()].every((value) => value.isLoaded(includingInverseProperties));
238
+ }
239
+ }
240
+ //# sourceMappingURL=NodeMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeMap.js","sourceRoot":"","sources":["../../../src/collections/NodeMap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAG1D,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAGrC,MAAM,OAAO,OACX,SAAQ,OAAkB;IAG1B,YAAY,QAAgC;QAC1C,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,QAAmB;QAC1B,IAAI,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC7B,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,eAAe,CAAC,QAAmB;QACjC,IAAI,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC7B,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAChD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,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AAE,EAAE,CAC9B,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAC1C,CACF;aACE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,6BAAsC,KAAK;QAClD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACxC,KAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAC3C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,55 @@
1
+ import { CoreSet } from '@_linked/core/collections/CoreSet';
2
+ import { NamedNode, Node } from '../models.js';
3
+ import { IGraphObjectSet } from '../interfaces/IGraphObjectSet.js';
4
+ import { QuadSet } from './QuadSet.js';
5
+ import { QuadArray } from './QuadArray.js';
6
+ import { ICoreIterable } from '@_linked/core/interfaces/ICoreIterable';
7
+ export declare class NodeSet<R extends Node = Node> extends CoreSet<R> implements IGraphObjectSet<Node> {
8
+ constructor(iterable?: Iterable<R>);
9
+ static fromValues<T extends Node = Node>(strings: string[]): NodeSet<T>;
10
+ getProperties(includeFromIncomingArcs?: boolean): NodeSet<NamedNode>;
11
+ getInverseProperties(): NodeSet<NamedNode>;
12
+ getOne(property: NamedNode): Node | undefined;
13
+ /**
14
+ * Returns a NodeSet containing the merged results of node.get(property) for each node in this set
15
+ * @param property
16
+ * @returns {NodeSet}
17
+ */
18
+ getAll(property: NamedNode): NodeSet;
19
+ getValues(property: NamedNode): string[];
20
+ /**
21
+ * Returns an array of the URI's or literal values (for Literals) of the nodes in this set
22
+ */
23
+ getNodeValues(): string[];
24
+ getOneFromPath(...properties: NamedNode[]): Node | undefined;
25
+ getAllFromPath(...properties: NamedNode[]): NodeSet;
26
+ getOneInverse(property: NamedNode): NamedNode | undefined;
27
+ getAllInverse(property: NamedNode): NodeSet<NamedNode>;
28
+ getMultipleInverse(properties: ICoreIterable<NamedNode>): NodeSet;
29
+ getMultiple(properties: ICoreIterable<NamedNode>): NodeSet;
30
+ getDeep(property: NamedNode, maxDepth?: number): NodeSet;
31
+ getQuads(property: NamedNode): QuadSet;
32
+ getInverseQuads(property: NamedNode): QuadSet | any;
33
+ getAllQuads(includeAsObject?: boolean, includeImplicit?: boolean): QuadArray;
34
+ getAllInverseQuads(includeImplicit?: boolean): QuadArray;
35
+ where(property: NamedNode, value: Node): this;
36
+ getWhere(property: NamedNode, value: Node): Node | undefined;
37
+ setEach(property: NamedNode, value: Node): boolean;
38
+ msetEach(property: NamedNode, values: ICoreIterable<Node>): boolean;
39
+ updateEach(property: NamedNode, value: Node): boolean;
40
+ mupdateEach(property: NamedNode, values: ICoreIterable<Node>): boolean;
41
+ unsetEach(property: NamedNode, value: Node): boolean;
42
+ unsetAllEach(property: NamedNode): boolean;
43
+ /**
44
+ * @deprecated
45
+ * @param loadInverseProperties
46
+ */
47
+ promiseLoaded(loadInverseProperties?: boolean): Promise<boolean>;
48
+ /**
49
+ * @deprecated
50
+ * @param includingInverseProperties
51
+ */
52
+ isLoaded(includingInverseProperties?: boolean): boolean;
53
+ toString(): string;
54
+ print(includeIncomingProperties?: boolean): string;
55
+ }
@@ -0,0 +1,292 @@
1
+ /*
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+ import { CoreSet } from '@_linked/core/collections/CoreSet';
7
+ import { Literal, NamedNode } from '../models.js';
8
+ import { QuadSet } from './QuadSet.js';
9
+ import { QuadArray } from './QuadArray.js';
10
+ import { Debug } from '../utils/Debug.js';
11
+ import { URI } from '../utils/URI.js';
12
+ export class NodeSet extends CoreSet {
13
+ constructor(iterable) {
14
+ super(iterable);
15
+ }
16
+ static fromValues(strings) {
17
+ return new NodeSet(strings.map((s) => (URI.isURI(s)
18
+ ? NamedNode.getOrCreate(s)
19
+ : new Literal(s))));
20
+ }
21
+ //we cannot use NamedNodeSet here because of requirement loops
22
+ getProperties(includeFromIncomingArcs = false) {
23
+ var res = new NodeSet();
24
+ for (var node of this) {
25
+ res = res.concat(node.getProperties(includeFromIncomingArcs));
26
+ }
27
+ return res;
28
+ }
29
+ getInverseProperties() {
30
+ var res = new NodeSet();
31
+ for (var node of this) {
32
+ res = res.concat(node.getInverseProperties());
33
+ }
34
+ return res;
35
+ }
36
+ getOne(property) {
37
+ for (var node of this) {
38
+ if (node.hasProperty(property)) {
39
+ return node.getOne(property);
40
+ }
41
+ }
42
+ return undefined;
43
+ }
44
+ /**
45
+ * Returns a NodeSet containing the merged results of node.get(property) for each node in this set
46
+ * @param property
47
+ * @returns {NodeSet}
48
+ */
49
+ getAll(property) {
50
+ var res = new NodeSet();
51
+ for (var node of this) {
52
+ res = res.concat(node.getAll(property));
53
+ }
54
+ return res;
55
+ }
56
+ getValues(property) {
57
+ var res = [];
58
+ for (var node of this) {
59
+ res.push(node.getValue(property));
60
+ }
61
+ return res;
62
+ }
63
+ /**
64
+ * Returns an array of the URI's or literal values (for Literals) of the nodes in this set
65
+ */
66
+ getNodeValues() {
67
+ var res = [];
68
+ for (var node of this) {
69
+ res.push(node.value);
70
+ }
71
+ return res;
72
+ }
73
+ getOneFromPath(...properties) {
74
+ //NOTE: same implementation as in NamedNode
75
+ //we just need one, so we do a depth-first algorithm which will be more performant, so:
76
+ //take first property
77
+ var property = properties.shift();
78
+ //if more properties left
79
+ if (properties.length > 0) {
80
+ var res;
81
+ //check if any of the values of that property for this node
82
+ //has a path to the rest of the properties, and if so return the found value
83
+ for (var value of this.getAll(property)) {
84
+ if ((res = value.getOneFromPath(...properties))) {
85
+ return res;
86
+ }
87
+ }
88
+ }
89
+ else {
90
+ //return the first value possible
91
+ return this.getOne(property);
92
+ }
93
+ }
94
+ getAllFromPath(...properties) {
95
+ //we just need all paths, so we can do a breadth first implementation
96
+ //take first property
97
+ var property = properties.shift();
98
+ if (properties.length > 0) {
99
+ //and ask the whole set of values to return all values of the rest of the path
100
+ return this.getAll(property).getAllFromPath(...properties);
101
+ }
102
+ else {
103
+ return this.getAll(property);
104
+ }
105
+ }
106
+ getOneInverse(property) {
107
+ for (var node of this) {
108
+ if (node.hasInverseProperty(property)) {
109
+ return node.getOneInverse(property);
110
+ }
111
+ }
112
+ return undefined;
113
+ }
114
+ getAllInverse(property) {
115
+ var res = new NodeSet();
116
+ for (var node of this) {
117
+ res = res.concat(node.getAllInverse(property));
118
+ }
119
+ return res;
120
+ }
121
+ getMultipleInverse(properties) {
122
+ var res = new NodeSet();
123
+ for (var instance of this) {
124
+ for (var property of properties) {
125
+ res = res.concat(instance.getAllInverse(property));
126
+ }
127
+ }
128
+ return res;
129
+ }
130
+ getMultiple(properties) {
131
+ var res = new NodeSet();
132
+ for (var node of this) {
133
+ for (var property of properties) {
134
+ res = res.concat(node.getAll(property));
135
+ }
136
+ }
137
+ return res;
138
+ }
139
+ getDeep(property, maxDepth = Infinity) {
140
+ var result = new NodeSet();
141
+ var stack = this;
142
+ while (stack.size > 0 && maxDepth > 0) {
143
+ var nextLevelStack = new NodeSet();
144
+ for (let node of stack) {
145
+ for (var value of node.getAll(property)) {
146
+ if (!result.has(value)) {
147
+ result.add(value);
148
+ nextLevelStack.add(value);
149
+ }
150
+ }
151
+ }
152
+ stack = nextLevelStack;
153
+ maxDepth--;
154
+ }
155
+ return result;
156
+ }
157
+ getQuads(property) {
158
+ var res = new QuadSet();
159
+ for (var node of this) {
160
+ for (var quad of node.getQuads(property)) {
161
+ res.add(quad);
162
+ }
163
+ }
164
+ return res;
165
+ }
166
+ getInverseQuads(property) {
167
+ var res = new QuadSet();
168
+ for (var node of this) {
169
+ for (var quad of node.getInverseQuads(property)) {
170
+ res.add(quad);
171
+ }
172
+ }
173
+ return res;
174
+ }
175
+ getAllQuads(includeAsObject, includeImplicit = false) {
176
+ var res = new QuadArray();
177
+ for (var node of this) {
178
+ for (var item of node.getAllQuads(includeAsObject, includeImplicit)) {
179
+ if (res.indexOf(item) === -1) {
180
+ res.push(item);
181
+ }
182
+ }
183
+ //res = res.concat(node.getAllQuads(includeAsObject));
184
+ }
185
+ return res;
186
+ }
187
+ getAllInverseQuads(includeImplicit) {
188
+ var res = new QuadArray();
189
+ for (var node of this) {
190
+ for (var item of node.getAllInverseQuads(includeImplicit)) {
191
+ if (res.indexOf(item) === -1) {
192
+ res.push(item);
193
+ }
194
+ }
195
+ }
196
+ return res;
197
+ }
198
+ where(property, value) {
199
+ //TODO: test performance with
200
+ //return this.filter(r => r.has(property,value));
201
+ var res = this.createNew();
202
+ for (var node of this) {
203
+ if (node.has(property, value)) {
204
+ //as any apparently needed, strange that NamedNode is not seen as matching to R?
205
+ res.add(node);
206
+ }
207
+ }
208
+ return res;
209
+ }
210
+ getWhere(property, value) {
211
+ for (var node of this) {
212
+ if (node.has(property, value)) {
213
+ return node;
214
+ }
215
+ }
216
+ return undefined;
217
+ }
218
+ setEach(property, value) {
219
+ let res = false;
220
+ for (var node of this) {
221
+ res = node.set(property, value) && res;
222
+ }
223
+ return res;
224
+ }
225
+ msetEach(property, values) {
226
+ let res = false;
227
+ for (var node of this) {
228
+ res = node.mset(property, values) && res;
229
+ }
230
+ return res;
231
+ }
232
+ updateEach(property, value) {
233
+ let res = false;
234
+ for (var node of this) {
235
+ res = node.overwrite(property, value) && res;
236
+ }
237
+ return res;
238
+ }
239
+ mupdateEach(property, values) {
240
+ let res = false;
241
+ for (var node of this) {
242
+ res = node.moverwrite(property, values) && res;
243
+ }
244
+ return res;
245
+ }
246
+ unsetEach(property, value) {
247
+ let res = false;
248
+ for (var node of this) {
249
+ res = node.unset(property, value) && res;
250
+ }
251
+ return res;
252
+ }
253
+ unsetAllEach(property) {
254
+ let res = false;
255
+ for (var node of this) {
256
+ res = node.unsetAll(property) && res;
257
+ }
258
+ return res;
259
+ }
260
+ //@TODO: remove generic isLoaded now that we have Shape loading functionality?
261
+ //@TODO: remove promiseLoaded now that we have Shape loading functionality?
262
+ /**
263
+ * @deprecated
264
+ * @param loadInverseProperties
265
+ */
266
+ promiseLoaded(loadInverseProperties = false) {
267
+ return Promise.all(this.map((node) => node.promiseLoaded(loadInverseProperties)))
268
+ .then((res) => {
269
+ return res.every((result) => result === true);
270
+ })
271
+ .catch(() => {
272
+ return false;
273
+ });
274
+ }
275
+ // perhaps we need to add a new shapeIsLoaded() method?
276
+ /**
277
+ * @deprecated
278
+ * @param includingInverseProperties
279
+ */
280
+ isLoaded(includingInverseProperties = false) {
281
+ return this.every((node) => node.isLoaded(includingInverseProperties));
282
+ }
283
+ toString() {
284
+ return ('NodeSet {\n' +
285
+ [...this].map((node) => '\t' + node.toString()).join(',\n') +
286
+ '\n}');
287
+ }
288
+ print(includeIncomingProperties = true) {
289
+ return Debug.print(this, includeIncomingProperties);
290
+ }
291
+ }
292
+ //# sourceMappingURL=NodeSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeSet.js","sourceRoot":"","sources":["../../../src/collections/NodeSet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAC,SAAS,EAAM,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEpC,MAAM,OAAO,OACX,SAAQ,OAAU;IAGlB,YAAY,QAAsB;QAChC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,CAA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D;IACvD;;;OAGG;IACH,QAAQ,CAAC,6BAAsC,KAAK;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,QAAQ;QACN,OAAO,CACL,aAAa;YACb,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAC3D,KAAK,CACN,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,4BAAqC,IAAI;QAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import { BlankNode, NamedNode } from '../models.js';
2
+ import { NodeMap } from './NodeMap.js';
3
+ import { NodeSet } from './NodeSet.js';
4
+ export declare class NodeURIMappings extends NodeMap<NamedNode> {
5
+ originalUris: Map<string, string>;
6
+ /**
7
+ * Will create a blanknode the first time you give a certain URI
8
+ * and return the same blanknode when you request it again.
9
+ * Note that the blanknode itself will have its own local URI regardless of the give URI
10
+ * this method allows you to parse a set of data that
11
+ * uses a certain identifier for a certain blanknode across several places
12
+ * and convert it to a local blanknode
13
+ * @param {string} givenUri
14
+ * @returns {BlankNode}
15
+ */
16
+ getOrCreateBlankNode(givenUri: string): BlankNode;
17
+ getBlankNodes(): NodeSet<BlankNode>;
18
+ getOrCreateNamedNode(uri: string): NamedNode;
19
+ getOriginalUri(localUri: string): string;
20
+ }