rdflib 2.2.10 → 2.2.12-5f141ca2
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/.babelrc +0 -0
- package/README.md +1 -0
- package/changes.txt +0 -0
- package/dist/rdflib.min.js +62 -0
- package/dist/rdflib.min.js.map +1 -0
- package/esm/blank-node.js +137 -0
- package/esm/class-order.js +12 -0
- package/esm/collection.js +173 -0
- package/esm/convert.js +61 -0
- package/esm/default-graph.js +57 -0
- package/esm/empty.js +46 -0
- package/esm/factories/canonical-data-factory.js +204 -0
- package/esm/factories/extended-term-factory.js +55 -0
- package/esm/factories/factory-types.js +18 -0
- package/esm/factories/rdflib-data-factory.js +55 -0
- package/esm/fetcher.js +2180 -0
- package/esm/formula.js +987 -0
- package/esm/index.js +64 -0
- package/esm/jsonldparser.js +122 -0
- package/esm/jsonparser.js +60 -0
- package/esm/literal.js +236 -0
- package/esm/log.js +13 -0
- package/esm/n3parser.js +1854 -0
- package/esm/named-node.js +154 -0
- package/esm/namespace.js +17 -0
- package/esm/node-internal.js +151 -0
- package/esm/node.js +46 -0
- package/esm/parse.js +138 -0
- package/esm/patch-parser.js +110 -0
- package/esm/query-to-sparql.js +83 -0
- package/esm/query.js +620 -0
- package/esm/rdfaparser.js +1197 -0
- package/esm/rdfxmlparser.js +588 -0
- package/esm/serialize.js +95 -0
- package/esm/serializer.js +1162 -0
- package/esm/sparql-to-query.js +566 -0
- package/esm/statement.js +128 -0
- package/esm/store.js +1306 -0
- package/esm/tf-types.js +1 -0
- package/esm/types.js +25 -0
- package/esm/update-manager.js +1252 -0
- package/esm/updates-via.js +197 -0
- package/esm/uri.js +245 -0
- package/esm/utils/default-graph-uri.js +4 -0
- package/esm/utils/termValue.js +8 -0
- package/esm/utils/terms.js +72 -0
- package/esm/utils-js.js +348 -0
- package/esm/utils.js +103 -0
- package/esm/variable.js +101 -0
- package/esm/xsd-internal.js +10 -0
- package/esm/xsd.js +15 -0
- package/lib/blank-node.d.ts +44 -0
- package/lib/blank-node.js +0 -0
- package/lib/class-order.d.ts +7 -0
- package/lib/class-order.js +0 -0
- package/lib/collection.d.ts +65 -0
- package/lib/collection.js +0 -0
- package/lib/convert.d.ts +2 -0
- package/lib/convert.js +0 -0
- package/lib/default-graph.d.ts +13 -0
- package/lib/default-graph.js +0 -0
- package/lib/empty.d.ts +11 -0
- package/lib/empty.js +0 -0
- package/lib/factories/canonical-data-factory.d.ts +6 -0
- package/lib/factories/canonical-data-factory.js +0 -0
- package/lib/factories/extended-term-factory.d.ts +13 -0
- package/lib/factories/extended-term-factory.js +0 -0
- package/lib/factories/factory-types.d.ts +67 -0
- package/lib/factories/factory-types.js +0 -0
- package/lib/factories/rdflib-data-factory.d.ts +4 -0
- package/lib/factories/rdflib-data-factory.js +0 -0
- package/lib/fetcher.d.ts +443 -0
- package/lib/fetcher.js +3 -2
- package/lib/formula.d.ts +327 -0
- package/lib/formula.js +0 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +0 -0
- package/lib/jsonldparser.d.ts +13 -0
- package/lib/jsonldparser.js +0 -0
- package/lib/jsonparser.d.ts +4 -0
- package/lib/jsonparser.js +0 -0
- package/lib/literal.d.ts +67 -0
- package/lib/literal.js +0 -0
- package/lib/log.d.ts +15 -0
- package/lib/log.js +0 -0
- package/lib/n3parser.d.ts +62 -0
- package/lib/n3parser.js +1334 -1289
- package/lib/named-node.d.ts +44 -0
- package/lib/named-node.js +0 -0
- package/lib/namespace.d.ts +7 -0
- package/lib/namespace.js +0 -0
- package/lib/node-internal.d.ts +63 -0
- package/lib/node-internal.js +0 -0
- package/lib/node.d.ts +2 -0
- package/lib/node.js +0 -0
- package/lib/parse.d.ts +16 -0
- package/lib/parse.js +0 -0
- package/lib/patch-parser.d.ts +3 -0
- package/lib/patch-parser.js +0 -0
- package/lib/query-to-sparql.d.ts +1 -0
- package/lib/query-to-sparql.js +0 -0
- package/lib/query.d.ts +27 -0
- package/lib/query.js +0 -0
- package/lib/rdfaparser.d.ts +78 -0
- package/lib/rdfaparser.js +0 -0
- package/lib/rdfxmlparser.d.ts +60 -0
- package/lib/rdfxmlparser.js +430 -413
- package/lib/serialize.d.ts +23 -0
- package/lib/serialize.js +1 -1
- package/lib/serializer.d.ts +54 -0
- package/lib/serializer.js +851 -824
- package/lib/sparql-to-query.d.ts +6 -0
- package/lib/sparql-to-query.js +0 -0
- package/lib/statement.d.ts +55 -0
- package/lib/statement.js +0 -0
- package/lib/store.d.ts +302 -0
- package/lib/store.js +0 -0
- package/lib/tf-types.d.ts +151 -0
- package/lib/tf-types.js +0 -0
- package/lib/types.d.ts +68 -0
- package/lib/types.js +0 -0
- package/lib/update-manager.d.ts +198 -0
- package/lib/update-manager.js +0 -0
- package/lib/updates-via.d.ts +26 -0
- package/lib/updates-via.js +0 -0
- package/lib/uri.d.ts +33 -0
- package/lib/uri.js +0 -0
- package/lib/utils/default-graph-uri.d.ts +3 -0
- package/lib/utils/default-graph-uri.js +0 -0
- package/lib/utils/termValue.d.ts +3 -0
- package/lib/utils/termValue.js +0 -0
- package/lib/utils/terms.d.ts +33 -0
- package/lib/utils/terms.js +0 -0
- package/lib/utils-js.d.ts +50 -0
- package/lib/utils-js.js +0 -0
- package/lib/utils.d.ts +20 -0
- package/lib/utils.js +0 -0
- package/lib/variable.d.ts +29 -0
- package/lib/variable.js +0 -0
- package/lib/xsd-internal.d.ts +11 -0
- package/lib/xsd-internal.js +0 -0
- package/lib/xsd.d.ts +19 -0
- package/lib/xsd.js +8 -14
- package/package.json +3 -3
- package/src/blank-node.ts +0 -0
- package/src/class-order.ts +0 -0
- package/src/collection.ts +0 -0
- package/src/convert.js +0 -0
- package/src/default-graph.ts +0 -0
- package/src/empty.ts +0 -0
- package/src/factories/canonical-data-factory.ts +0 -0
- package/src/factories/extended-term-factory.ts +0 -0
- package/src/factories/factory-types.ts +0 -0
- package/src/factories/rdflib-data-factory.ts +0 -0
- package/src/fetcher.ts +6 -3
- package/src/formula.ts +0 -0
- package/src/index.ts +0 -0
- package/src/jsonldparser.js +0 -0
- package/src/jsonparser.js +0 -0
- package/src/literal.ts +0 -0
- package/src/log.js +0 -0
- package/src/n3parser.js +1114 -1110
- package/src/named-node.ts +0 -0
- package/src/namespace.ts +0 -0
- package/src/node-internal.ts +0 -0
- package/src/node.ts +0 -0
- package/src/parse.ts +0 -0
- package/src/patch-parser.js +0 -0
- package/src/query-to-sparql.js +0 -0
- package/src/query.js +0 -0
- package/src/rdfaparser.js +0 -0
- package/src/rdfxmlparser.js +22 -21
- package/src/serialize.ts +3 -3
- package/src/serializer.js +74 -62
- package/src/sparql-to-query.js +0 -0
- package/src/statement.ts +0 -0
- package/src/store.ts +0 -0
- package/src/tf-types.ts +0 -0
- package/src/types.ts +0 -0
- package/src/update-manager.ts +0 -0
- package/src/updates-via.js +0 -0
- package/src/uri.ts +0 -0
- package/src/utils/default-graph-uri.ts +0 -0
- package/src/utils/termValue.ts +0 -0
- package/src/utils/terms.ts +0 -0
- package/src/utils-js.js +0 -0
- package/src/utils.ts +0 -0
- package/src/variable.ts +0 -0
- package/src/xsd-internal.js +0 -0
- package/src/xsd.js +16 -14
package/lib/formula.d.ts
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import Collection from './collection';
|
|
2
|
+
import RDFlibNamedNode from './named-node';
|
|
3
|
+
import Namespace from './namespace';
|
|
4
|
+
import Node from './node-internal';
|
|
5
|
+
import Statement from './statement';
|
|
6
|
+
import { Bindings, GraphTermType } from './types';
|
|
7
|
+
import Variable from './variable';
|
|
8
|
+
import { Indexable, TFIDFactoryTypes } from './factories/factory-types';
|
|
9
|
+
import { RdfJsDataFactory, Quad_Graph, Quad_Object, Quad_Predicate, Quad, Quad_Subject, Term } from './tf-types';
|
|
10
|
+
import Fetcher from './fetcher';
|
|
11
|
+
import BlankNode from './blank-node';
|
|
12
|
+
import NamedNode from './named-node';
|
|
13
|
+
export interface FormulaOpts {
|
|
14
|
+
dataCallback?: (q: Quad) => void;
|
|
15
|
+
rdfArrayRemove?: (arr: Quad[], q: Quad) => void;
|
|
16
|
+
rdfFactory?: RdfJsDataFactory;
|
|
17
|
+
}
|
|
18
|
+
interface BooleanMap {
|
|
19
|
+
[uri: string]: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface MembersMap {
|
|
22
|
+
[uri: string]: Quad;
|
|
23
|
+
}
|
|
24
|
+
interface UriMap {
|
|
25
|
+
[uri: string]: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A formula, or store of RDF statements
|
|
29
|
+
*/
|
|
30
|
+
export default class Formula extends Node {
|
|
31
|
+
statements: Array<Statement>;
|
|
32
|
+
constraints: ReadonlyArray<any>;
|
|
33
|
+
initBindings: ReadonlyArray<any>;
|
|
34
|
+
optional: ReadonlyArray<any>;
|
|
35
|
+
termType: typeof GraphTermType;
|
|
36
|
+
classOrder: number;
|
|
37
|
+
/**
|
|
38
|
+
* The accompanying fetcher instance.
|
|
39
|
+
*
|
|
40
|
+
* Is set by the fetcher when initialized.
|
|
41
|
+
*/
|
|
42
|
+
fetcher?: Fetcher;
|
|
43
|
+
isVar: number;
|
|
44
|
+
/**
|
|
45
|
+
* A namespace for the specified namespace's URI
|
|
46
|
+
* @param nsuri The URI for the namespace
|
|
47
|
+
*/
|
|
48
|
+
ns: typeof Namespace;
|
|
49
|
+
/** The factory used to generate statements and terms */
|
|
50
|
+
rdfFactory: any;
|
|
51
|
+
/**
|
|
52
|
+
* Initializes this formula
|
|
53
|
+
* @constructor
|
|
54
|
+
* @param statements - Initial array of statements
|
|
55
|
+
* @param constraints - initial array of constraints
|
|
56
|
+
* @param initBindings - initial bindings used in Query
|
|
57
|
+
* @param optional - optional
|
|
58
|
+
* @param opts
|
|
59
|
+
* @param opts.rdfFactory - The rdf factory that should be used by the store
|
|
60
|
+
*/
|
|
61
|
+
constructor(statements?: Array<Statement>, constraints?: ReadonlyArray<any>, initBindings?: ReadonlyArray<any>, optional?: ReadonlyArray<any>, opts?: FormulaOpts);
|
|
62
|
+
/** Add a statement from its parts
|
|
63
|
+
* @param subject - the first part of the statement
|
|
64
|
+
* @param predicate - the second part of the statement
|
|
65
|
+
* @param object - the third part of the statement
|
|
66
|
+
* @param graph - the last part of the statement
|
|
67
|
+
*/
|
|
68
|
+
add(subject: Quad_Subject | Quad | Quad[], predicate?: Quad_Predicate, object?: Term | string, graph?: Quad_Graph): Statement | null | this | number;
|
|
69
|
+
/** Add a statment object
|
|
70
|
+
* @param {Statement} statement - An existing constructed statement to add
|
|
71
|
+
*/
|
|
72
|
+
addStatement(statement: Quad): Statement | null | this | number;
|
|
73
|
+
/**
|
|
74
|
+
* Shortcut for adding blankNodes
|
|
75
|
+
* @param [id]
|
|
76
|
+
*/
|
|
77
|
+
bnode(id?: string): BlankNode;
|
|
78
|
+
/**
|
|
79
|
+
* Adds all the statements to this formula
|
|
80
|
+
* @param statements - A collection of statements
|
|
81
|
+
*/
|
|
82
|
+
addAll(statements: Quad[]): void;
|
|
83
|
+
/** Follow link from one node, using one wildcard, looking for one
|
|
84
|
+
*
|
|
85
|
+
* For example, any(me, knows, null, profile) - a person I know accoring to my profile .
|
|
86
|
+
* any(me, knows, null, null) - a person I know accoring to anything in store .
|
|
87
|
+
* any(null, knows, me, null) - a person who know me accoring to anything in store .
|
|
88
|
+
*
|
|
89
|
+
* @param s - A node to search for as subject, or if null, a wildcard
|
|
90
|
+
* @param p - A node to search for as predicate, or if null, a wildcard
|
|
91
|
+
* @param o - A node to search for as object, or if null, a wildcard
|
|
92
|
+
* @param g - A node to search for as graph, or if null, a wildcard
|
|
93
|
+
* @returns A node which match the wildcard position, or null
|
|
94
|
+
*/
|
|
95
|
+
any(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): Node | null;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the value of a node that matches the specified pattern
|
|
98
|
+
* @param s The subject
|
|
99
|
+
* @param p The predicate
|
|
100
|
+
* @param o The object
|
|
101
|
+
* @param g The graph that contains the statement
|
|
102
|
+
*/
|
|
103
|
+
anyValue(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): string | void;
|
|
104
|
+
/**
|
|
105
|
+
* Gets the first JavaScript object equivalent to a node based on the specified pattern
|
|
106
|
+
* @param s The subject
|
|
107
|
+
* @param p The predicate
|
|
108
|
+
* @param o The object
|
|
109
|
+
* @param g The graph that contains the statement
|
|
110
|
+
*/
|
|
111
|
+
anyJS(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): any;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the first statement that matches the specified pattern
|
|
114
|
+
*/
|
|
115
|
+
anyStatementMatching(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): Statement | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Returns a unique index-safe identifier for the given term.
|
|
118
|
+
*
|
|
119
|
+
* Falls back to the rdflib hashString implementation if the given factory doesn't support id.
|
|
120
|
+
*/
|
|
121
|
+
id(term: TFIDFactoryTypes): Indexable;
|
|
122
|
+
/**
|
|
123
|
+
* Search the Store
|
|
124
|
+
* This is really a teaching method as to do this properly you would use IndexedFormula
|
|
125
|
+
*
|
|
126
|
+
* @param s - A node to search for as subject, or if null, a wildcard
|
|
127
|
+
* @param p - A node to search for as predicate, or if null, a wildcard
|
|
128
|
+
* @param o - A node to search for as object, or if null, a wildcard
|
|
129
|
+
* @param g - A node to search for as graph, or if null, a wildcard
|
|
130
|
+
* @param justOne - flag - stop when found one rather than get all of them?
|
|
131
|
+
* @returns {Array<Node>} - An array of nodes which match the wildcard position
|
|
132
|
+
*/
|
|
133
|
+
statementsMatching<JustOne extends boolean = false>(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null, justOne?: boolean): Statement[];
|
|
134
|
+
/**
|
|
135
|
+
* Finds the types in the list which have no *stored* subtypes
|
|
136
|
+
* These are a set of classes which provide by themselves complete
|
|
137
|
+
* information -- the other classes are redundant for those who
|
|
138
|
+
* know the class DAG.
|
|
139
|
+
* @param types A map of the types
|
|
140
|
+
*/
|
|
141
|
+
bottomTypeURIs(types: any): any;
|
|
142
|
+
/** Creates a new collection */
|
|
143
|
+
collection(): Collection;
|
|
144
|
+
/** Follow links from one node, using one wildcard.
|
|
145
|
+
*
|
|
146
|
+
* For example, each(me, knows, null, profile) - people I know accoring to my profile .
|
|
147
|
+
* each(me, knows, null, null) - people I know accoring to anything in store .
|
|
148
|
+
* each(null, knows, me, null) - people who know me accoring to anything in store .
|
|
149
|
+
*
|
|
150
|
+
* @param s - A node to search for as subject, or if null, a wildcard
|
|
151
|
+
* @param p - A node to search for as predicate, or if null, a wildcard
|
|
152
|
+
* @param o - A node to search for as object, or if null, a wildcard
|
|
153
|
+
* @param g - A node to search for as graph, or if null, a wildcard
|
|
154
|
+
* @returns {Array<Node>} - An array of nodes which match the wildcard position
|
|
155
|
+
*/
|
|
156
|
+
each(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): Node[];
|
|
157
|
+
/**
|
|
158
|
+
* Test whether this formula is equals to {other}
|
|
159
|
+
* @param other - The other formula
|
|
160
|
+
*/
|
|
161
|
+
equals(other: Formula): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* For thisClass or any subclass, anything which has it is its type
|
|
164
|
+
* or is the object of something which has the type as its range, or subject
|
|
165
|
+
* of something which has the type as its domain
|
|
166
|
+
* We don't bother doing subproperty (yet?)as it doesn't seeem to be used
|
|
167
|
+
* much.
|
|
168
|
+
* Get all the Classes of which we can RDFS-infer the subject is a member
|
|
169
|
+
* @return a hash of URIs
|
|
170
|
+
*/
|
|
171
|
+
findMembersNT(thisClass: any): MembersMap;
|
|
172
|
+
/**
|
|
173
|
+
* For thisClass or any subclass, anything which has it is its type
|
|
174
|
+
* or is the object of something which has the type as its range, or subject
|
|
175
|
+
* of something which has the type as its domain
|
|
176
|
+
* We don't bother doing subproperty (yet?)as it doesn't seeem to be used
|
|
177
|
+
* much.
|
|
178
|
+
* Get all the Classes of which we can RDFS-infer the subject is a member
|
|
179
|
+
* @param subject - A named node
|
|
180
|
+
*/
|
|
181
|
+
findMemberURIs(subject: Node): UriMap;
|
|
182
|
+
/**
|
|
183
|
+
* Get all the Classes of which we can RDFS-infer the subject is a superclass
|
|
184
|
+
* Returns a hash table where key is NT of type and value is statement why we
|
|
185
|
+
* think so.
|
|
186
|
+
* Does NOT return terms, returns URI strings.
|
|
187
|
+
* We use NT representations in this version because they handle blank nodes.
|
|
188
|
+
*/
|
|
189
|
+
findSubClassesNT(subject: Node): {
|
|
190
|
+
[uri: string]: boolean;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Get all the Classes of which we can RDFS-infer the subject is a subclass
|
|
194
|
+
* @param {RDFlibNamedNode} subject - The thing whose classes are to be found
|
|
195
|
+
* @returns a hash table where key is NT of type and value is statement why we
|
|
196
|
+
* think so.
|
|
197
|
+
* Does NOT return terms, returns URI strings.
|
|
198
|
+
* We use NT representations in this version because they handle blank nodes.
|
|
199
|
+
*/
|
|
200
|
+
findSuperClassesNT(subject: Node): {
|
|
201
|
+
[uri: string]: boolean;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Get all the Classes of which we can RDFS-infer the subject is a member
|
|
205
|
+
* todo: This will loop is there is a class subclass loop (Sublass loops are
|
|
206
|
+
* not illegal)
|
|
207
|
+
* @param {RDFlibNamedNode} subject - The thing whose classes are to be found
|
|
208
|
+
* @returns a hash table where key is NT of type and value is statement why we think so.
|
|
209
|
+
* Does NOT return terms, returns URI strings.
|
|
210
|
+
* We use NT representations in this version because they handle blank nodes.
|
|
211
|
+
*/
|
|
212
|
+
findTypesNT(subject: any): {
|
|
213
|
+
[uri: string]: boolean;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Get all the Classes of which we can RDFS-infer the subject is a member
|
|
217
|
+
* todo: This will loop is there is a class subclass loop (Sublass loops are
|
|
218
|
+
* not illegal)
|
|
219
|
+
* Returns a hash table where key is NT of type and value is statement why we
|
|
220
|
+
* think so.
|
|
221
|
+
* Does NOT return terms, returns URI strings.
|
|
222
|
+
* We use NT representations in this version because they handle blank nodes.
|
|
223
|
+
* @param subject - A subject node
|
|
224
|
+
*/
|
|
225
|
+
findTypeURIs(subject: Quad_Subject): UriMap;
|
|
226
|
+
/** Trace statements which connect directly, or through bnodes
|
|
227
|
+
*
|
|
228
|
+
* @param subject - The node to start looking for statments
|
|
229
|
+
* @param doc - The document to be searched, or null to search all documents
|
|
230
|
+
* @returns an array of statements, duplicate statements are suppresssed.
|
|
231
|
+
*/
|
|
232
|
+
connectedStatements(subject: Quad_Subject, doc: Quad_Graph, excludePredicateURIs?: ReadonlyArray<string>): Statement[];
|
|
233
|
+
/**
|
|
234
|
+
* Creates a new empty formula
|
|
235
|
+
*
|
|
236
|
+
* @param _features - Not applicable, but necessary for typing to pass
|
|
237
|
+
*/
|
|
238
|
+
formula(_features?: ReadonlyArray<string>): Formula;
|
|
239
|
+
/**
|
|
240
|
+
* Transforms an NTriples string format into a Node.
|
|
241
|
+
* The blank node bit should not be used on program-external values; designed
|
|
242
|
+
* for internal work such as storing a blank node id in an HTML attribute.
|
|
243
|
+
* This will only parse the strings generated by the various toNT() methods.
|
|
244
|
+
*/
|
|
245
|
+
fromNT(str: any): any;
|
|
246
|
+
/** Returns true if this formula holds the specified statement(s) */
|
|
247
|
+
holds(s: any | any[], p?: any, o?: any, g?: any): boolean;
|
|
248
|
+
/**
|
|
249
|
+
* Returns true if this formula holds the specified {statement}
|
|
250
|
+
*/
|
|
251
|
+
holdsStatement(statement: any): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Used by the n3parser to generate list elements
|
|
254
|
+
* @param values - The values of the collection
|
|
255
|
+
* @param context - The store
|
|
256
|
+
* @return {BlankNode|Collection} - The term for the statement
|
|
257
|
+
*/
|
|
258
|
+
list(values: any, context: any): any;
|
|
259
|
+
/**
|
|
260
|
+
* Transform a collection of NTriple URIs into their URI strings
|
|
261
|
+
* @param t - Some iterable collection of NTriple URI strings
|
|
262
|
+
* @return A collection of the URIs as strings
|
|
263
|
+
* todo: explain why it is important to go through NT
|
|
264
|
+
*/
|
|
265
|
+
NTtoURI(t: any): {};
|
|
266
|
+
/**
|
|
267
|
+
* Serializes this formula
|
|
268
|
+
* @param base - The base string
|
|
269
|
+
* @param contentType - The content type of the syntax to use
|
|
270
|
+
* @param provenance - The provenance URI
|
|
271
|
+
*/
|
|
272
|
+
serialize(base: any, contentType: any, provenance: any): any;
|
|
273
|
+
/**
|
|
274
|
+
* Creates a new formula with the substituting bindings applied
|
|
275
|
+
* @param bindings - The bindings to substitute
|
|
276
|
+
*/
|
|
277
|
+
substitute<T extends Node = Formula>(bindings: Bindings): T;
|
|
278
|
+
sym(uri: string, name?: any): NamedNode;
|
|
279
|
+
/**
|
|
280
|
+
* Gets the node matching the specified pattern. Throws when no match could be made.
|
|
281
|
+
* @param s - The subject
|
|
282
|
+
* @param p - The predicate
|
|
283
|
+
* @param o - The object
|
|
284
|
+
* @param g - The graph that contains the statement
|
|
285
|
+
*/
|
|
286
|
+
the(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): Node | null | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* RDFS Inference
|
|
289
|
+
* These are hand-written implementations of a backward-chaining reasoner
|
|
290
|
+
* over the RDFS axioms.
|
|
291
|
+
* @param seeds - A hash of NTs of classes to start with
|
|
292
|
+
* @param predicate - The property to trace though
|
|
293
|
+
* @param inverse - Trace inverse direction
|
|
294
|
+
*/
|
|
295
|
+
transitiveClosure(seeds: BooleanMap, predicate: Quad_Predicate, inverse?: boolean): {
|
|
296
|
+
[uri: string]: boolean;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Finds the types in the list which have no *stored* supertypes
|
|
300
|
+
* We exclude the universal class, owl:Things and rdf:Resource, as it is
|
|
301
|
+
* information-free.
|
|
302
|
+
* @param types - The types
|
|
303
|
+
*/
|
|
304
|
+
topTypeURIs(types: {
|
|
305
|
+
[id: string]: string | RDFlibNamedNode;
|
|
306
|
+
}): {
|
|
307
|
+
[id: string]: string | RDFlibNamedNode;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Serializes this formula to a string
|
|
311
|
+
*/
|
|
312
|
+
toString(): string;
|
|
313
|
+
/**
|
|
314
|
+
* Gets a new variable
|
|
315
|
+
* @param name - The variable's name
|
|
316
|
+
*/
|
|
317
|
+
variable(name: string): Variable;
|
|
318
|
+
/**
|
|
319
|
+
* Gets the number of statements in this formula that matches the specified pattern
|
|
320
|
+
* @param s - The subject
|
|
321
|
+
* @param p - The predicate
|
|
322
|
+
* @param o - The object
|
|
323
|
+
* @param g - The graph that contains the statement
|
|
324
|
+
*/
|
|
325
|
+
whether(s?: Quad_Subject | null, p?: Quad_Predicate | null, o?: Quad_Object | null, g?: Quad_Graph | null): number;
|
|
326
|
+
}
|
|
327
|
+
export {};
|
package/lib/formula.js
CHANGED
|
File without changes
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import BlankNode from './blank-node';
|
|
2
|
+
import Collection from './collection';
|
|
3
|
+
import * as convert from './convert';
|
|
4
|
+
import Empty from './empty';
|
|
5
|
+
import Fetcher from './fetcher';
|
|
6
|
+
import Formula from './formula';
|
|
7
|
+
import Store from './store';
|
|
8
|
+
import jsonParser from './jsonparser';
|
|
9
|
+
import Literal from './literal';
|
|
10
|
+
import log from './log';
|
|
11
|
+
import N3Parser from './n3parser';
|
|
12
|
+
import NamedNode from './named-node';
|
|
13
|
+
import Namespace from './namespace';
|
|
14
|
+
import Node from './node';
|
|
15
|
+
import parse from './parse';
|
|
16
|
+
import { Query } from './query';
|
|
17
|
+
import queryToSPARQL from './query-to-sparql';
|
|
18
|
+
import RDFaProcessor from './rdfaparser';
|
|
19
|
+
import RDFParser from './rdfxmlparser';
|
|
20
|
+
import serialize from './serialize';
|
|
21
|
+
import Serializer from './serializer';
|
|
22
|
+
import SPARQLToQuery from './sparql-to-query';
|
|
23
|
+
import sparqlUpdateParser from './patch-parser';
|
|
24
|
+
import Statement from './statement';
|
|
25
|
+
import UpdateManager from './update-manager';
|
|
26
|
+
import { UpdatesSocket } from './updates-via';
|
|
27
|
+
import { UpdatesVia } from './updates-via';
|
|
28
|
+
import * as uri from './uri';
|
|
29
|
+
import * as Util from './utils-js';
|
|
30
|
+
import Variable from './variable';
|
|
31
|
+
import DataFactory from './factories/rdflib-data-factory';
|
|
32
|
+
declare const fetcher: (store: Store, options: any) => Fetcher, graph: (features?: any, opts?: any) => Store, lit: (val: string, lang?: string | undefined, dt?: import("./tf-types").NamedNode | undefined) => Literal, st: (subject: import("./tf-types").Quad_Subject, predicate: import("./tf-types").Quad_Predicate, object: import("./tf-types").Quad_Object, graph?: import("./tf-types").Quad_Graph | undefined) => Statement<import("./types").SubjectType, import("./types").PredicateType, import("./types").ObjectType, import("./types").GraphType>, namedNode: (value: string) => NamedNode, variable: (value: string) => Variable, blankNode: (value?: string | undefined) => BlankNode, defaultGraph: () => import("./default-graph").default, literal: (value: string, languageOrDatatype?: string | import("./tf-types").NamedNode | undefined) => Literal, quad: (subject: import("./tf-types").Term, predicate: import("./tf-types").Term, object: import("./tf-types").Term, graph?: import("./tf-types").Term | undefined) => Statement<import("./types").SubjectType, import("./types").PredicateType, import("./types").ObjectType, import("./types").GraphType>, triple: (subject: import("./tf-types").Term, predicate: import("./tf-types").Term, object: import("./tf-types").Term, graph?: import("./tf-types").Term | undefined) => import("./tf-types").Quad<any, any, any, any>;
|
|
33
|
+
declare const fromNT: (str: any) => any;
|
|
34
|
+
declare const term: <T extends import("./types").FromValueReturns<any>>(value: import("./types").ValueType) => T;
|
|
35
|
+
declare const NextId: number;
|
|
36
|
+
export * from './utils/terms';
|
|
37
|
+
export type { AutoInitOptions, ExtendedResponse, FetchError } from './fetcher';
|
|
38
|
+
export { BlankNode, Collection, convert, DataFactory, Empty, Fetcher, Formula, Store, jsonParser, Literal, log, N3Parser, NamedNode, Namespace, Node, parse, Query, queryToSPARQL, RDFaProcessor, RDFParser, serialize, Serializer, SPARQLToQuery, sparqlUpdateParser, Statement, term, UpdateManager, UpdatesSocket, UpdatesVia, uri, Util, Variable, Store as IndexedFormula, // Alias
|
|
39
|
+
NextId, fromNT, fetcher, graph, lit, st, namedNode as sym, blankNode, defaultGraph, literal, namedNode, quad, triple, variable, };
|
|
40
|
+
export { termValue } from './utils/termValue';
|
package/lib/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses json-ld formatted JS objects to a rdf Term.
|
|
3
|
+
* @param kb - The DataFactory to use.
|
|
4
|
+
* @param obj - The json-ld object to process.
|
|
5
|
+
* @return {Literal|NamedNode|BlankNode|Collection}
|
|
6
|
+
*/
|
|
7
|
+
export function jsonldObjectToTerm(kb: any, obj: any): any | any | any | any;
|
|
8
|
+
/**
|
|
9
|
+
* Takes a json-ld formatted string {str} and adds its statements to {kb}.
|
|
10
|
+
*
|
|
11
|
+
* Ensure that {kb.rdfFactory} is a DataFactory.
|
|
12
|
+
*/
|
|
13
|
+
export default function jsonldParser(str: any, kb: any, base: any, callback: any): Promise<any>;
|
package/lib/jsonldparser.js
CHANGED
|
File without changes
|
package/lib/jsonparser.js
CHANGED
|
File without changes
|
package/lib/literal.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import RDFlibNamedNode from './named-node';
|
|
2
|
+
import Node from './node-internal';
|
|
3
|
+
import { FromValueReturns, LiteralTermType, ValueType } from './types';
|
|
4
|
+
import { Literal as TFLiteral, Term } from './tf-types';
|
|
5
|
+
/**
|
|
6
|
+
* An RDF literal, containing some value which isn't expressed as an IRI.
|
|
7
|
+
* @link https://rdf.js.org/data-model-spec/#literal-interface
|
|
8
|
+
*/
|
|
9
|
+
export default class Literal extends Node implements TFLiteral {
|
|
10
|
+
termType: typeof LiteralTermType;
|
|
11
|
+
classOrder: number;
|
|
12
|
+
/**
|
|
13
|
+
* The literal's datatype as a named node
|
|
14
|
+
*/
|
|
15
|
+
datatype: RDFlibNamedNode;
|
|
16
|
+
isVar: number;
|
|
17
|
+
/**
|
|
18
|
+
* The language for the literal
|
|
19
|
+
*/
|
|
20
|
+
language: string;
|
|
21
|
+
/**
|
|
22
|
+
* Initializes a literal
|
|
23
|
+
* @param value - The literal's lexical value
|
|
24
|
+
* @param language - The language for the literal. Defaults to ''.
|
|
25
|
+
* @param datatype - The literal's datatype as a named node. Defaults to xsd:string.
|
|
26
|
+
*/
|
|
27
|
+
constructor(value: string, language?: string | null, datatype?: any);
|
|
28
|
+
/**
|
|
29
|
+
* Gets a copy of this literal
|
|
30
|
+
*/
|
|
31
|
+
copy(): Literal;
|
|
32
|
+
/**
|
|
33
|
+
* Gets whether two literals are the same
|
|
34
|
+
* @param other The other statement
|
|
35
|
+
*/
|
|
36
|
+
equals(other: Term): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The language for the literal
|
|
39
|
+
* @deprecated use {language} instead
|
|
40
|
+
*/
|
|
41
|
+
get lang(): string;
|
|
42
|
+
set lang(language: string);
|
|
43
|
+
toNT(): string;
|
|
44
|
+
/** Serializes a literal to an N-Triples string */
|
|
45
|
+
static toNT(literal: Literal): string;
|
|
46
|
+
toString(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Builds a literal node from a boolean value
|
|
49
|
+
* @param value - The value
|
|
50
|
+
*/
|
|
51
|
+
static fromBoolean(value: boolean): Literal;
|
|
52
|
+
/**
|
|
53
|
+
* Builds a literal node from a date value
|
|
54
|
+
* @param value The value
|
|
55
|
+
*/
|
|
56
|
+
static fromDate(value: Date): Literal;
|
|
57
|
+
/**
|
|
58
|
+
* Builds a literal node from a number value
|
|
59
|
+
* @param value - The value
|
|
60
|
+
*/
|
|
61
|
+
static fromNumber(value: number): Literal;
|
|
62
|
+
/**
|
|
63
|
+
* Builds a literal node from an input value
|
|
64
|
+
* @param value - The input value
|
|
65
|
+
*/
|
|
66
|
+
static fromValue<T extends FromValueReturns>(value: ValueType): T;
|
|
67
|
+
}
|
package/lib/literal.js
CHANGED
|
File without changes
|
package/lib/log.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default log;
|
|
2
|
+
declare namespace log {
|
|
3
|
+
function debug(x: any): void;
|
|
4
|
+
function debug(x: any): void;
|
|
5
|
+
function warn(x: any): void;
|
|
6
|
+
function warn(x: any): void;
|
|
7
|
+
function info(x: any): void;
|
|
8
|
+
function info(x: any): void;
|
|
9
|
+
function error(x: any): void;
|
|
10
|
+
function error(x: any): void;
|
|
11
|
+
function success(x: any): void;
|
|
12
|
+
function success(x: any): void;
|
|
13
|
+
function msg(x: any): void;
|
|
14
|
+
function msg(x: any): void;
|
|
15
|
+
}
|
package/lib/log.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export default createSinkParser;
|
|
2
|
+
export class SinkParser {
|
|
3
|
+
constructor(store: any, openFormula: any, thisDoc: any, baseURI: any, genPrefix: any, metaURI: any, flags: any, why: any);
|
|
4
|
+
_bindings: any;
|
|
5
|
+
_flags: any;
|
|
6
|
+
_store: any;
|
|
7
|
+
_thisDoc: any;
|
|
8
|
+
source: any;
|
|
9
|
+
lines: number;
|
|
10
|
+
statementCount: number;
|
|
11
|
+
startOfLine: number;
|
|
12
|
+
previousLine: number;
|
|
13
|
+
_genPrefix: any;
|
|
14
|
+
keywords: any;
|
|
15
|
+
keywordsSet: number;
|
|
16
|
+
_anonymousNodes: any;
|
|
17
|
+
_variables: any;
|
|
18
|
+
_parentVariables: any;
|
|
19
|
+
_reason: any;
|
|
20
|
+
_reason2: any;
|
|
21
|
+
_baseURI: any;
|
|
22
|
+
_formula: any;
|
|
23
|
+
_context: any;
|
|
24
|
+
_parentContext: any;
|
|
25
|
+
here(i: any): string;
|
|
26
|
+
formula(): any;
|
|
27
|
+
loadStream(stream: any): any;
|
|
28
|
+
loadBuf(buf: any): any;
|
|
29
|
+
feed(octets: any): void;
|
|
30
|
+
directiveOrStatement(str: any, h: any): any;
|
|
31
|
+
tok(tok: any, str: any, i: any): any;
|
|
32
|
+
directive(str: any, i: any): any;
|
|
33
|
+
bind(qn: any, uri: any): void;
|
|
34
|
+
setKeywords(k: any): void;
|
|
35
|
+
startDoc(): void;
|
|
36
|
+
endDoc(): any;
|
|
37
|
+
makeStatement(quad: any): void;
|
|
38
|
+
statement(str: any, i: any): any;
|
|
39
|
+
subject(str: any, i: any, res: any): any;
|
|
40
|
+
verb(str: any, i: any, res: any): any;
|
|
41
|
+
prop(str: any, i: any, res: any): any;
|
|
42
|
+
item(str: any, i: any, res: any): any;
|
|
43
|
+
blankNode(uri: any): any;
|
|
44
|
+
path(str: any, i: any, res: any): any;
|
|
45
|
+
anonymousNode(ln: any): any;
|
|
46
|
+
node(str: any, i: any, res: any, subjectAlready: any): any;
|
|
47
|
+
property_list(str: any, i: any, subj: any): any;
|
|
48
|
+
commaSeparatedList(str: any, j: any, res: any, ofUris: any): any;
|
|
49
|
+
objectList(str: any, i: any, res: any): any;
|
|
50
|
+
checkDot(str: any, i: any): any;
|
|
51
|
+
uri_ref2(str: any, i: any, res: any): any;
|
|
52
|
+
skipSpace(str: any, i: any): any;
|
|
53
|
+
variable(str: any, i: any, res: any): any;
|
|
54
|
+
bareWord(str: any, i: any, res: any): any;
|
|
55
|
+
qname(str: any, i: any, res: any): any;
|
|
56
|
+
object(str: any, i: any, res: any): any;
|
|
57
|
+
nodeOrLiteral(str: any, i: any, res: any): any;
|
|
58
|
+
strconst(str: any, i: any, delim: any): any;
|
|
59
|
+
uEscape(str: any, i: any, startline: any): any;
|
|
60
|
+
UEscape(str: any, i: any, startline: any): any;
|
|
61
|
+
}
|
|
62
|
+
declare function createSinkParser(store: any, openFormula: any, thisDoc: any, baseURI: any, genPrefix: any, metaURI: any, flags: any, why: any): SinkParser;
|