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
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import IndexedFormula from './store';
|
|
2
|
+
import Fetcher from './fetcher';
|
|
3
|
+
import Statement from './statement';
|
|
4
|
+
import RDFlibNamedNode from './named-node';
|
|
5
|
+
import { BlankNode, NamedNode, Quad_Subject, Quad, Term } from './tf-types';
|
|
6
|
+
interface UpdateManagerFormula extends IndexedFormula {
|
|
7
|
+
fetcher: Fetcher;
|
|
8
|
+
}
|
|
9
|
+
declare type CallBackFunction = (uri: string, ok: boolean, message: string, response: Error | Response) => {} | void;
|
|
10
|
+
/**
|
|
11
|
+
* The UpdateManager is a helper object for a store.
|
|
12
|
+
* Just as a Fetcher provides the store with the ability to read and write,
|
|
13
|
+
* the Update Manager provides functionality for making small patches in real time,
|
|
14
|
+
* and also looking out for concurrent updates from other agents
|
|
15
|
+
*/
|
|
16
|
+
export default class UpdateManager {
|
|
17
|
+
store: UpdateManagerFormula;
|
|
18
|
+
ifps: {};
|
|
19
|
+
fps: {};
|
|
20
|
+
/** Index of objects for coordinating incoming and outgoing patches */
|
|
21
|
+
patchControl: [];
|
|
22
|
+
/** Object of namespaces */
|
|
23
|
+
ns: any;
|
|
24
|
+
/**
|
|
25
|
+
* @param store - The quadstore to store data and metadata. Created if not passed.
|
|
26
|
+
*/
|
|
27
|
+
constructor(store?: IndexedFormula);
|
|
28
|
+
patchControlFor(doc: NamedNode): any;
|
|
29
|
+
isHttpUri(uri: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Tests whether a file is editable.
|
|
32
|
+
* If the file has a specific annotation that it is machine written,
|
|
33
|
+
* for safety, it is editable (this doesn't actually check for write access)
|
|
34
|
+
* If the file has wac-allow and accept patch headers, those are respected.
|
|
35
|
+
* and local write access is determined by those headers.
|
|
36
|
+
* This version only looks at past HTTP requests, does not make new ones.
|
|
37
|
+
*
|
|
38
|
+
* @returns The method string SPARQL or DAV or
|
|
39
|
+
* LOCALFILE or false if known, undefined if not known.
|
|
40
|
+
*/
|
|
41
|
+
editable(uri: string | NamedNode, kb?: IndexedFormula): string | boolean | undefined;
|
|
42
|
+
anonymize(obj: any): any;
|
|
43
|
+
anonymizeNT(stmt: Quad): string;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a list of all bnodes occurring in a statement
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
statementBnodes(st: Quad): BlankNode[];
|
|
49
|
+
/**
|
|
50
|
+
* Returns a list of all bnodes occurring in a list of statements
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
statementArrayBnodes(sts: Quad[]): BlankNode[];
|
|
54
|
+
/**
|
|
55
|
+
* Makes a cached list of [Inverse-]Functional properties
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
cacheIfps(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a context to bind a given node, up to a given depth
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
bnodeContext2(x: any, source: any, depth: any): any;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the smallest context to bind a given single bnode
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
bnodeContext1(x: any, source: any): any;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
mentioned(x: any): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
bnodeContext(bnodes: any, doc: any): never[];
|
|
77
|
+
/**
|
|
78
|
+
* Returns the best context for a single statement
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
statementContext(st: Quad): never[];
|
|
82
|
+
/**
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
contextWhere(context: any): string;
|
|
86
|
+
/**
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
fire(uri: string, query: string, callbackFunction: CallBackFunction): Promise<void>;
|
|
90
|
+
/** return a statemnet updating function
|
|
91
|
+
*
|
|
92
|
+
* This does NOT update the statement.
|
|
93
|
+
* It returns an object which includes
|
|
94
|
+
* function which can be used to change the object of the statement.
|
|
95
|
+
*/
|
|
96
|
+
update_statement(statement: Quad): {
|
|
97
|
+
statement: Term[] | undefined;
|
|
98
|
+
statementNT: string | undefined;
|
|
99
|
+
where: string;
|
|
100
|
+
set_object: (obj: any, callbackFunction: any) => void;
|
|
101
|
+
} | undefined;
|
|
102
|
+
insert_statement(st: Quad, callbackFunction: CallBackFunction): void;
|
|
103
|
+
delete_statement(st: Quad | Quad[], callbackFunction: CallBackFunction): void;
|
|
104
|
+
/**
|
|
105
|
+
* Requests a now or future action to refresh changes coming downstream
|
|
106
|
+
* This is designed to allow the system to re-request the server version,
|
|
107
|
+
* when a websocket has pinged to say there are changes.
|
|
108
|
+
* If the websocket, by contrast, has sent a patch, then this may not be necessary.
|
|
109
|
+
*
|
|
110
|
+
* @param doc
|
|
111
|
+
* @param action
|
|
112
|
+
*/
|
|
113
|
+
requestDownstreamAction(doc: NamedNode, action: any): void;
|
|
114
|
+
/**
|
|
115
|
+
* We want to start counting websocket notifications
|
|
116
|
+
* to distinguish the ones from others from our own.
|
|
117
|
+
*/
|
|
118
|
+
clearUpstreamCount(doc: NamedNode): void;
|
|
119
|
+
getUpdatesVia(doc: NamedNode): string | null;
|
|
120
|
+
addDownstreamChangeListener(doc: NamedNode, listener: any): void;
|
|
121
|
+
reloadAndSync(doc: NamedNode): void;
|
|
122
|
+
/**
|
|
123
|
+
* Sets up websocket to listen on
|
|
124
|
+
*
|
|
125
|
+
* There is coordination between upstream changes and downstream ones
|
|
126
|
+
* so that a reload is not done in the middle of an upstream patch.
|
|
127
|
+
* If you use this API then you get called when a change happens, and you
|
|
128
|
+
* have to reload the file yourself, and then refresh the UI.
|
|
129
|
+
* Alternative is addDownstreamChangeListener(), where you do not
|
|
130
|
+
* have to do the reload yourself. Do mot mix them.
|
|
131
|
+
*
|
|
132
|
+
* kb contains the HTTP metadata from previous operations
|
|
133
|
+
*
|
|
134
|
+
* @param doc
|
|
135
|
+
* @param handler
|
|
136
|
+
*
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
setRefreshHandler(doc: NamedNode, handler: any): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* This high-level function updates the local store iff the web is changed successfully.
|
|
142
|
+
* Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).
|
|
143
|
+
* The `why` property of each statement must be the give the web document to be updated.
|
|
144
|
+
* The statements to be deleted and inserted may span more than one web document.
|
|
145
|
+
* @param deletions - Statement or statements to be deleted.
|
|
146
|
+
* @param insertions - Statement or statements to be inserted.
|
|
147
|
+
* @returns a promise
|
|
148
|
+
*/
|
|
149
|
+
updateMany(deletions: ReadonlyArray<Statement>, insertions?: ReadonlyArray<Statement>): Promise<void[]>;
|
|
150
|
+
/**
|
|
151
|
+
* This high-level function updates the local store iff the web is changed successfully.
|
|
152
|
+
* Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).
|
|
153
|
+
* The `why` property of each statement must be the same and give the web document to be updated.
|
|
154
|
+
* @param deletions - Statement or statements to be deleted.
|
|
155
|
+
* @param insertions - Statement or statements to be inserted.
|
|
156
|
+
* @param callback - called as callbackFunction(uri, success, errorbody)
|
|
157
|
+
* OR returns a promise
|
|
158
|
+
*/
|
|
159
|
+
update(deletions: ReadonlyArray<Statement>, insertions: ReadonlyArray<Statement>, callback?: (uri: string | undefined | null, success: boolean, errorBody?: string, response?: Response | Error) => void, secondTry?: boolean): void | Promise<void>;
|
|
160
|
+
updateDav(doc: Quad_Subject, ds: any, is: any, callbackFunction: any): null | Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Likely deprecated, since this lib no longer deals with browser extension
|
|
163
|
+
*
|
|
164
|
+
* @param doc
|
|
165
|
+
* @param ds
|
|
166
|
+
* @param is
|
|
167
|
+
* @param callbackFunction
|
|
168
|
+
*/
|
|
169
|
+
updateLocalFile(doc: NamedNode, ds: any, is: any, callbackFunction: any): void;
|
|
170
|
+
/**
|
|
171
|
+
* @throws {Error} On unsupported content type
|
|
172
|
+
*
|
|
173
|
+
* @returns {string}
|
|
174
|
+
*/
|
|
175
|
+
serialize(uri: string, data: string | Quad[], contentType: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* This is suitable for an initial creation of a document.
|
|
178
|
+
*/
|
|
179
|
+
put(doc: RDFlibNamedNode, data: string | Quad[], contentType: string, callback: (uri: string, ok: boolean, errorMessage?: string, response?: unknown) => void): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Reloads a document.
|
|
182
|
+
*
|
|
183
|
+
* Fast and cheap, no metadata. Measure times for the document.
|
|
184
|
+
* Load it provisionally.
|
|
185
|
+
* Don't delete the statements before the load, or it will leave a broken
|
|
186
|
+
* document in the meantime.
|
|
187
|
+
*
|
|
188
|
+
* @param kb
|
|
189
|
+
* @param doc {RDFlibNamedNode}
|
|
190
|
+
* @param callbackFunction
|
|
191
|
+
*/
|
|
192
|
+
reload(kb: IndexedFormula, doc: docReloadType, callbackFunction: (ok: boolean, message?: string, response?: Error | Response) => {} | void): void;
|
|
193
|
+
}
|
|
194
|
+
interface docReloadType extends NamedNode {
|
|
195
|
+
reloadTimeCount?: number;
|
|
196
|
+
reloadTimeTotal?: number;
|
|
197
|
+
}
|
|
198
|
+
export {};
|
package/lib/update-manager.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class UpdatesSocket {
|
|
2
|
+
constructor(parent: any, via: any);
|
|
3
|
+
parent: any;
|
|
4
|
+
via: any;
|
|
5
|
+
connected: boolean;
|
|
6
|
+
pending: {};
|
|
7
|
+
subscribed: {};
|
|
8
|
+
socket: {};
|
|
9
|
+
_decode(q: any): {};
|
|
10
|
+
_send(method: any, uri: any, data: any): any;
|
|
11
|
+
_subscribe(uri: any): any;
|
|
12
|
+
onClose(e: any): {};
|
|
13
|
+
onError(e: any): void;
|
|
14
|
+
onMessage(e: any): any;
|
|
15
|
+
onOpen(e: any): any[];
|
|
16
|
+
subscribe(uri: any): any;
|
|
17
|
+
}
|
|
18
|
+
export class UpdatesVia {
|
|
19
|
+
constructor(fetcher: any);
|
|
20
|
+
fetcher: any;
|
|
21
|
+
graph: {};
|
|
22
|
+
via: {};
|
|
23
|
+
onHeaders(d: any): boolean;
|
|
24
|
+
onUpdate(uri: any, d: any): any;
|
|
25
|
+
register(via: any, uri: any): any;
|
|
26
|
+
}
|
package/lib/updates-via.js
CHANGED
|
File without changes
|
package/lib/uri.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import RDFlibNamedNode from './named-node';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the document part of an URI
|
|
4
|
+
* @param uri The URI
|
|
5
|
+
*/
|
|
6
|
+
export declare function docpart(uri: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the document part of an URI as a named node
|
|
9
|
+
* @param x - The URI
|
|
10
|
+
*/
|
|
11
|
+
export declare function document(x: string): RDFlibNamedNode;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the hostname in an URI
|
|
14
|
+
* @param u The URI
|
|
15
|
+
*/
|
|
16
|
+
export declare function hostpart(u: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Joins an URI with a base
|
|
19
|
+
* @param given - The relative part
|
|
20
|
+
* @param base - The base URI
|
|
21
|
+
*/
|
|
22
|
+
export declare function join(given: string, base: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the protocol part of an URI
|
|
25
|
+
* @param uri The URI
|
|
26
|
+
*/
|
|
27
|
+
export declare function protocol(uri: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Gets a relative uri
|
|
30
|
+
* @param base The base URI
|
|
31
|
+
* @param uri The absolute URI
|
|
32
|
+
*/
|
|
33
|
+
export declare function refTo(base: string, uri: string): string;
|
package/lib/uri.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/utils/termValue.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ObjectType } from '../types';
|
|
2
|
+
import Collection from '../collection';
|
|
3
|
+
import IndexedFormula from '../store';
|
|
4
|
+
import Statement from '../statement';
|
|
5
|
+
import { BlankNode, Quad_Graph, Literal, NamedNode, Quad_Object, Quad_Predicate, Quad, Quad_Subject, Term, Variable } from '../tf-types';
|
|
6
|
+
/** TypeGuard for RDFLib Statements */
|
|
7
|
+
export declare function isStatement(obj: any): obj is Statement;
|
|
8
|
+
/** TypeGuard for RDFlib Stores */
|
|
9
|
+
export declare function isStore(obj: any): obj is IndexedFormula;
|
|
10
|
+
/** TypeGuard for RDFLib Collections */
|
|
11
|
+
export declare function isCollection(obj: any): obj is Collection<any>;
|
|
12
|
+
/** TypeGuard for valid RDFlib Object types, also allows Collections */
|
|
13
|
+
export declare function isRDFlibObject(obj: any): obj is ObjectType;
|
|
14
|
+
/** TypeGuard for RDFLib Variables */
|
|
15
|
+
export declare function isVariable(obj: any): obj is Variable;
|
|
16
|
+
/** TypeGuard for RDF/JS spec Terms */
|
|
17
|
+
export declare function isTerm(obj: any): obj is Term;
|
|
18
|
+
/** TypeGuard for RDF/JS spec Literals */
|
|
19
|
+
export declare function isLiteral(value: any): value is Literal;
|
|
20
|
+
/** TypeGuard for RDF/JS spec Quads */
|
|
21
|
+
export declare function isQuad(obj: any): obj is Quad<any, any, any, any>;
|
|
22
|
+
/** TypeGuard for RDF/JS spec NamedNodes */
|
|
23
|
+
export declare function isNamedNode(obj: any): obj is NamedNode;
|
|
24
|
+
/** TypeGuard for RDF/JS spec BlankNodes */
|
|
25
|
+
export declare function isBlankNode(obj: any): obj is BlankNode;
|
|
26
|
+
/** TypeGuard for valid RDF/JS spec Subject types */
|
|
27
|
+
export declare function isSubject(obj: any): obj is Quad_Subject;
|
|
28
|
+
/** TypeGuard for valid RDF/JS spec Predicate types */
|
|
29
|
+
export declare function isPredicate(obj: any): obj is Quad_Predicate;
|
|
30
|
+
/** TypeGuard for valid RDF/JS spec Object types */
|
|
31
|
+
export declare function isRDFObject(obj: any): obj is Quad_Object;
|
|
32
|
+
/** TypeGuard for valid RDF/JS Graph types */
|
|
33
|
+
export declare function isGraph(obj: any): obj is Quad_Graph;
|
package/lib/utils/terms.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function mediaTypeClass(mediaType: any): NamedNode;
|
|
2
|
+
export function linkRelationProperty(relation: any): NamedNode;
|
|
3
|
+
/**
|
|
4
|
+
* Adds callback functionality to an object.
|
|
5
|
+
* Callback functions are indexed by a 'hook' string.
|
|
6
|
+
* They return true if they want to be called again.
|
|
7
|
+
* @method callbackify
|
|
8
|
+
* @param obj {Object}
|
|
9
|
+
* @param callbacks {Array<string>}
|
|
10
|
+
*/
|
|
11
|
+
export function callbackify(obj: any, callbacks: Array<string>): void;
|
|
12
|
+
/**
|
|
13
|
+
* Returns a DOM parser based on current runtime environment.
|
|
14
|
+
*/
|
|
15
|
+
export function DOMParserFactory(): any;
|
|
16
|
+
export function domToString(node: any, options: any): string;
|
|
17
|
+
export function dumpNode(node: any, options: any, selfClosing: any, skipAttributes: any): string;
|
|
18
|
+
export function dtstamp(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Compares statements (heavy comparison for repeatable canonical ordering)
|
|
21
|
+
*/
|
|
22
|
+
export function heavyCompare(x: any, y: any, g: any, uriMap: any): any;
|
|
23
|
+
export function heavyCompareSPO(x: any, y: any, g: any, uriMap: any): any;
|
|
24
|
+
/**
|
|
25
|
+
* Defines a simple debugging function
|
|
26
|
+
* @method output
|
|
27
|
+
* @param o {String}
|
|
28
|
+
*/
|
|
29
|
+
export function output(o: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a DOM from parsex XML.
|
|
32
|
+
*/
|
|
33
|
+
export function parseXML(str: any, options: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* Removes all statements equal to x from a
|
|
36
|
+
*/
|
|
37
|
+
export function RDFArrayRemove(a: any, x: any): void;
|
|
38
|
+
export function string_startswith(str: any, pref: any): boolean;
|
|
39
|
+
export function stackString(e: any): string;
|
|
40
|
+
import NamedNode from "./named-node";
|
|
41
|
+
import log from "./log";
|
|
42
|
+
import * as uri from "./uri";
|
|
43
|
+
export namespace string {
|
|
44
|
+
export { stringTemplate as template };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* C++, python style %s -> subs
|
|
48
|
+
*/
|
|
49
|
+
declare function stringTemplate(base: any, subs: any): string;
|
|
50
|
+
export { log, uri };
|
package/lib/utils-js.js
CHANGED
|
File without changes
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Fetcher from './fetcher';
|
|
2
|
+
import { RdfJsDataFactory, Quad, Quad_Subject, Term } from './tf-types';
|
|
3
|
+
/** RDF/JS spec Typeguards */
|
|
4
|
+
/**
|
|
5
|
+
* Loads ontologies of the data we load (this is the callback from the kb to
|
|
6
|
+
* the fetcher).
|
|
7
|
+
*/
|
|
8
|
+
export declare function AJAR_handleNewTerm(kb: {
|
|
9
|
+
fetcher: Fetcher;
|
|
10
|
+
}, p: any, requestedBy: any): any;
|
|
11
|
+
export declare const appliedFactoryMethods: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Expands an array of Terms to a set of statements representing the rdf:list.
|
|
14
|
+
* @param rdfFactory - The factory to use
|
|
15
|
+
* @param subject - The iri of the first list item.
|
|
16
|
+
* @param data - The terms to expand into the list.
|
|
17
|
+
* @return The {data} as a set of statements.
|
|
18
|
+
*/
|
|
19
|
+
export declare function arrayToStatements(rdfFactory: RdfJsDataFactory, subject: Quad_Subject, data: Term[]): Quad[];
|
|
20
|
+
export declare function ArrayIndexOf(arr: any, item: any, i?: number): number;
|
package/lib/utils.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Node from './node-internal';
|
|
2
|
+
import { VariableTermType } from './types';
|
|
3
|
+
import { Variable as TFVariable } from './tf-types';
|
|
4
|
+
/**
|
|
5
|
+
* Variables are placeholders used in patterns to be matched.
|
|
6
|
+
* In cwm they are symbols which are the formula's list of quantified variables.
|
|
7
|
+
* In sparql they are not visibly URIs. Here we compromise, by having
|
|
8
|
+
* a common special base URI for variables. Their names are uris,
|
|
9
|
+
* but the ? notation has an implicit base uri of 'varid:'
|
|
10
|
+
*/
|
|
11
|
+
export default class Variable extends Node implements TFVariable {
|
|
12
|
+
termType: typeof VariableTermType;
|
|
13
|
+
/** The base string for a variable's name */
|
|
14
|
+
base: string;
|
|
15
|
+
classOrder: number;
|
|
16
|
+
isVar: number;
|
|
17
|
+
/** The unique identifier of this variable */
|
|
18
|
+
uri: string;
|
|
19
|
+
/**
|
|
20
|
+
* Initializes this variable
|
|
21
|
+
* @param name The variable's name
|
|
22
|
+
*/
|
|
23
|
+
constructor(name?: string);
|
|
24
|
+
equals(other: any): boolean;
|
|
25
|
+
hashString(): string;
|
|
26
|
+
substitute(bindings: any): any;
|
|
27
|
+
toString(): string;
|
|
28
|
+
static toString(variable: any): string;
|
|
29
|
+
}
|
package/lib/variable.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const boolean: NamedNode;
|
|
3
|
+
const dateTime: NamedNode;
|
|
4
|
+
const decimal: NamedNode;
|
|
5
|
+
const double: NamedNode;
|
|
6
|
+
const integer: NamedNode;
|
|
7
|
+
const langString: NamedNode;
|
|
8
|
+
const string: NamedNode;
|
|
9
|
+
}
|
|
10
|
+
export default _default;
|
|
11
|
+
import NamedNode from "./named-node";
|
package/lib/xsd-internal.js
CHANGED
|
File without changes
|
package/lib/xsd.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function createXSD(localFactory?: import("./factories/factory-types").DataFactory<import("./factories/factory-types").DefaultFactoryTypes, import("./factories/factory-types").Indexable>): {
|
|
2
|
+
boolean: import("./named-node").default;
|
|
3
|
+
dateTime: import("./named-node").default;
|
|
4
|
+
decimal: import("./named-node").default;
|
|
5
|
+
double: import("./named-node").default;
|
|
6
|
+
integer: import("./named-node").default;
|
|
7
|
+
langString: import("./named-node").default;
|
|
8
|
+
string: import("./named-node").default;
|
|
9
|
+
};
|
|
10
|
+
export default defaultXSD;
|
|
11
|
+
declare namespace defaultXSD {
|
|
12
|
+
const boolean: import("./named-node").default;
|
|
13
|
+
const dateTime: import("./named-node").default;
|
|
14
|
+
const decimal: import("./named-node").default;
|
|
15
|
+
const double: import("./named-node").default;
|
|
16
|
+
const integer: import("./named-node").default;
|
|
17
|
+
const langString: import("./named-node").default;
|
|
18
|
+
const string: import("./named-node").default;
|
|
19
|
+
}
|
package/lib/xsd.js
CHANGED
|
@@ -8,25 +8,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.createXSD = createXSD;
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
|
|
13
11
|
var _canonicalDataFactory = _interopRequireDefault(require("./factories/canonical-data-factory"));
|
|
14
12
|
|
|
15
13
|
function createXSD() {
|
|
16
14
|
var localFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _canonicalDataFactory.default;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
return {
|
|
16
|
+
boolean: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
|
|
17
|
+
dateTime: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
18
|
+
decimal: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),
|
|
19
|
+
double: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#double"),
|
|
20
|
+
integer: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer"),
|
|
21
|
+
langString: localFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),
|
|
22
|
+
string: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#string")
|
|
20
23
|
};
|
|
21
|
-
|
|
22
|
-
XSD.boolean = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#boolean');
|
|
23
|
-
XSD.dateTime = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#dateTime');
|
|
24
|
-
XSD.decimal = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#decimal');
|
|
25
|
-
XSD.double = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#double');
|
|
26
|
-
XSD.integer = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#integer');
|
|
27
|
-
XSD.langString = localFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString');
|
|
28
|
-
XSD.string = localFactory.namedNode('http://www.w3.org/2001/XMLSchema#string');
|
|
29
|
-
return XSD;
|
|
30
24
|
}
|
|
31
25
|
|
|
32
26
|
var defaultXSD = createXSD(_canonicalDataFactory.default);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdflib",
|
|
3
3
|
"description": "an RDF library for node.js. Suitable for client and server side.",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.12-5f141ca2",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=6.0"
|
|
7
7
|
},
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
"build": "babel src --extensions \".ts,.js\" -d lib",
|
|
93
93
|
"build:esm": "babel src --extensions \".ts,.js\" --env-name esm -d esm",
|
|
94
94
|
"build:browser": "webpack --progress",
|
|
95
|
-
"build:types": "tsc --emitDeclarationOnly -d --moduleResolution node --declarationDir lib
|
|
95
|
+
"build:types": "tsc --emitDeclarationOnly -d --moduleResolution node --declarationDir lib",
|
|
96
96
|
"doc": "typedoc --out ./doc ./src/index.ts --excludePrivate --excludeInternal --tsconfig ./tsconfig.json",
|
|
97
|
-
"prepublishOnly": "npm ci && npm run build && npm run build:types && npm run build:browser && npm run build:esm",
|
|
97
|
+
"ignore:prepublishOnly": "npm ci && npm run build && npm run build:types && npm run build:browser && npm run build:esm",
|
|
98
98
|
"postversion": "git push --follow-tags",
|
|
99
99
|
"start": "webpack-dev-server --https --port 4800",
|
|
100
100
|
"test": "npm run test:unit && npm run test:serialize && npm run test:types",
|
package/src/blank-node.ts
CHANGED
|
File without changes
|
package/src/class-order.ts
CHANGED
|
File without changes
|
package/src/collection.ts
CHANGED
|
File without changes
|
package/src/convert.js
CHANGED
|
File without changes
|
package/src/default-graph.ts
CHANGED
|
File without changes
|
package/src/empty.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/fetcher.ts
CHANGED
|
@@ -115,8 +115,10 @@ declare global {
|
|
|
115
115
|
interface Window {
|
|
116
116
|
panes?: any
|
|
117
117
|
solidFetcher?: any
|
|
118
|
+
solidFetch?: any
|
|
118
119
|
}
|
|
119
|
-
var solidFetcher:Function
|
|
120
|
+
var solidFetcher: Function
|
|
121
|
+
var solidFetch: Function
|
|
120
122
|
}
|
|
121
123
|
declare var $SolidTestEnvironment: {
|
|
122
124
|
localSiteMap?: any
|
|
@@ -754,9 +756,10 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
754
756
|
this.ns = getNS(this.store.rdfFactory)
|
|
755
757
|
this.timeout = options.timeout || 30000
|
|
756
758
|
|
|
759
|
+
// solidFetcher is deprecated
|
|
757
760
|
this._fetch = options.fetch
|
|
758
|
-
|| (typeof global !== 'undefined' && global.solidFetcher)
|
|
759
|
-
|| (typeof window !== 'undefined' && window.solidFetcher)
|
|
761
|
+
|| (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))
|
|
762
|
+
|| (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))
|
|
760
763
|
|| crossFetch
|
|
761
764
|
if (!this._fetch) {
|
|
762
765
|
throw new Error('No _fetch function available for Fetcher')
|
package/src/formula.ts
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
File without changes
|
package/src/jsonldparser.js
CHANGED
|
File without changes
|
package/src/jsonparser.js
CHANGED
|
File without changes
|
package/src/literal.ts
CHANGED
|
File without changes
|
package/src/log.js
CHANGED
|
File without changes
|