@_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.
- package/CHANGELOG.md +7 -0
- package/README.md +285 -0
- package/lib/cjs/Datafactory.d.ts +29 -0
- package/lib/cjs/Datafactory.js +101 -0
- package/lib/cjs/Datafactory.js.map +1 -0
- package/lib/cjs/InMemoryStore.d.ts +35 -0
- package/lib/cjs/InMemoryStore.js +98 -0
- package/lib/cjs/InMemoryStore.js.map +1 -0
- package/lib/cjs/collections/NodeMap.d.ts +35 -0
- package/lib/cjs/collections/NodeMap.js +244 -0
- package/lib/cjs/collections/NodeMap.js.map +1 -0
- package/lib/cjs/collections/NodeSet.d.ts +55 -0
- package/lib/cjs/collections/NodeSet.js +296 -0
- package/lib/cjs/collections/NodeSet.js.map +1 -0
- package/lib/cjs/collections/NodeURIMappings.d.ts +20 -0
- package/lib/cjs/collections/NodeURIMappings.js +65 -0
- package/lib/cjs/collections/NodeURIMappings.js.map +1 -0
- package/lib/cjs/collections/NodeValuesSet.d.ts +63 -0
- package/lib/cjs/collections/NodeValuesSet.js +100 -0
- package/lib/cjs/collections/NodeValuesSet.js.map +1 -0
- package/lib/cjs/collections/QuadArray.d.ts +17 -0
- package/lib/cjs/collections/QuadArray.js +67 -0
- package/lib/cjs/collections/QuadArray.js.map +1 -0
- package/lib/cjs/collections/QuadMap.d.ts +64 -0
- package/lib/cjs/collections/QuadMap.js +155 -0
- package/lib/cjs/collections/QuadMap.js.map +1 -0
- package/lib/cjs/collections/QuadSet.d.ts +22 -0
- package/lib/cjs/collections/QuadSet.js +106 -0
- package/lib/cjs/collections/QuadSet.js.map +1 -0
- package/lib/cjs/collections/SearchMap.d.ts +5 -0
- package/lib/cjs/collections/SearchMap.js +13 -0
- package/lib/cjs/collections/SearchMap.js.map +1 -0
- package/lib/cjs/events/EventBatcher.d.ts +20 -0
- package/lib/cjs/events/EventBatcher.js +97 -0
- package/lib/cjs/events/EventBatcher.js.map +1 -0
- package/lib/cjs/events/EventEmitter.d.ts +15 -0
- package/lib/cjs/events/EventEmitter.js +102 -0
- package/lib/cjs/events/EventEmitter.js.map +1 -0
- package/lib/cjs/index.d.ts +14 -0
- package/lib/cjs/index.js +48 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/IGraphObject.d.ts +29 -0
- package/lib/cjs/interfaces/IGraphObject.js +3 -0
- package/lib/cjs/interfaces/IGraphObject.js.map +1 -0
- package/lib/cjs/interfaces/IGraphObjectSet.d.ts +24 -0
- package/lib/cjs/interfaces/IGraphObjectSet.js +3 -0
- package/lib/cjs/interfaces/IGraphObjectSet.js.map +1 -0
- package/lib/cjs/interfaces/IShape.d.ts +22 -0
- package/lib/cjs/interfaces/IShape.js +3 -0
- package/lib/cjs/interfaces/IShape.js.map +1 -0
- package/lib/cjs/interfaces/ISingleGraphObject.d.ts +3 -0
- package/lib/cjs/interfaces/ISingleGraphObject.js +3 -0
- package/lib/cjs/interfaces/ISingleGraphObject.js.map +1 -0
- package/lib/cjs/models.d.ts +1167 -0
- package/lib/cjs/models.js +2668 -0
- package/lib/cjs/models.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/Debug.d.ts +3 -0
- package/lib/cjs/utils/Debug.js +46 -0
- package/lib/cjs/utils/Debug.js.map +1 -0
- package/lib/cjs/utils/LocalQueryResolver.d.ts +21 -0
- package/lib/cjs/utils/LocalQueryResolver.js +1442 -0
- package/lib/cjs/utils/LocalQueryResolver.js.map +1 -0
- package/lib/cjs/utils/URI.d.ts +18 -0
- package/lib/cjs/utils/URI.js +42 -0
- package/lib/cjs/utils/URI.js.map +1 -0
- package/lib/cjs/utils/toNamedNode.d.ts +8 -0
- package/lib/cjs/utils/toNamedNode.js +15 -0
- package/lib/cjs/utils/toNamedNode.js.map +1 -0
- package/lib/esm/Datafactory.d.ts +29 -0
- package/lib/esm/Datafactory.js +97 -0
- package/lib/esm/Datafactory.js.map +1 -0
- package/lib/esm/InMemoryStore.d.ts +35 -0
- package/lib/esm/InMemoryStore.js +94 -0
- package/lib/esm/InMemoryStore.js.map +1 -0
- package/lib/esm/collections/NodeMap.d.ts +35 -0
- package/lib/esm/collections/NodeMap.js +240 -0
- package/lib/esm/collections/NodeMap.js.map +1 -0
- package/lib/esm/collections/NodeSet.d.ts +55 -0
- package/lib/esm/collections/NodeSet.js +292 -0
- package/lib/esm/collections/NodeSet.js.map +1 -0
- package/lib/esm/collections/NodeURIMappings.d.ts +20 -0
- package/lib/esm/collections/NodeURIMappings.js +61 -0
- package/lib/esm/collections/NodeURIMappings.js.map +1 -0
- package/lib/esm/collections/NodeValuesSet.d.ts +63 -0
- package/lib/esm/collections/NodeValuesSet.js +96 -0
- package/lib/esm/collections/NodeValuesSet.js.map +1 -0
- package/lib/esm/collections/QuadArray.d.ts +17 -0
- package/lib/esm/collections/QuadArray.js +63 -0
- package/lib/esm/collections/QuadArray.js.map +1 -0
- package/lib/esm/collections/QuadMap.d.ts +64 -0
- package/lib/esm/collections/QuadMap.js +151 -0
- package/lib/esm/collections/QuadMap.js.map +1 -0
- package/lib/esm/collections/QuadSet.d.ts +22 -0
- package/lib/esm/collections/QuadSet.js +102 -0
- package/lib/esm/collections/QuadSet.js.map +1 -0
- package/lib/esm/collections/SearchMap.d.ts +5 -0
- package/lib/esm/collections/SearchMap.js +9 -0
- package/lib/esm/collections/SearchMap.js.map +1 -0
- package/lib/esm/events/EventBatcher.d.ts +20 -0
- package/lib/esm/events/EventBatcher.js +90 -0
- package/lib/esm/events/EventBatcher.js.map +1 -0
- package/lib/esm/events/EventEmitter.d.ts +15 -0
- package/lib/esm/events/EventEmitter.js +98 -0
- package/lib/esm/events/EventEmitter.js.map +1 -0
- package/lib/esm/index.d.ts +14 -0
- package/lib/esm/index.js +22 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/IGraphObject.d.ts +29 -0
- package/lib/esm/interfaces/IGraphObject.js +2 -0
- package/lib/esm/interfaces/IGraphObject.js.map +1 -0
- package/lib/esm/interfaces/IGraphObjectSet.d.ts +24 -0
- package/lib/esm/interfaces/IGraphObjectSet.js +2 -0
- package/lib/esm/interfaces/IGraphObjectSet.js.map +1 -0
- package/lib/esm/interfaces/IShape.d.ts +22 -0
- package/lib/esm/interfaces/IShape.js +2 -0
- package/lib/esm/interfaces/IShape.js.map +1 -0
- package/lib/esm/interfaces/ISingleGraphObject.d.ts +3 -0
- package/lib/esm/interfaces/ISingleGraphObject.js +2 -0
- package/lib/esm/interfaces/ISingleGraphObject.js.map +1 -0
- package/lib/esm/models.d.ts +1167 -0
- package/lib/esm/models.js +2659 -0
- package/lib/esm/models.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/Debug.d.ts +3 -0
- package/lib/esm/utils/Debug.js +42 -0
- package/lib/esm/utils/Debug.js.map +1 -0
- package/lib/esm/utils/LocalQueryResolver.d.ts +21 -0
- package/lib/esm/utils/LocalQueryResolver.js +1434 -0
- package/lib/esm/utils/LocalQueryResolver.js.map +1 -0
- package/lib/esm/utils/URI.d.ts +18 -0
- package/lib/esm/utils/URI.js +38 -0
- package/lib/esm/utils/URI.js.map +1 -0
- package/lib/esm/utils/toNamedNode.d.ts +8 -0
- package/lib/esm/utils/toNamedNode.js +12 -0
- package/lib/esm/utils/toNamedNode.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,1167 @@
|
|
|
1
|
+
import { DefaultGraph as TFDefaultGraph, Literal as ILiteral, NamedNode as INamedNode, Term } from 'rdflib/lib/tf-types.js';
|
|
2
|
+
import { DefaultGraphTermType, TermType } from 'rdflib/lib/types.js';
|
|
3
|
+
import { QuadSet } from './collections/QuadSet.js';
|
|
4
|
+
import { CoreMap } from '@_linked/core/collections/CoreMap';
|
|
5
|
+
import { QuadMap } from './collections/QuadMap.js';
|
|
6
|
+
import { QuadArray } from './collections/QuadArray.js';
|
|
7
|
+
import { NodeSet } from './collections/NodeSet.js';
|
|
8
|
+
import { ICoreIterable } from '@_linked/core/interfaces/ICoreIterable';
|
|
9
|
+
import { IShape } from './interfaces/IShape.js';
|
|
10
|
+
import { IGraphObject } from './interfaces/IGraphObject.js';
|
|
11
|
+
import { NodeValuesSet } from './collections/NodeValuesSet.js';
|
|
12
|
+
import { BatchedEventEmitter } from './events/EventBatcher.js';
|
|
13
|
+
import { EventEmitter } from './events/EventEmitter.js';
|
|
14
|
+
import { NodeMap } from './collections/NodeMap.js';
|
|
15
|
+
import { NodeURIMappings } from './collections/NodeURIMappings.js';
|
|
16
|
+
export declare abstract class Node extends EventEmitter {
|
|
17
|
+
protected _value: string;
|
|
18
|
+
/** The type of node */
|
|
19
|
+
termType: TermType;
|
|
20
|
+
constructor(_value: string);
|
|
21
|
+
get value(): string;
|
|
22
|
+
set value(val: string);
|
|
23
|
+
/**
|
|
24
|
+
* Create an instance of the given class (or one of its subclasses) as a presentation of this node.
|
|
25
|
+
* NOTE: this node MUST have the static.type of the given class as its rdf:type property
|
|
26
|
+
* @param type - a class that extends Shape and thus who's instances represent a node as an instance of one specific type.
|
|
27
|
+
*/
|
|
28
|
+
getAs<T extends IShape>(type: {
|
|
29
|
+
new (): T;
|
|
30
|
+
getOf(node: Node): T;
|
|
31
|
+
}): T;
|
|
32
|
+
/**
|
|
33
|
+
* Create an instance of the given class as a presentation of this node.
|
|
34
|
+
* Other than getAs this 'strict' message will ONLY return an exact instance of the given class, not one of its subclasses
|
|
35
|
+
* rdf.type properties of the node are IGNORED. This method can therefore also come in handy in circumstances when you don't have the node it's rdf.type properties at hand.
|
|
36
|
+
* Do not misuse this method though, the main use case is if you don't want to allow any subclass instances. If that's not neccecarily the case and it would make also sense to have the properties loaded, make sure to load them and use getAs.
|
|
37
|
+
* OR use getAsAsync automatically ensures the data of the node is fully loaded before creating an instance.
|
|
38
|
+
* @param type - a class that extends Shape and thus who's instances represent a node as an instance of one specific type.
|
|
39
|
+
*/
|
|
40
|
+
getStrictlyAs<T extends IShape>(type: {
|
|
41
|
+
new (): T;
|
|
42
|
+
getStrictlyOf(node: Node): T;
|
|
43
|
+
}): T;
|
|
44
|
+
/**
|
|
45
|
+
* Compares whether the two nodes are equal
|
|
46
|
+
* @param other The other node
|
|
47
|
+
*/
|
|
48
|
+
equals(other: Term): boolean;
|
|
49
|
+
set(property: NamedNode, value: Node): boolean;
|
|
50
|
+
setValue(property: NamedNode, value: string): boolean;
|
|
51
|
+
has(property: NamedNode, value: Node): boolean;
|
|
52
|
+
hasValue(property: NamedNode, value: string): boolean;
|
|
53
|
+
hasExplicit(property: NamedNode, value: Node): boolean;
|
|
54
|
+
hasExact(property: NamedNode, value: Node): boolean;
|
|
55
|
+
hasProperty(property: NamedNode): boolean;
|
|
56
|
+
hasInverseProperty(property: NamedNode): boolean;
|
|
57
|
+
hasInverse(property: NamedNode, value: Node): boolean;
|
|
58
|
+
mset(property: NamedNode, values: Iterable<Node>): boolean;
|
|
59
|
+
getProperties(includeFromIncomingArcs?: boolean): NodeSet<NamedNode>;
|
|
60
|
+
getInverseProperties(): any;
|
|
61
|
+
getOne(property: NamedNode): Node | undefined;
|
|
62
|
+
getAll(property: NamedNode): NodeValuesSet;
|
|
63
|
+
getValue(property?: NamedNode): string;
|
|
64
|
+
getDeep(property: NamedNode, maxDepth?: number, partialResult?: NodeSet): NodeSet;
|
|
65
|
+
getOneInverse(property: NamedNode): NamedNode | undefined;
|
|
66
|
+
getOneWhere(property: NamedNode, filterProperty: NamedNode, filterValue: Node): undefined;
|
|
67
|
+
getOneWhereEquivalent(property: NamedNode, filterProperty: NamedNode, filterValue: Node, caseSensitive?: boolean): undefined;
|
|
68
|
+
getAllExplicit(property: NamedNode): NodeSet;
|
|
69
|
+
getAllInverse(property: NamedNode): NodeSet<NamedNode> | undefined;
|
|
70
|
+
getMultiple(properties: ICoreIterable<NamedNode>): NodeSet;
|
|
71
|
+
hasPath(properties: NamedNode[]): boolean;
|
|
72
|
+
hasPathTo(properties: NamedNode[], value?: Node): boolean;
|
|
73
|
+
hasPathToSomeInSet(properties: NamedNode[], endPoints?: ICoreIterable<Node>): boolean;
|
|
74
|
+
getOneFromPath(...properties: NamedNode[]): Node | undefined;
|
|
75
|
+
getAllFromPath(...properties: NamedNode[]): NodeSet;
|
|
76
|
+
getQuads(property: NamedNode, value?: Node): QuadSet;
|
|
77
|
+
getInverseQuad(property: NamedNode, subject: NamedNode): Quad | undefined;
|
|
78
|
+
getInverseQuads(property: NamedNode): QuadSet;
|
|
79
|
+
getAllInverseQuads(includeImplicit?: boolean): QuadArray;
|
|
80
|
+
getAllQuads(includeAsObject?: boolean, includeImplicit?: boolean): QuadArray;
|
|
81
|
+
overwrite(property: NamedNode, value: any): boolean;
|
|
82
|
+
moverwrite(property: NamedNode, value: any): boolean;
|
|
83
|
+
unset(property: NamedNode, value: Node): boolean;
|
|
84
|
+
unsetAll(property: NamedNode): boolean;
|
|
85
|
+
isLoaded(includingIncomingProperties?: boolean): boolean;
|
|
86
|
+
promiseLoaded(loadInverseProperties?: boolean): Promise<boolean>;
|
|
87
|
+
getMultipleInverse(properties: ICoreIterable<NamedNode>): NodeSet;
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
* @param quad
|
|
91
|
+
*/
|
|
92
|
+
unregisterInverseProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
93
|
+
/**
|
|
94
|
+
* registers the use of a quad. Since a quad can only be used in 1 quad
|
|
95
|
+
* this method makes a clone of the Literal if it's used a second time,
|
|
96
|
+
* and returns that new Literal so it will be used by the quad
|
|
97
|
+
* @internal
|
|
98
|
+
* @param quad
|
|
99
|
+
*/
|
|
100
|
+
registerInverseProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): Node;
|
|
101
|
+
clone(): Node;
|
|
102
|
+
print(): string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A Named Node in the graph is a node that has outgoing edges to other nodes.
|
|
106
|
+
*
|
|
107
|
+
* In RDF specifications, a Named Node is a URI Node.
|
|
108
|
+
* You can manage this by setting and getting 'properties' of this node, which will reflect in which nodes this node is connected with.
|
|
109
|
+
* A Named Node is one of the two types of nodes in a graph in the semantic web / RDF.
|
|
110
|
+
* The other one being Literal
|
|
111
|
+
* @see https://www.w3.org/TR/rdf-concepts/#section-Graph-URIref
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
*
|
|
115
|
+
* Use NamedNode.getOrCreate() if you have a URI
|
|
116
|
+
* Use NamedNode.create() to create a new NamedNode without specifying a URI
|
|
117
|
+
* Do NOT use the constructor
|
|
118
|
+
*
|
|
119
|
+
* ```
|
|
120
|
+
* let node = NamedNode.create();
|
|
121
|
+
* let node = NamedNode.getOrCreate("http://url.of.some/node")
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export declare class NamedNode extends Node implements IGraphObject, BatchedEventEmitter, INamedNode {
|
|
125
|
+
private _isTemporaryNode;
|
|
126
|
+
/**
|
|
127
|
+
* The base of temporary URI's
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
static TEMP_URI_BASE: string;
|
|
131
|
+
/**
|
|
132
|
+
* Emitter used by the class itself by static methods emitting events.
|
|
133
|
+
* Anyone wanting to listen to that should therefore add a listener with NamedNode.emitter.on(...)
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
static emitter: EventEmitter;
|
|
137
|
+
/**
|
|
138
|
+
* event emitted when nodes need to be stored
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
static STORE_NODES: string;
|
|
142
|
+
/**
|
|
143
|
+
* Event emitted when previous values have been overwritten (for example with update or moverwrite)
|
|
144
|
+
* NOTE: Locally we may not know all the properties, but the intend of update / moverwrite is to overwrite ANY existing properties. So event handlers listening to this event should clear any previous property values they can find.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
static CLEARED_PROPERTIES: string;
|
|
148
|
+
/**
|
|
149
|
+
* event emitted when nodes need to be removed
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
static REMOVE_NODES: string;
|
|
153
|
+
/**
|
|
154
|
+
* event emitted when the URI of a node has been updated
|
|
155
|
+
*/
|
|
156
|
+
static URI_UPDATED: string;
|
|
157
|
+
/**
|
|
158
|
+
* event emitted when nodes need to be loaded
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
static LOAD_NODES: string;
|
|
162
|
+
/**
|
|
163
|
+
* event emitted by a single node when its properties have changed
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
static PROPERTY_CHANGED: string;
|
|
167
|
+
/**
|
|
168
|
+
* event emitted by a single node when its properties have been altered
|
|
169
|
+
* NOTE: we use 'altered' for changes made by user interaction vs 'changed' for changes that
|
|
170
|
+
* could for example be due to new data being loaded
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
static PROPERTY_ALTERED: string;
|
|
174
|
+
/**
|
|
175
|
+
* event emitted by a single node when its inverse properties have been changed
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
static INVERSE_PROPERTY_CHANGED: string;
|
|
179
|
+
/**
|
|
180
|
+
* event emitted by a single node when its inverse properties have been altered
|
|
181
|
+
* NOTE: we use 'altered' for changes made by user interaction vs 'changed' for changes that
|
|
182
|
+
* could for example be due to new data being loaded
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
static INVERSE_PROPERTY_ALTERED: string;
|
|
186
|
+
/**
|
|
187
|
+
* event emitted by a single node when its used or not used anymore as a predicate
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
static AS_PREDICATE_CHANGED: string;
|
|
191
|
+
/**
|
|
192
|
+
* event emitted by a single node when its used or not used anymore as a predicate due to user requested alterations
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
static AS_PREDICATE_ALTERED: string;
|
|
196
|
+
/**
|
|
197
|
+
* event emitted by a single node when it's been removed
|
|
198
|
+
*/
|
|
199
|
+
static NODE_REMOVED: string;
|
|
200
|
+
private static namedNodes;
|
|
201
|
+
private static tempCounter;
|
|
202
|
+
private static nodesToSave;
|
|
203
|
+
private static nodesToLoad;
|
|
204
|
+
private static nodesToLoadFully;
|
|
205
|
+
private static nodesToRemove;
|
|
206
|
+
private static nodesURIUpdated;
|
|
207
|
+
private static clearedProperties;
|
|
208
|
+
/**
|
|
209
|
+
* map of QuadMaps indexed by property (where this node occurs as subject)
|
|
210
|
+
* NOTE: 'properties' serves only to increase lookup speed but also costs memory
|
|
211
|
+
* since reverse lookup (where this node occurs as object) will be much less frequent
|
|
212
|
+
* the inverse of 'properties' is not kept, so all results for reverse lookup will be created from 'asObject'
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
215
|
+
properties: CoreMap<NamedNode, NodeValuesSet>;
|
|
216
|
+
termType: any;
|
|
217
|
+
/**
|
|
218
|
+
* map of QuadMaps indexed by property where this node occurs as subject
|
|
219
|
+
* NOTE: we use QuadMap here because in ES5 a quadMap is much faster than a quadSet, because we can check by key with uri directly if the quad exists instead of having to look in an array with indexOf (ES5 does not support objects as keys)
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
private asSubject;
|
|
223
|
+
/**
|
|
224
|
+
* map of QuadMaps indexed by property where this node occurs as object
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
private asObject;
|
|
228
|
+
/**
|
|
229
|
+
* array of Quads in which this node occurs as predicate
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
private changedProperties;
|
|
233
|
+
private alteredProperties;
|
|
234
|
+
private changedInverseProperties;
|
|
235
|
+
private alteredInverseProperties;
|
|
236
|
+
private savePromise;
|
|
237
|
+
private removePromise;
|
|
238
|
+
/**
|
|
239
|
+
* WARNING: Do not directly create a Node, instead use NamedNode.getOrCreate(uri)
|
|
240
|
+
* This ensures the same node is used for the same uri system wide
|
|
241
|
+
* @param uri - the URI (more generic form of a URL) of the NamedNode
|
|
242
|
+
* @param _isTemporaryNode - set to true if this node is only temporarily available in the local environment
|
|
243
|
+
*/
|
|
244
|
+
constructor(uri?: string, _isTemporaryNode?: boolean);
|
|
245
|
+
private _isStoring;
|
|
246
|
+
get isStoring(): boolean;
|
|
247
|
+
set isStoring(storing: boolean);
|
|
248
|
+
/**
|
|
249
|
+
* JSLib.js documentation states: "Alias for value, favored by Tim" ... LINCD author René agrees with Tim
|
|
250
|
+
* @see https://github.com/linkeddata/rdflib.js/blob/bbf456390afe7743020e0c8c4db20b10cfb808c7/src/named-node.ts#L88
|
|
251
|
+
*/
|
|
252
|
+
get uri(): string;
|
|
253
|
+
set uri(uri: string);
|
|
254
|
+
/**
|
|
255
|
+
* Alias for uri, so NamedNode satisfies NodeReferenceValue ({id: string}) from core.
|
|
256
|
+
*/
|
|
257
|
+
get id(): string;
|
|
258
|
+
/**
|
|
259
|
+
* Returns true if this node has a temporary URI and only exists in the local environment.
|
|
260
|
+
* e.g. this is usually true if you create a new NamedNode without having specified a URI yet
|
|
261
|
+
*/
|
|
262
|
+
get isTemporaryNode(): boolean;
|
|
263
|
+
set isTemporaryNode(val: boolean);
|
|
264
|
+
get value(): string;
|
|
265
|
+
set value(newUri: string);
|
|
266
|
+
/**
|
|
267
|
+
* Emits the batched (property) events of the NamedNode CLASS (meaning events that relate to all nodes)
|
|
268
|
+
* Used internally by the framework to batch and emit change events
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
static emitBatchedEvents(resolve: any, reject: any): void;
|
|
272
|
+
/**
|
|
273
|
+
* Returns true if this node has any batched events waiting to be emitted
|
|
274
|
+
* Used internally by the framework to batch and emit change events
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
static hasBatchedEvents(): number | boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Converts the string '<http://some.uri>' into a NamedNode
|
|
280
|
+
* @param uriString the string representation of a NamedNode, consisting of its URI surrounded by brackets: '<' URI '>'
|
|
281
|
+
*/
|
|
282
|
+
static fromString(uriString: string): NamedNode;
|
|
283
|
+
/**
|
|
284
|
+
* Resets the map of nodes that is known in this local environment
|
|
285
|
+
* Mostly used for test functionality
|
|
286
|
+
*/
|
|
287
|
+
static reset(): void;
|
|
288
|
+
/**
|
|
289
|
+
* Create a new local NamedNode. A temporary URI will be generated for its URI.
|
|
290
|
+
* This node will not exist in the graph database (persistent storage) until you call `node.save()`
|
|
291
|
+
* Until saved, `node.isTemporaryNode()` will return true.
|
|
292
|
+
*/
|
|
293
|
+
static create(): NamedNode;
|
|
294
|
+
/**
|
|
295
|
+
* Registers a NamedNode to the locally known list of nodes
|
|
296
|
+
* @internal
|
|
297
|
+
* @param node
|
|
298
|
+
*/
|
|
299
|
+
static register(node: NamedNode): void;
|
|
300
|
+
/**
|
|
301
|
+
* Unregisters a NamedNode from the locally known list of nodes
|
|
302
|
+
* @internal
|
|
303
|
+
* @param node
|
|
304
|
+
*/
|
|
305
|
+
static unregister(node: NamedNode): void;
|
|
306
|
+
/**
|
|
307
|
+
* Returns a map of all locally known nodes.
|
|
308
|
+
* The map will have URI's as keys and NamedNodes as values
|
|
309
|
+
* @param node
|
|
310
|
+
*/
|
|
311
|
+
static getAllNamedNodes(): NodeMap<NamedNode>;
|
|
312
|
+
/**
|
|
313
|
+
* Returns a map of all locally known nodes.
|
|
314
|
+
* The map will have URI's as keys and NamedNodes as values
|
|
315
|
+
* @param node
|
|
316
|
+
*/
|
|
317
|
+
static createNewTempUri(): string;
|
|
318
|
+
static getCounter(): number;
|
|
319
|
+
/**
|
|
320
|
+
* ##########################################################################
|
|
321
|
+
* ############# PUBLIC METHODS FOR REGULAR USE #############
|
|
322
|
+
* ##########################################################################
|
|
323
|
+
*/
|
|
324
|
+
/**
|
|
325
|
+
* The proper way to obtain a node from a URI.
|
|
326
|
+
* If requested before, this returns the existing NamedNode for the given URI.
|
|
327
|
+
* Or, if this is the first request for this URI, it creates a new NamedNode first, and returns that
|
|
328
|
+
* Using this method over `new NamedNode()` makes sure all nodes are registered, and no duplicates will exist.
|
|
329
|
+
* `new NamedNode()` should therefore never be used.
|
|
330
|
+
* @param uri
|
|
331
|
+
*/
|
|
332
|
+
static getOrCreate(uri: string, isTemporaryNode?: boolean): NamedNode;
|
|
333
|
+
/**
|
|
334
|
+
* Returns the NamedNode with the given URI, IF it exists.
|
|
335
|
+
* DOES NOT create a new NamedNode if it didn't exist yet, instead it returns undefined.
|
|
336
|
+
* You can therefore use this method to see if a NamedNode already exists locally.
|
|
337
|
+
* Use `getOrCreate()` if you want to simply get a NamedNode for a certain URI
|
|
338
|
+
* @param uri
|
|
339
|
+
*/
|
|
340
|
+
static getNamedNode(uri: string): NamedNode | undefined;
|
|
341
|
+
static emitClearedProperty(node: NamedNode, property: NamedNode): void;
|
|
342
|
+
private static _create;
|
|
343
|
+
/**
|
|
344
|
+
* Used by Quads to signal their subject about a new property
|
|
345
|
+
* @internal
|
|
346
|
+
* @param quad
|
|
347
|
+
* @param alteration
|
|
348
|
+
* @param emitEvents
|
|
349
|
+
*/
|
|
350
|
+
registerProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
351
|
+
/**
|
|
352
|
+
* Inverse property can be thought of as "this node is the value (object) of another nodes' property"
|
|
353
|
+
* This method is used by the class Quad to communicate its existence to the quads object
|
|
354
|
+
* @internal
|
|
355
|
+
* @param quad
|
|
356
|
+
* @param alteration
|
|
357
|
+
* @param emitEvents
|
|
358
|
+
*/
|
|
359
|
+
registerInverseProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): Node;
|
|
360
|
+
/**
|
|
361
|
+
* Called when this node occurs as predicate in a quad
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
/**
|
|
365
|
+
* This method is used by the class Quad to communicate with its nodes
|
|
366
|
+
* @internal
|
|
367
|
+
* @param quad
|
|
368
|
+
* @param alteration
|
|
369
|
+
*/
|
|
370
|
+
registerValueChange(quad: Quad, alteration?: boolean): void;
|
|
371
|
+
/**
|
|
372
|
+
* This method is used by the class Quad to communicate with its nodes
|
|
373
|
+
* @internal
|
|
374
|
+
*/
|
|
375
|
+
unregisterProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
376
|
+
/**
|
|
377
|
+
* This method is used by the class Quad to communicate with its nodes
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
/**
|
|
381
|
+
* This method is used by the class Quad to communicate with its nodes
|
|
382
|
+
* @internal
|
|
383
|
+
*/
|
|
384
|
+
unregisterInverseProperty(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
385
|
+
/**
|
|
386
|
+
* Returns a list of quads in which this node is now used as object
|
|
387
|
+
* BEFORE these changes are sent as events in the normal event flow
|
|
388
|
+
* Currently used by Reasoner to allow for immediate application of reasoning
|
|
389
|
+
*/
|
|
390
|
+
getPendingInverseChanges(property: NamedNode): QuadSet;
|
|
391
|
+
/**
|
|
392
|
+
* Returns a list of quads in which this node is now used as subject
|
|
393
|
+
* BEFORE these changes are sent as events in the normal event flow
|
|
394
|
+
* Currently used by Reasoner to allow for immediate application of reasoning
|
|
395
|
+
*/
|
|
396
|
+
getPendingChanges(property: NamedNode): QuadSet;
|
|
397
|
+
/**
|
|
398
|
+
* Set the a single property value
|
|
399
|
+
* Creates a single connection between two nodes in the graph: from this node, to the node given as value, with the property as the connecting 'edge' between them
|
|
400
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
401
|
+
* @param value - the node that this new graph-edge points to. The object of the quad to be created.
|
|
402
|
+
*/
|
|
403
|
+
set(property: NamedNode, value: Node): boolean;
|
|
404
|
+
/**
|
|
405
|
+
* Same as set() except this method allows you to pass a string as value and converts it to a Literal for you
|
|
406
|
+
* @param property
|
|
407
|
+
* @param value
|
|
408
|
+
*/
|
|
409
|
+
setValue(property: NamedNode, value: string): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Set multiple values at once for a single property.
|
|
412
|
+
* You can use this for example to state that this node (a person) has a 'hasFriend' connection to multiple people (friends) in 1 statement
|
|
413
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
414
|
+
* @param values - an array or set of nodes. Can be NamedNodes or Literals
|
|
415
|
+
*/
|
|
416
|
+
mset(property: NamedNode, values: ICoreIterable<Node>): boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Returns true if this node has the given value as the value of the given property
|
|
419
|
+
* NOTE: returns true when a literal node is provided that is EQUIVALENT to any of the values that this node has for this property (whilst not neccecarilly being the exact same object in memory)
|
|
420
|
+
* See also: Literal.equals
|
|
421
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
422
|
+
* @param value - a single node. Can be a NamedNode or Literal
|
|
423
|
+
*/
|
|
424
|
+
has(property: NamedNode, value: Node): boolean;
|
|
425
|
+
/**
|
|
426
|
+
* Returns true if this node has the given value for the given property in an EXPLICIT quad.
|
|
427
|
+
* That is, this property-value has been explicitly set, and is NOT generated by the Reasoner.
|
|
428
|
+
* See the documentation for more information about implicit vs explicit
|
|
429
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
430
|
+
* @param value - a single node. Can be a NamedNode or Literal
|
|
431
|
+
*/
|
|
432
|
+
hasExplicit(property: NamedNode, value: Node): boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Returns true if this node has ANY explicit quad with the given property
|
|
435
|
+
* See the documentation for more information about implicit vs explicit
|
|
436
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
437
|
+
*/
|
|
438
|
+
hasExplicitProperty(property: NamedNode): boolean;
|
|
439
|
+
/**
|
|
440
|
+
* Returns true if this node has a Literal as value of the given property who's literal-value (a string) matches the given value
|
|
441
|
+
* So works the same as `has()` except you can provide a string as value, and will obviously not match any NamedNode values
|
|
442
|
+
* And unlike has() this method will NOT check for the Literal its datatype. Instead only checking the literal-value
|
|
443
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
444
|
+
* @param value - the string value we want to check for
|
|
445
|
+
*/
|
|
446
|
+
hasValue(property: NamedNode, value: string): boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Returns true if this node has the given value as the value of the given property with an EXACT match (meaning the same object in memory)
|
|
449
|
+
* So works the same as has() except for Literals this only returns true if the value of the property is exactly the same object as the given value
|
|
450
|
+
* UNLIKE `has()` which checks if the literal value, datatype and language tag of two literal nodes are equivalent
|
|
451
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
452
|
+
* @param value - a single node. Can be a NamedNode or Literal
|
|
453
|
+
*/
|
|
454
|
+
hasExact(property: NamedNode, value: Node): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Returns true if this node has ANY value set for the given property.
|
|
457
|
+
* That is, if any quad exists that has this node as the subject and the given property as predicate
|
|
458
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
459
|
+
*/
|
|
460
|
+
hasProperty(property: NamedNode): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Returns true if the given end point can be reached by following the given properties in order
|
|
463
|
+
* Example: hasPathTo([foaf.hasFriend,rdf.type],foaf.Person) will return true if any of the friends of this node (this person in this example) is of the type foaf:Person
|
|
464
|
+
* @param properties an array of NamedNodes
|
|
465
|
+
* @param endPoint the node to reach, a Literal or a NamedNode
|
|
466
|
+
*/
|
|
467
|
+
hasPathTo(properties: NamedNode[], endPoint?: Node): boolean;
|
|
468
|
+
getAs<T extends IShape>(type: {
|
|
469
|
+
new (): T;
|
|
470
|
+
getOf(node: Node): T;
|
|
471
|
+
}): T;
|
|
472
|
+
/**
|
|
473
|
+
* returns true if ANY of the given end points can be reached by following the given properties in the given order
|
|
474
|
+
* Example: hasPathTo([foaf.hasFriend,foaf.hasFriend],[mike,jenny]) will return true if this node (person) has a friend that has mike or jenny as a friend
|
|
475
|
+
* @param properties an array of NamedNodes
|
|
476
|
+
* @param endPoint the node to reach, a Literal or a NamedNode
|
|
477
|
+
*/
|
|
478
|
+
hasPathToSomeInSet(properties: NamedNode[], endPoints?: ICoreIterable<Node>): boolean;
|
|
479
|
+
/**
|
|
480
|
+
* returns true if ANY end point (node) can be reached by following the given properties in order
|
|
481
|
+
* @param properties an array of NamedNodes
|
|
482
|
+
*/
|
|
483
|
+
hasPath(properties: NamedNode[]): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Returns a set of all the properties this node has.
|
|
486
|
+
* That is, all unique predicates of quads where this node is the subject
|
|
487
|
+
* @param includeFromIncomingArcs if true, also includes predicates (properties) of quads where this node is the VALUE of another nodes' property. Default: false
|
|
488
|
+
*/
|
|
489
|
+
getProperties(includeFromIncomingArcs?: boolean): NodeSet<NamedNode>;
|
|
490
|
+
/**
|
|
491
|
+
* Returns a set of all the properties used by this node in EXPLICIT facts (quads)
|
|
492
|
+
* See the documentation for more information about implicit vs explicit facts
|
|
493
|
+
* @param includeFromIncomingArcs if true, also includes predicates (properties) of quads where this node is the VALUE of another nodes' property. Default: false
|
|
494
|
+
*/
|
|
495
|
+
getExplicitProperties(includeFromIncomingArcs?: boolean): NodeSet<NamedNode>;
|
|
496
|
+
/**
|
|
497
|
+
* Returns a set of all the properties used by other nodes where this node is the VALUE of that property
|
|
498
|
+
* For example if this node is Jenny and the following is true: Mike foaf:hasFriend Jenny, calling this method on Jenny will return hasFriend
|
|
499
|
+
*/
|
|
500
|
+
getInverseProperties(): NodeSet<NamedNode>;
|
|
501
|
+
/**
|
|
502
|
+
* If this node has values for the given property, the first value is returned
|
|
503
|
+
* NOTE: the order of multiple values CANNOT be guaranteed. Therefore use this value if it DOESN'T matter to you which of multiple possible values for this property you'll get OR if you're certain there will be only 1 value.
|
|
504
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
505
|
+
*/
|
|
506
|
+
getOne(property: NamedNode): Node | undefined;
|
|
507
|
+
/**
|
|
508
|
+
* If this node has EXPLICIT values for the given property, the first value is returned
|
|
509
|
+
* Same as `getOne()` except only explicit quads / facts are considered
|
|
510
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
511
|
+
*/
|
|
512
|
+
getOneExplicit(property: NamedNode): Node | undefined;
|
|
513
|
+
/**
|
|
514
|
+
* Returns all values this node has for the given property
|
|
515
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
516
|
+
*/
|
|
517
|
+
getAll(property: NamedNode): NodeValuesSet;
|
|
518
|
+
/**
|
|
519
|
+
* Returns all values this node EXPLICITLY has for the given property
|
|
520
|
+
* So, same as `getAll()` except only explicit facts are considered.
|
|
521
|
+
* See the documentation for more information about implicit vs explicit
|
|
522
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
523
|
+
*/
|
|
524
|
+
getAllExplicit(property: any): NodeSet;
|
|
525
|
+
/**
|
|
526
|
+
* Returns the literal value of the first Literal value for the given property
|
|
527
|
+
* Only returns a results in the disired language if specified.
|
|
528
|
+
* For example if `this rdfs:label "my name" then this.getValue(rdfs.label) will return "my name".
|
|
529
|
+
* So, works the same as getOne() except it will return the literal (string) value of the first found Literal
|
|
530
|
+
* NOTE: the order of multiple values CANNOT be guaranteed. Therefore use this value if it DOESN'T matter to you which of multiple possible values for this property you'll get OR if you're certain there will be only one value.
|
|
531
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
532
|
+
*/
|
|
533
|
+
getValue(property?: NamedNode, language?: string): string;
|
|
534
|
+
/**
|
|
535
|
+
* Returns the literal values (strings) of all Literals this this node has a value for the given property
|
|
536
|
+
* For example if `this rdfs:label "my name" and `this rdfs:label "my other name" it will return ["my name","my other name"].
|
|
537
|
+
* So, works the same as getAll() except it will return an array of strings
|
|
538
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
539
|
+
*/
|
|
540
|
+
getValues(property: NamedNode): string[];
|
|
541
|
+
/**
|
|
542
|
+
* Returns any value (node, node) that is connected to this node with one or more connections of the given property.
|
|
543
|
+
* For example getDeep(hasFriend) will return all the people that are my friends or friends of friends
|
|
544
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
545
|
+
* @param maxDepth - the maximum number of connections that resulting nodes are removed from this node. In the example above maxDepth=2 would return only friends and friends of friends
|
|
546
|
+
*/
|
|
547
|
+
getDeep(property: NamedNode, maxDepth?: number): NodeSet;
|
|
548
|
+
/**
|
|
549
|
+
* Returns the first found value following the given properties in the given order.
|
|
550
|
+
* For example: getOneFromPath([hasFriend,hasFather]) would return the first found father out of the set 'fathers of my friends'
|
|
551
|
+
* @param properties - an array of NamedNodes. Which are nodes with rdf:type rdf:Property, the edges in the graph, the predicates of quads.
|
|
552
|
+
*/
|
|
553
|
+
getOneFromPath(...properties: NamedNode[]): Node | undefined;
|
|
554
|
+
/**
|
|
555
|
+
* Returns all values that can be reached by following the given properties in order.
|
|
556
|
+
* For example getAllFromPath([hasFriend,hasFather]) will return all fathers of all my (direct) friends
|
|
557
|
+
* @param properties - an array of NamedNodes. Which are nodes with rdf:type rdf:Property, the edges in the graph, the predicates of quads.
|
|
558
|
+
*/
|
|
559
|
+
getAllFromPath(...properties: NamedNode[]): NodeSet;
|
|
560
|
+
/**
|
|
561
|
+
* Same as getDeep() but for inverse properties.
|
|
562
|
+
* Best understood with an example: if this is a person. this.getInverseDeep(hasChild) would return all this persons ancestors (which had children that eventually had this person as their child)
|
|
563
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
564
|
+
* @param maxDepth - the maximum number of connections that resulting nodes are removed from this node. In the example above maxDepth=2 would return only the parents and grand parents
|
|
565
|
+
*/
|
|
566
|
+
getInverseDeep(property: NamedNode, maxDepth?: number): NodeSet;
|
|
567
|
+
/**
|
|
568
|
+
* Returns true if the given value can be reached with one or more connections of the given property
|
|
569
|
+
* Example: if this is a person. this.hasDeep(hasFriend,Mike) returns true if this person has Mike as a friend, or if any this persons friends or friends of friends have Mike as a friend.
|
|
570
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
571
|
+
* @param maxDepth - the maximum number of connections that resulting nodes are removed from this node. In the example above maxDepth=2 would return true only if Mike is the persons friend, or friend of a friend
|
|
572
|
+
*/
|
|
573
|
+
hasDeep(property: NamedNode, value: Node, maxDepth?: number): boolean;
|
|
574
|
+
/**
|
|
575
|
+
* Returns the first node that has this node as the valu eof the given property.
|
|
576
|
+
* Same as getOne() but for 'inverse properties'. Meaning nodes that have this node as their value.
|
|
577
|
+
* Example: if this is a person. this.getOneInverse(hasChild) returns one of the persons parents
|
|
578
|
+
* NOTE: the order of multiple (inverse) values CANNOT be guaranteed. Therefore use this value if it DOESN'T matter to you which of multiple possible inverse values for this property you'll get OR if you're certain there will be only one value.
|
|
579
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
580
|
+
*/
|
|
581
|
+
getOneInverse(property: NamedNode): NamedNode | undefined;
|
|
582
|
+
/**
|
|
583
|
+
* Returns all the nodes that have this node as the value of the given property.
|
|
584
|
+
* Same as getAll() but for 'inverse properties'. Meaning nodes that have this node as their value.
|
|
585
|
+
* Example: if this is a person. this.getAllInverse(hasChild) returns all the persons parents
|
|
586
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
587
|
+
*/
|
|
588
|
+
getAllInverse(property: NamedNode): NodeSet<NamedNode>;
|
|
589
|
+
/**
|
|
590
|
+
* Returns all the nodes that have this node as the EXPLICIT value of the given property.
|
|
591
|
+
* Same as getAll() but only considers explicit facts (excluding implicit facts generated by the reasoner)
|
|
592
|
+
* Example: if this is a person. this.getAllInverse(hasChild) returns all the persons parents, as long as the fact that these are this persons parents is explicitly stated
|
|
593
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
594
|
+
*/
|
|
595
|
+
getAllInverseExplicit(property: any): NodeSet<NamedNode>;
|
|
596
|
+
/**
|
|
597
|
+
* Get all the values of multiple properties at once
|
|
598
|
+
* Same as getAll() but for multiple properties at once
|
|
599
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
600
|
+
*/
|
|
601
|
+
getMultiple(properties: ICoreIterable<NamedNode>): NodeSet;
|
|
602
|
+
/**
|
|
603
|
+
* Get all the nodes that have this node as their value for any of the given properties
|
|
604
|
+
* Same as getMultiple() but for the opposite direction
|
|
605
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
606
|
+
*/
|
|
607
|
+
getMultipleInverse(properties: ICoreIterable<NamedNode>): NodeSet;
|
|
608
|
+
/**
|
|
609
|
+
* Get the quad that represent the connection from this node to the given value, connected by the given property
|
|
610
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
611
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
612
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
613
|
+
* @param value - the node that this new graph-edge points to. The object of the quad to be created.
|
|
614
|
+
*/
|
|
615
|
+
getQuads(property: NamedNode, value?: Node): QuadSet;
|
|
616
|
+
/**
|
|
617
|
+
* Get all the quads that represent EXPLICIT connections from this node to another node, connected by the given property
|
|
618
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
619
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
620
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
621
|
+
*/
|
|
622
|
+
getExplicitQuads(property: NamedNode): QuadSet;
|
|
623
|
+
/**
|
|
624
|
+
* Get all the quads that represent EXPLICIT connections from another node that has this node as its value for the given property
|
|
625
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
626
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
627
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
628
|
+
*/
|
|
629
|
+
getExplicitInverseQuads(property: NamedNode): QuadSet;
|
|
630
|
+
/**
|
|
631
|
+
* Get all quads that represent connections from another node that has this node as its value for the given property
|
|
632
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
633
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
634
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
635
|
+
*/
|
|
636
|
+
getInverseQuads(property: NamedNode): QuadSet | undefined;
|
|
637
|
+
/**
|
|
638
|
+
* Get all (by default explicit) quads that represent connections from another node that has this node as its value for ANY property
|
|
639
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
640
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
641
|
+
* @param includeImplicit if true, includes both implicit and explicit quads. By default false, so will only return explicit quads
|
|
642
|
+
*/
|
|
643
|
+
getAllInverseQuads(includeImplicit?: boolean): QuadArray;
|
|
644
|
+
/**
|
|
645
|
+
* Get all (by default explicit) quads that represent connections for all values of this node (so quads where this node is the subject)
|
|
646
|
+
* NOTE: accessing quads is a very low level functionality required for the framework itself
|
|
647
|
+
* and SHOULD GENERALLY NOT BE USED. Use methods to get/set properties instead
|
|
648
|
+
* @param includeAsObject if true, includes quads from both directions (so also inverse properties where this node is the object of the quad)
|
|
649
|
+
* @param includeImplicit if true, includes both implicit and explicit quads. By default false, so will only return explicit quads
|
|
650
|
+
*/
|
|
651
|
+
getAllQuads(includeAsObject?: boolean, includeImplicit?: boolean): QuadArray;
|
|
652
|
+
/**
|
|
653
|
+
* #######################################################################
|
|
654
|
+
* ######################## EVENT METHODS / LISTENERS ####################
|
|
655
|
+
* #######################################################################
|
|
656
|
+
**/
|
|
657
|
+
/**
|
|
658
|
+
* Update a certain property so that only the given value is a value of this property.
|
|
659
|
+
* Overwrites (and thus removes) any previously set values
|
|
660
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
661
|
+
* @param value - a single node. Can be a NamedNode or Literal
|
|
662
|
+
*/
|
|
663
|
+
overwrite(property: NamedNode, value: Node): boolean;
|
|
664
|
+
/**
|
|
665
|
+
* Update a certain property so that only the given values are the values of this property.
|
|
666
|
+
* Overwrites (and thus removes) any previously set values
|
|
667
|
+
* Same as overwrite() except this allows you to replace the previous values with MULTIPLE new values
|
|
668
|
+
* @param property
|
|
669
|
+
* @param values
|
|
670
|
+
*/
|
|
671
|
+
moverwrite(property: NamedNode, values: ICoreIterable<Node>): boolean;
|
|
672
|
+
/**
|
|
673
|
+
* Removes this node from the graph, locally and remotely, in all connected QuadStores.
|
|
674
|
+
* All properties will be unset, both where this node is the subject or the object.
|
|
675
|
+
* Emits an event from the node itself and from the NamedNode class
|
|
676
|
+
*/
|
|
677
|
+
remove(): void;
|
|
678
|
+
/**
|
|
679
|
+
* UNSET (remove) a single property value connection.
|
|
680
|
+
* Remove a single connection between two nodes in the graph: from this node, to the node given as value, with the property as the connecting 'edge' between them
|
|
681
|
+
* In the graph, this will remove the edge between two nodes.
|
|
682
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
683
|
+
* @param value - the node that this new graph-edge points to. The object of the quad to be created.
|
|
684
|
+
*/
|
|
685
|
+
unset(property: NamedNode, value: Node): boolean;
|
|
686
|
+
/**
|
|
687
|
+
* unset (remove) all values of a certain property.
|
|
688
|
+
* Removes all connections (edges) in the graph between this node and other nodes, where the given property is used as the connecting 'edge' between them
|
|
689
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
690
|
+
*/
|
|
691
|
+
unsetAll(property: NamedNode): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* returns true if ANY node has this node as the value of the given property
|
|
694
|
+
* Example: if 'this' is a person, this.hasInverseProperty(hasChild) returns true if any facts stating `someParent hasChild thisPerson` are known
|
|
695
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
696
|
+
*/
|
|
697
|
+
hasInverseProperty(property: NamedNode): boolean;
|
|
698
|
+
/**
|
|
699
|
+
* returns true if the given inverse 'value' has this node as the (real) value of the given property
|
|
700
|
+
* Example: if 'this' is a person, this.hasInverseProperty(hasChild,someParent) returns true if someParent indeed has this person as a child
|
|
701
|
+
* @param property - a NamedNode with rdf:type rdf:Property, the edge in the graph, the predicate of a quad
|
|
702
|
+
* @param value - a single node. Can be a NamedNode or Literal
|
|
703
|
+
*/
|
|
704
|
+
hasInverse(property: NamedNode, value: Node): boolean;
|
|
705
|
+
/**
|
|
706
|
+
* returns true if this node is equivaluent to the given node.
|
|
707
|
+
* For NamedNodes it simply returns true if this === the given object. So if its the same object in memory.
|
|
708
|
+
* It exists mainly for comparing Literals, where two different objects can still be equivalent
|
|
709
|
+
* @param other another node
|
|
710
|
+
*/
|
|
711
|
+
equals(other: Term): boolean;
|
|
712
|
+
/**
|
|
713
|
+
* Save this node into the graph database.
|
|
714
|
+
* Newly created nodes will exist only in local memory until you call this function
|
|
715
|
+
* @returns a promise that resolves when the node has received a permanent URI
|
|
716
|
+
*/
|
|
717
|
+
save(): Promise<void>;
|
|
718
|
+
/**
|
|
719
|
+
* Create a new URI Node with the same properties as the current node
|
|
720
|
+
* NOTE: does NOT clone the inverse properties (where this node is the value of another node its properties)
|
|
721
|
+
*/
|
|
722
|
+
clone(): NamedNode;
|
|
723
|
+
/**
|
|
724
|
+
* Returns a string representation of this node.
|
|
725
|
+
* Returns the URI for a NamedNode
|
|
726
|
+
*/
|
|
727
|
+
toString(): string;
|
|
728
|
+
print(includeIncomingProperties?: boolean): string;
|
|
729
|
+
/**
|
|
730
|
+
* Fires the given call back when ANY property of this node changes.
|
|
731
|
+
* @param callback the method to be called when the change happens. The quads that have changed + the property that was updated are supplied as parameters
|
|
732
|
+
* @param context give a context to make sure you can easily unset / clear event listeners. Usually you would provide 'this' as context
|
|
733
|
+
*/
|
|
734
|
+
onChangeAny(callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
735
|
+
/**
|
|
736
|
+
* Fires the given call back when this node become the value or is no longer the value of another node
|
|
737
|
+
* @param callback the method to be called when the change happens. The quads that have changed + the property that was updated are supplied as parameters
|
|
738
|
+
* @param context give a context to make sure you can easily unset / clear event listeners. Usually you would provide 'this' as context
|
|
739
|
+
*/
|
|
740
|
+
onChangeAnyInverse(callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
741
|
+
/**
|
|
742
|
+
* Fires the given call back when this node changes the values of the given property
|
|
743
|
+
* @param callback the method to be called when the change happens. The quads that have changed + the property that was updated are supplied as parameters
|
|
744
|
+
* @param context give a context to make sure you can easily unset / clear event listeners. Usually you would provide 'this' as context
|
|
745
|
+
*/
|
|
746
|
+
onChange(property: NamedNode, callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
747
|
+
/**
|
|
748
|
+
* Fires the given callback when this node become the value or is no longer the value of the given property of another node
|
|
749
|
+
* Example: if someGroup hasParticipant thisResource, and the group removes this node from its participants, it will trigger onChangeInverse for this node
|
|
750
|
+
* @param callback the method to be called when the change happens. The quads that have changed + the property that was updated are supplied as parameters
|
|
751
|
+
* @param context give a context to make sure you can easily unset / clear event listeners. Usually you would provide 'this' as context
|
|
752
|
+
*/
|
|
753
|
+
onChangeInverse(property: any, callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
754
|
+
/**
|
|
755
|
+
* Call this when you want to stop listening for onChangeAny events. Make sure to provide the exact same BOUND instance of a method to properly clear the listener. OR make sure to provide a context both when setting and clearing the listener.
|
|
756
|
+
* @param callback the exact same method you supplied to onChangeAny
|
|
757
|
+
* @param context the same context you supplied to onChangeAny
|
|
758
|
+
*/
|
|
759
|
+
removeOnChangeAny(callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
760
|
+
/**
|
|
761
|
+
* Call this when you want to stop listening for onChangeAnyInverse events. Make sure to provide the exact same BOUND instance of a method to properly clear the listener. OR make sure to provide a context both when setting and clearing the listener.
|
|
762
|
+
* @param callback the exact same method you supplied to onChangeAnyInverse
|
|
763
|
+
* @param context the same context you supplied to onChangeAnyInverse
|
|
764
|
+
*/
|
|
765
|
+
removeOnChangeAnyInverse(callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
766
|
+
/**
|
|
767
|
+
* Call this when you want to stop listening for onChange events. Make sure to provide the exact same BOUND instance of a method as callback to properly clear the listener. OR make sure to provide a context both when setting and clearing the listener.
|
|
768
|
+
* @param callback the exact same method you supplied to onChange
|
|
769
|
+
* @param context the same context you supplied to onChange
|
|
770
|
+
*/
|
|
771
|
+
removeOnChange(property: NamedNode, callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
772
|
+
/**
|
|
773
|
+
* Call this when you want to stop listening for onChangeInverse events. Make sure to provide the exact same BOUND instance of a method as callback to properly clear the listener. OR make sure to provide a context both when setting and clearing the listener.
|
|
774
|
+
* @param callback the exact same method you supplied to onChangeInverse
|
|
775
|
+
* @param context the same context you supplied to onChangeInverse
|
|
776
|
+
*/
|
|
777
|
+
removeOnChangeInverse(property: any, callback: (quads?: QuadSet, property?: NamedNode) => void, context?: any): void;
|
|
778
|
+
/**
|
|
779
|
+
* Call this when you want to stop listening for onChangeAny events. Other then removeOnChangeAny you only have to supply the context.
|
|
780
|
+
* Use this if you no longer have access to the same bound listener function or you're otherwise unable to clear with removeOnChangeAny
|
|
781
|
+
* @param context the same context you supplied to onChangeAny
|
|
782
|
+
*/
|
|
783
|
+
clearOnChangeAny(context: any): void;
|
|
784
|
+
/**
|
|
785
|
+
* Call this when you want to stop listening for onChangeAnyInverse events. Other then removeOnChangeAnyInverse you only have to supply the context.
|
|
786
|
+
* Use this if you no longer have access to the same bound listener function or you're otherwise unable to clear with removeOnChangeAnyInverse
|
|
787
|
+
* @param context the same context you supplied to onChangeAnyInverse
|
|
788
|
+
*/
|
|
789
|
+
clearOnChangeAnyInverse(context: any): void;
|
|
790
|
+
/**
|
|
791
|
+
* Call this when you want to stop listening for onChange events. Other then removeOnChange you only have to supply the context.
|
|
792
|
+
* Use this if you no longer have access to the same bound listener function or you're otherwise unable to clear with removeOnChange
|
|
793
|
+
* @param context the same context you supplied to onChange
|
|
794
|
+
*/
|
|
795
|
+
clearOnChange(property: NamedNode, context?: any): void;
|
|
796
|
+
/**
|
|
797
|
+
* Call this when you want to stop listening for onChangeInverse events. Other then removeOnChangeInverse you only have to supply the context.
|
|
798
|
+
* Use this if you no longer have access to the same bound listener function or you're otherwise unable to clear with removeOnChangeInverse
|
|
799
|
+
* @param context the same context you supplied to onChangeAny
|
|
800
|
+
*/
|
|
801
|
+
clearOnChangeInverse(property: any, context: any): void;
|
|
802
|
+
/**
|
|
803
|
+
* Call this when you want to stop listening for onPredicateChange events
|
|
804
|
+
* @param context the same context you supplied to onPredicateChange
|
|
805
|
+
*/
|
|
806
|
+
clearOnPredicateChange(context: any): void;
|
|
807
|
+
/**
|
|
808
|
+
* Emits the batched (property) events of a NamedNode INSTANCE (meaning for this specific node)
|
|
809
|
+
* Used internally by the framework to manage emitting change events
|
|
810
|
+
* @internal
|
|
811
|
+
*/
|
|
812
|
+
emitBatchedEvents(): void;
|
|
813
|
+
getAsSubjectQuads(): Map<NamedNode, QuadMap>;
|
|
814
|
+
getAsObjectQuads(): Map<NamedNode, QuadMap>;
|
|
815
|
+
private createPromise;
|
|
816
|
+
/**
|
|
817
|
+
* Adds the quad to all given maps
|
|
818
|
+
* @param quad
|
|
819
|
+
* @param maps
|
|
820
|
+
* @private
|
|
821
|
+
*/
|
|
822
|
+
private registerPropertyChange;
|
|
823
|
+
private getQuadsByValue;
|
|
824
|
+
}
|
|
825
|
+
export declare class BlankNode extends NamedNode {
|
|
826
|
+
private static counter;
|
|
827
|
+
termType: any;
|
|
828
|
+
constructor(uri?: string, isTemporaryNode?: boolean);
|
|
829
|
+
get uri(): string;
|
|
830
|
+
set uri(uri: string);
|
|
831
|
+
static create(isTemporaryNode?: boolean): BlankNode;
|
|
832
|
+
static createUri(): string;
|
|
833
|
+
static includeBlankNodes(quads: QuadSet | Quad[], includeObjectBlankNodes?: boolean, includeSubjectBlankNodes?: boolean, blankNodes?: NodeURIMappings): Quad[] | QuadSet;
|
|
834
|
+
private static addBlankNodeQuads;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* One of the two main classes of nodes (nodes) in the graph.
|
|
838
|
+
* Literals are endpoints. They do NOT have outgoing connections (edges) to other nodes in the graph.
|
|
839
|
+
* Though a NamedNode can point to a Literal.
|
|
840
|
+
* Each literal node has a literal value, like a string.
|
|
841
|
+
* Besides that is can also have a language tag or a data type.
|
|
842
|
+
* Literals are often saved as a single string, for example '"yes"@en' (yes in english) or '"true"^^xsd:boolean (the value true with datatype english)
|
|
843
|
+
* This class represents those properties.
|
|
844
|
+
* See also: https://www.w3.org/TR/rdf-concepts/#section-Graph-Literal
|
|
845
|
+
*/
|
|
846
|
+
export declare class Literal extends Node implements IGraphObject, ILiteral {
|
|
847
|
+
protected _datatype: NamedNode;
|
|
848
|
+
private _language;
|
|
849
|
+
termType: 'Literal';
|
|
850
|
+
private referenceQuad;
|
|
851
|
+
/**
|
|
852
|
+
* Other than with NamedNodes, its fine to do `new Literal("my string value")`
|
|
853
|
+
* Datatype and language tags are optional
|
|
854
|
+
* @param value
|
|
855
|
+
* @param datatype
|
|
856
|
+
* @param language
|
|
857
|
+
*/
|
|
858
|
+
constructor(value: string, _datatype?: NamedNode, _language?: string);
|
|
859
|
+
/**
|
|
860
|
+
* get the language tag of this literal which states which language this literal is written in
|
|
861
|
+
* See also: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
|
862
|
+
*/
|
|
863
|
+
get language(): string;
|
|
864
|
+
/**
|
|
865
|
+
* update the language tag of this literal
|
|
866
|
+
*/
|
|
867
|
+
set language(lang: string);
|
|
868
|
+
/**
|
|
869
|
+
* returns the datatype of this literal
|
|
870
|
+
* Note that datatypes are NamedNodes themselves, who always have rdf:type rdf:Datatype
|
|
871
|
+
* If no datatype is set, the default datatype xsd:string will be returned
|
|
872
|
+
* If a language tag is set, the returned datatype will be rdf:langString
|
|
873
|
+
*/
|
|
874
|
+
get datatype(): NamedNode;
|
|
875
|
+
/**
|
|
876
|
+
* Update the datatype of this literal
|
|
877
|
+
* @param datatype
|
|
878
|
+
*/
|
|
879
|
+
set datatype(datatype: NamedNode);
|
|
880
|
+
/**
|
|
881
|
+
* Return the value of this literal
|
|
882
|
+
* @param datatype
|
|
883
|
+
*/
|
|
884
|
+
get value(): string;
|
|
885
|
+
/**
|
|
886
|
+
* update the literal value of this literal
|
|
887
|
+
* @param datatype
|
|
888
|
+
*/
|
|
889
|
+
set value(value: string);
|
|
890
|
+
/**
|
|
891
|
+
* Returns the literal value of the first Literal that occurs as object for the given subject and property and optionally also matches the given language
|
|
892
|
+
* @param subject
|
|
893
|
+
* @param property
|
|
894
|
+
* @param language
|
|
895
|
+
* @deprecated
|
|
896
|
+
* @returns {string|undefined}
|
|
897
|
+
*/
|
|
898
|
+
static getValue(subject: NamedNode, property: NamedNode, language?: string): string | undefined;
|
|
899
|
+
/**
|
|
900
|
+
* Returns all literal values of the Literals that occur as object for the given subject and property and optionally also match the given language
|
|
901
|
+
* @param subject
|
|
902
|
+
* @param property
|
|
903
|
+
* @param language
|
|
904
|
+
* @returns {string[]}
|
|
905
|
+
*/
|
|
906
|
+
static getValues(subject: NamedNode, property: NamedNode, language?: string): string[];
|
|
907
|
+
static isLiteralString(literalString: string): boolean;
|
|
908
|
+
static fromString(literalString: string): Literal;
|
|
909
|
+
getAs<T extends IShape>(type: {
|
|
910
|
+
new (): T;
|
|
911
|
+
getOf(node: Node): T;
|
|
912
|
+
}): T;
|
|
913
|
+
/**
|
|
914
|
+
* @internal
|
|
915
|
+
* @param quad
|
|
916
|
+
*/
|
|
917
|
+
registerProperty(quad: Quad): void;
|
|
918
|
+
/**
|
|
919
|
+
* registers the use of a quad. Since a quad can only be used in 1 quad
|
|
920
|
+
* this method makes a clone of the Literal if it's used a second time,
|
|
921
|
+
* and returns that new Literal so it will be used by the quad
|
|
922
|
+
* @internal
|
|
923
|
+
* @param quad
|
|
924
|
+
*/
|
|
925
|
+
registerInverseProperty(quad: Quad): Node;
|
|
926
|
+
/**
|
|
927
|
+
* @internal
|
|
928
|
+
* @param quad
|
|
929
|
+
*/
|
|
930
|
+
unregisterProperty(quad: Quad): void;
|
|
931
|
+
/**
|
|
932
|
+
* @internal
|
|
933
|
+
* @param quad
|
|
934
|
+
*/
|
|
935
|
+
unregisterInverseProperty(quad: Quad): void;
|
|
936
|
+
/**
|
|
937
|
+
* returns true if this literal node has a language tag
|
|
938
|
+
*/
|
|
939
|
+
hasLanguage(): boolean;
|
|
940
|
+
/**
|
|
941
|
+
* returns true if the language tag of this literal matches the given language
|
|
942
|
+
*/
|
|
943
|
+
isOfLanguage(language: string): boolean;
|
|
944
|
+
/**
|
|
945
|
+
* returns true if this literal has a datatype
|
|
946
|
+
*/
|
|
947
|
+
hasDatatype(): boolean;
|
|
948
|
+
/**
|
|
949
|
+
* Returns true if both are literal nodes, with equal literal values, equal language tags and equal data types
|
|
950
|
+
* Other than NamedNodes, two different literal node instances can be deemed equivalent if all their properties are the same
|
|
951
|
+
* @param other
|
|
952
|
+
* @param caseSensitive
|
|
953
|
+
*/
|
|
954
|
+
equals(other: Term): boolean;
|
|
955
|
+
/**
|
|
956
|
+
* Returns true if both are literal nodes, with equal literal values (CASE INSENSITIVE CHECK), equal language tags and equal data types
|
|
957
|
+
* Other than NamedNodes, two different literal node instances can be deemed equivalent if all their properties are the same
|
|
958
|
+
* @param other
|
|
959
|
+
*/
|
|
960
|
+
equalsCaseInsensitive(other: Term): boolean;
|
|
961
|
+
/**
|
|
962
|
+
* Creates a new Literal with exact the same properties (value,datatype and language)
|
|
963
|
+
*/
|
|
964
|
+
clone(): Literal;
|
|
965
|
+
getReferenceQuad(): Quad;
|
|
966
|
+
hasInverseProperty(property: NamedNode): boolean;
|
|
967
|
+
hasInverse(property: NamedNode, value: Node): boolean;
|
|
968
|
+
getOneInverse(property: NamedNode): NamedNode | undefined;
|
|
969
|
+
getMultipleInverse(properties: ICoreIterable<NamedNode>): NodeSet<NamedNode>;
|
|
970
|
+
getAllInverseQuads(includeImplicit?: boolean): QuadArray;
|
|
971
|
+
getAllQuads(includeAsObject?: boolean, includeImplicit?: boolean): QuadArray;
|
|
972
|
+
promiseLoaded(loadInverseProperties?: boolean): Promise<boolean>;
|
|
973
|
+
isLoaded(includingInverseProperties?: boolean): boolean;
|
|
974
|
+
toString(): string;
|
|
975
|
+
print(includeIncomingProperties?: boolean): string;
|
|
976
|
+
private _equals;
|
|
977
|
+
}
|
|
978
|
+
export declare class Graph implements Term {
|
|
979
|
+
value: string;
|
|
980
|
+
/**
|
|
981
|
+
* Emitted when changes have been made to this graph. Only emitted when data has actually changed, not just when data is loaded
|
|
982
|
+
*/
|
|
983
|
+
static CONTENTS_ALTERED: string;
|
|
984
|
+
/**
|
|
985
|
+
* Emitted when the contents of this graph have changed. Can also be due to loading data
|
|
986
|
+
*/
|
|
987
|
+
static CONTENTS_CHANGED: string;
|
|
988
|
+
private static graphs;
|
|
989
|
+
termType: string;
|
|
990
|
+
private quads;
|
|
991
|
+
constructor(value: string, quads?: QuadSet);
|
|
992
|
+
private _node;
|
|
993
|
+
get node(): NamedNode;
|
|
994
|
+
/**
|
|
995
|
+
* Resets the map of nodes that is known in this environment
|
|
996
|
+
*/
|
|
997
|
+
static reset(): void;
|
|
998
|
+
static create(quads?: QuadSet): Graph;
|
|
999
|
+
/**
|
|
1000
|
+
* @internal
|
|
1001
|
+
* @param graph
|
|
1002
|
+
*/
|
|
1003
|
+
static register(graph: Graph): void;
|
|
1004
|
+
/**
|
|
1005
|
+
* @internal
|
|
1006
|
+
* @param graph
|
|
1007
|
+
*/
|
|
1008
|
+
static unregister(graph: Graph): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Adds the quad to all given maps
|
|
1011
|
+
* @param quad
|
|
1012
|
+
* @param maps
|
|
1013
|
+
* @private
|
|
1014
|
+
*/
|
|
1015
|
+
static getOrCreate(uri: string): Graph;
|
|
1016
|
+
static getGraph(uri: string, mustExist?: boolean): Graph | null;
|
|
1017
|
+
static updateUri(graph: Graph, uri: string): void;
|
|
1018
|
+
static getAll(): CoreMap<string, Graph>;
|
|
1019
|
+
private static _create;
|
|
1020
|
+
equals(other: Term): any;
|
|
1021
|
+
/**
|
|
1022
|
+
* @internal
|
|
1023
|
+
* @param quad
|
|
1024
|
+
*/
|
|
1025
|
+
registerQuad(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
1026
|
+
/**
|
|
1027
|
+
* @internal
|
|
1028
|
+
* @param quad
|
|
1029
|
+
*/
|
|
1030
|
+
unregisterQuad(quad: Quad, alteration?: boolean, emitEvents?: boolean): void;
|
|
1031
|
+
hasQuad(quad: Quad): boolean;
|
|
1032
|
+
getContents(): QuadSet;
|
|
1033
|
+
setContents(quads: QuadSet): void;
|
|
1034
|
+
toString(): string;
|
|
1035
|
+
}
|
|
1036
|
+
declare class DefaultGraph extends Graph implements TFDefaultGraph {
|
|
1037
|
+
value: '';
|
|
1038
|
+
termType: typeof DefaultGraphTermType;
|
|
1039
|
+
uri: string;
|
|
1040
|
+
constructor();
|
|
1041
|
+
toString(): string;
|
|
1042
|
+
}
|
|
1043
|
+
export declare const defaultGraph: DefaultGraph;
|
|
1044
|
+
export declare class Quad extends EventEmitter {
|
|
1045
|
+
subject: NamedNode;
|
|
1046
|
+
predicate: NamedNode;
|
|
1047
|
+
object: Node;
|
|
1048
|
+
private _graph;
|
|
1049
|
+
implicit: boolean;
|
|
1050
|
+
/**
|
|
1051
|
+
* Emitter used by the class itself by static methods emitting events.
|
|
1052
|
+
* Anyone wanting to listen to that should therefore add a listener with Quad.emitter.on(...)
|
|
1053
|
+
* @internal
|
|
1054
|
+
*/
|
|
1055
|
+
static emitter: EventEmitter;
|
|
1056
|
+
/**
|
|
1057
|
+
* The number of quads active in this system
|
|
1058
|
+
*/
|
|
1059
|
+
static globalNumQuads: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* @internal
|
|
1062
|
+
* emitted when new quads have been created
|
|
1063
|
+
* TODO: possibly we can remove this, it may never be used. Only alterations are of interest?
|
|
1064
|
+
*/
|
|
1065
|
+
static QUADS_CREATED: string;
|
|
1066
|
+
/**
|
|
1067
|
+
* @internal
|
|
1068
|
+
* emitted by the Quad class itself when quads have been removed
|
|
1069
|
+
* TODO: possibly we can remove this, it may never be used. Only alterations are of interest?
|
|
1070
|
+
*/
|
|
1071
|
+
static QUADS_REMOVED: string;
|
|
1072
|
+
/**
|
|
1073
|
+
* emitted by a quad when that quad is being removed
|
|
1074
|
+
* TODO: possibly we can remove this, it may never be used. Only alterations are of interest?
|
|
1075
|
+
*/
|
|
1076
|
+
static QUAD_REMOVED: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* emitted when quads have been altered by user interaction
|
|
1079
|
+
* @internal
|
|
1080
|
+
*/
|
|
1081
|
+
static QUADS_ALTERED: string;
|
|
1082
|
+
private static createdQuads;
|
|
1083
|
+
private static removedQuads;
|
|
1084
|
+
private static removedQuadsAltered;
|
|
1085
|
+
private static createdQuadsAltered;
|
|
1086
|
+
private _removed;
|
|
1087
|
+
/**
|
|
1088
|
+
* Creates the quad
|
|
1089
|
+
* @param subject - the subject of the quad
|
|
1090
|
+
* @param predicate
|
|
1091
|
+
* @param object
|
|
1092
|
+
*/
|
|
1093
|
+
constructor(subject: NamedNode, predicate: NamedNode, object: Node, _graph?: Graph, implicit?: boolean, alteration?: boolean, emitEvents?: boolean);
|
|
1094
|
+
get graph(): Graph;
|
|
1095
|
+
/**
|
|
1096
|
+
* Returns true if this quad still exists as an object in memory, but is no longer actively used in the graph
|
|
1097
|
+
*/
|
|
1098
|
+
get isRemoved(): boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* @internal
|
|
1101
|
+
* Returns true if events of newly created quads or removed quads are currently batched and waiting to be emitted
|
|
1102
|
+
*/
|
|
1103
|
+
static hasBatchedEvents(): boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* @internal
|
|
1106
|
+
*/
|
|
1107
|
+
static emitBatchedEvents(): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Get the existing quad for the given subject,predicate and object, or create it if it didn't exists yet.
|
|
1110
|
+
* @param subject
|
|
1111
|
+
* @param predicate
|
|
1112
|
+
* @param object
|
|
1113
|
+
* @param implicit
|
|
1114
|
+
* @param alteration - states whether this quad has been created by a user interaction (true) or simply because of updated data has been loaded
|
|
1115
|
+
*/
|
|
1116
|
+
static getOrCreate(subject: NamedNode, predicate: NamedNode, object: Node, graph?: Graph, implicit?: boolean, alteration?: boolean, emitEvents?: boolean): Quad;
|
|
1117
|
+
/**
|
|
1118
|
+
* Gets the existing quad for the given subject,predicate and object.
|
|
1119
|
+
* Will return any quad with an equivalent object. See Literal.isEquivalentTo() and NamedNode.isEquivalentTo() for more information.
|
|
1120
|
+
* @param subject
|
|
1121
|
+
* @param predicate
|
|
1122
|
+
* @param object
|
|
1123
|
+
*/
|
|
1124
|
+
static get(subject: NamedNode, predicate: NamedNode, object: Node, graph: Graph): Quad | null;
|
|
1125
|
+
static moveQuadsToGraph(quads: Quad[], graph: Graph, alteration?: boolean): any;
|
|
1126
|
+
static emitRemovedQuad(quad: Quad, alteration?: boolean): void;
|
|
1127
|
+
static emitCreatedQuad(quad: Quad, alteration?: boolean): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Removes this quad and creates a new quad with the same subject,predicate,object, but a new graph.
|
|
1130
|
+
* Returns the new quad
|
|
1131
|
+
* @param newGraph
|
|
1132
|
+
*/
|
|
1133
|
+
moveToGraph(newGraph: Graph, alteration?: boolean): Quad;
|
|
1134
|
+
/**
|
|
1135
|
+
* Turns off a quad. Meaning it will no longer be active in the graph.
|
|
1136
|
+
* Comes in handy in very specific use cases when for example quads have already been created, but you want to check what the state was before these quads were created
|
|
1137
|
+
*/
|
|
1138
|
+
turnOff(): void;
|
|
1139
|
+
/**
|
|
1140
|
+
* Turns on a quad. Meaning it will be active (again) in the graph.
|
|
1141
|
+
* Only use this if you've had to turn quads off first.
|
|
1142
|
+
*/
|
|
1143
|
+
turnOn(): void;
|
|
1144
|
+
/**
|
|
1145
|
+
* Turn an implicit quad into an explicit quad (because an explicit user action generated it as an independent explicit fact now)
|
|
1146
|
+
*/
|
|
1147
|
+
makeExplicit(): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* Remove this quad from the graph
|
|
1150
|
+
* Will be removed both locally and from the graph database
|
|
1151
|
+
* @param alteration
|
|
1152
|
+
*/
|
|
1153
|
+
remove(alteration?: boolean, emitEvents?: boolean): void;
|
|
1154
|
+
/**
|
|
1155
|
+
* Cancel the removal of a quad
|
|
1156
|
+
*/
|
|
1157
|
+
undoRemoval(): void;
|
|
1158
|
+
onValueChanged(oldValue: Literal): void;
|
|
1159
|
+
print(): string;
|
|
1160
|
+
/**
|
|
1161
|
+
* Print this quad as a string
|
|
1162
|
+
*/
|
|
1163
|
+
toString(): string;
|
|
1164
|
+
private setup;
|
|
1165
|
+
private mimicEventsOnUpdate;
|
|
1166
|
+
}
|
|
1167
|
+
export {};
|