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.
Files changed (190) hide show
  1. package/.babelrc +0 -0
  2. package/README.md +1 -0
  3. package/changes.txt +0 -0
  4. package/dist/rdflib.min.js +62 -0
  5. package/dist/rdflib.min.js.map +1 -0
  6. package/esm/blank-node.js +137 -0
  7. package/esm/class-order.js +12 -0
  8. package/esm/collection.js +173 -0
  9. package/esm/convert.js +61 -0
  10. package/esm/default-graph.js +57 -0
  11. package/esm/empty.js +46 -0
  12. package/esm/factories/canonical-data-factory.js +204 -0
  13. package/esm/factories/extended-term-factory.js +55 -0
  14. package/esm/factories/factory-types.js +18 -0
  15. package/esm/factories/rdflib-data-factory.js +55 -0
  16. package/esm/fetcher.js +2180 -0
  17. package/esm/formula.js +987 -0
  18. package/esm/index.js +64 -0
  19. package/esm/jsonldparser.js +122 -0
  20. package/esm/jsonparser.js +60 -0
  21. package/esm/literal.js +236 -0
  22. package/esm/log.js +13 -0
  23. package/esm/n3parser.js +1854 -0
  24. package/esm/named-node.js +154 -0
  25. package/esm/namespace.js +17 -0
  26. package/esm/node-internal.js +151 -0
  27. package/esm/node.js +46 -0
  28. package/esm/parse.js +138 -0
  29. package/esm/patch-parser.js +110 -0
  30. package/esm/query-to-sparql.js +83 -0
  31. package/esm/query.js +620 -0
  32. package/esm/rdfaparser.js +1197 -0
  33. package/esm/rdfxmlparser.js +588 -0
  34. package/esm/serialize.js +95 -0
  35. package/esm/serializer.js +1162 -0
  36. package/esm/sparql-to-query.js +566 -0
  37. package/esm/statement.js +128 -0
  38. package/esm/store.js +1306 -0
  39. package/esm/tf-types.js +1 -0
  40. package/esm/types.js +25 -0
  41. package/esm/update-manager.js +1252 -0
  42. package/esm/updates-via.js +197 -0
  43. package/esm/uri.js +245 -0
  44. package/esm/utils/default-graph-uri.js +4 -0
  45. package/esm/utils/termValue.js +8 -0
  46. package/esm/utils/terms.js +72 -0
  47. package/esm/utils-js.js +348 -0
  48. package/esm/utils.js +103 -0
  49. package/esm/variable.js +101 -0
  50. package/esm/xsd-internal.js +10 -0
  51. package/esm/xsd.js +15 -0
  52. package/lib/blank-node.d.ts +44 -0
  53. package/lib/blank-node.js +0 -0
  54. package/lib/class-order.d.ts +7 -0
  55. package/lib/class-order.js +0 -0
  56. package/lib/collection.d.ts +65 -0
  57. package/lib/collection.js +0 -0
  58. package/lib/convert.d.ts +2 -0
  59. package/lib/convert.js +0 -0
  60. package/lib/default-graph.d.ts +13 -0
  61. package/lib/default-graph.js +0 -0
  62. package/lib/empty.d.ts +11 -0
  63. package/lib/empty.js +0 -0
  64. package/lib/factories/canonical-data-factory.d.ts +6 -0
  65. package/lib/factories/canonical-data-factory.js +0 -0
  66. package/lib/factories/extended-term-factory.d.ts +13 -0
  67. package/lib/factories/extended-term-factory.js +0 -0
  68. package/lib/factories/factory-types.d.ts +67 -0
  69. package/lib/factories/factory-types.js +0 -0
  70. package/lib/factories/rdflib-data-factory.d.ts +4 -0
  71. package/lib/factories/rdflib-data-factory.js +0 -0
  72. package/lib/fetcher.d.ts +443 -0
  73. package/lib/fetcher.js +3 -2
  74. package/lib/formula.d.ts +327 -0
  75. package/lib/formula.js +0 -0
  76. package/lib/index.d.ts +40 -0
  77. package/lib/index.js +0 -0
  78. package/lib/jsonldparser.d.ts +13 -0
  79. package/lib/jsonldparser.js +0 -0
  80. package/lib/jsonparser.d.ts +4 -0
  81. package/lib/jsonparser.js +0 -0
  82. package/lib/literal.d.ts +67 -0
  83. package/lib/literal.js +0 -0
  84. package/lib/log.d.ts +15 -0
  85. package/lib/log.js +0 -0
  86. package/lib/n3parser.d.ts +62 -0
  87. package/lib/n3parser.js +1334 -1289
  88. package/lib/named-node.d.ts +44 -0
  89. package/lib/named-node.js +0 -0
  90. package/lib/namespace.d.ts +7 -0
  91. package/lib/namespace.js +0 -0
  92. package/lib/node-internal.d.ts +63 -0
  93. package/lib/node-internal.js +0 -0
  94. package/lib/node.d.ts +2 -0
  95. package/lib/node.js +0 -0
  96. package/lib/parse.d.ts +16 -0
  97. package/lib/parse.js +0 -0
  98. package/lib/patch-parser.d.ts +3 -0
  99. package/lib/patch-parser.js +0 -0
  100. package/lib/query-to-sparql.d.ts +1 -0
  101. package/lib/query-to-sparql.js +0 -0
  102. package/lib/query.d.ts +27 -0
  103. package/lib/query.js +0 -0
  104. package/lib/rdfaparser.d.ts +78 -0
  105. package/lib/rdfaparser.js +0 -0
  106. package/lib/rdfxmlparser.d.ts +60 -0
  107. package/lib/rdfxmlparser.js +430 -413
  108. package/lib/serialize.d.ts +23 -0
  109. package/lib/serialize.js +1 -1
  110. package/lib/serializer.d.ts +54 -0
  111. package/lib/serializer.js +851 -824
  112. package/lib/sparql-to-query.d.ts +6 -0
  113. package/lib/sparql-to-query.js +0 -0
  114. package/lib/statement.d.ts +55 -0
  115. package/lib/statement.js +0 -0
  116. package/lib/store.d.ts +302 -0
  117. package/lib/store.js +0 -0
  118. package/lib/tf-types.d.ts +151 -0
  119. package/lib/tf-types.js +0 -0
  120. package/lib/types.d.ts +68 -0
  121. package/lib/types.js +0 -0
  122. package/lib/update-manager.d.ts +198 -0
  123. package/lib/update-manager.js +0 -0
  124. package/lib/updates-via.d.ts +26 -0
  125. package/lib/updates-via.js +0 -0
  126. package/lib/uri.d.ts +33 -0
  127. package/lib/uri.js +0 -0
  128. package/lib/utils/default-graph-uri.d.ts +3 -0
  129. package/lib/utils/default-graph-uri.js +0 -0
  130. package/lib/utils/termValue.d.ts +3 -0
  131. package/lib/utils/termValue.js +0 -0
  132. package/lib/utils/terms.d.ts +33 -0
  133. package/lib/utils/terms.js +0 -0
  134. package/lib/utils-js.d.ts +50 -0
  135. package/lib/utils-js.js +0 -0
  136. package/lib/utils.d.ts +20 -0
  137. package/lib/utils.js +0 -0
  138. package/lib/variable.d.ts +29 -0
  139. package/lib/variable.js +0 -0
  140. package/lib/xsd-internal.d.ts +11 -0
  141. package/lib/xsd-internal.js +0 -0
  142. package/lib/xsd.d.ts +19 -0
  143. package/lib/xsd.js +8 -14
  144. package/package.json +3 -3
  145. package/src/blank-node.ts +0 -0
  146. package/src/class-order.ts +0 -0
  147. package/src/collection.ts +0 -0
  148. package/src/convert.js +0 -0
  149. package/src/default-graph.ts +0 -0
  150. package/src/empty.ts +0 -0
  151. package/src/factories/canonical-data-factory.ts +0 -0
  152. package/src/factories/extended-term-factory.ts +0 -0
  153. package/src/factories/factory-types.ts +0 -0
  154. package/src/factories/rdflib-data-factory.ts +0 -0
  155. package/src/fetcher.ts +6 -3
  156. package/src/formula.ts +0 -0
  157. package/src/index.ts +0 -0
  158. package/src/jsonldparser.js +0 -0
  159. package/src/jsonparser.js +0 -0
  160. package/src/literal.ts +0 -0
  161. package/src/log.js +0 -0
  162. package/src/n3parser.js +1114 -1110
  163. package/src/named-node.ts +0 -0
  164. package/src/namespace.ts +0 -0
  165. package/src/node-internal.ts +0 -0
  166. package/src/node.ts +0 -0
  167. package/src/parse.ts +0 -0
  168. package/src/patch-parser.js +0 -0
  169. package/src/query-to-sparql.js +0 -0
  170. package/src/query.js +0 -0
  171. package/src/rdfaparser.js +0 -0
  172. package/src/rdfxmlparser.js +22 -21
  173. package/src/serialize.ts +3 -3
  174. package/src/serializer.js +74 -62
  175. package/src/sparql-to-query.js +0 -0
  176. package/src/statement.ts +0 -0
  177. package/src/store.ts +0 -0
  178. package/src/tf-types.ts +0 -0
  179. package/src/types.ts +0 -0
  180. package/src/update-manager.ts +0 -0
  181. package/src/updates-via.js +0 -0
  182. package/src/uri.ts +0 -0
  183. package/src/utils/default-graph-uri.ts +0 -0
  184. package/src/utils/termValue.ts +0 -0
  185. package/src/utils/terms.ts +0 -0
  186. package/src/utils-js.js +0 -0
  187. package/src/utils.ts +0 -0
  188. package/src/variable.ts +0 -0
  189. package/src/xsd-internal.js +0 -0
  190. package/src/xsd.js +16 -14
@@ -0,0 +1,44 @@
1
+ import Node from './node-internal';
2
+ import { NamedNodeTermType } from './types';
3
+ import { NamedNode as TFNamedNode } from './tf-types';
4
+ /**
5
+ * A named (IRI) RDF node
6
+ */
7
+ export default class NamedNode extends Node implements TFNamedNode {
8
+ termType: typeof NamedNodeTermType;
9
+ classOrder: number;
10
+ /**
11
+ * Create a named (IRI) RDF Node
12
+ * @constructor
13
+ * @param iri - The IRI for this node
14
+ */
15
+ constructor(iri: string);
16
+ /**
17
+ * Returns an $rdf node for the containing directory, ending in slash.
18
+ */
19
+ dir(): NamedNode | null;
20
+ /**
21
+ * Returns an NN for the whole web site, ending in slash.
22
+ * Contrast with the "origin" which does NOT have a trailing slash
23
+ */
24
+ site(): NamedNode;
25
+ /**
26
+ * Creates the fetchable named node for the document.
27
+ * Removes everything from the # anchor tag.
28
+ */
29
+ doc(): NamedNode;
30
+ /**
31
+ * Returns the URI including <brackets>
32
+ */
33
+ toString(): string;
34
+ /** The local identifier with the document */
35
+ id(): string;
36
+ /** Alias for value, favored by Tim */
37
+ get uri(): string;
38
+ set uri(uri: string);
39
+ /**
40
+ * Creates a named node from the specified input value
41
+ * @param value - An input value
42
+ */
43
+ static fromValue(value: any): any;
44
+ }
package/lib/named-node.js CHANGED
File without changes
@@ -0,0 +1,7 @@
1
+ import { RdfJsDataFactory, NamedNode } from './tf-types';
2
+ /**
3
+ * Gets a namespace for the specified namespace's URI
4
+ * @param nsuri - The URI for the namespace
5
+ * @param [factory] - The factory for creating named nodes with
6
+ */
7
+ export default function Namespace(nsuri: string, factory?: RdfJsDataFactory): (ln: string) => NamedNode;
package/lib/namespace.js CHANGED
File without changes
@@ -0,0 +1,63 @@
1
+ import { ValueType, Bindings, FromValueReturns, TermType } from './types';
2
+ import { Term } from './tf-types';
3
+ /**
4
+ * The superclass of all RDF Statement objects, that is
5
+ * NamedNode, Literal, BlankNode, etc.
6
+ * Should not be instantiated directly.
7
+ * Also called Term.
8
+ * @link https://rdf.js.org/data-model-spec/#term-interface
9
+ * @class Node
10
+ */
11
+ export default abstract class Node {
12
+ static fromValue: <T extends FromValueReturns>(value: ValueType) => T;
13
+ static toJS: (term: any) => Date | Number | string | boolean | object | Array<Date | Number | string | boolean | object>;
14
+ /** The type of node */
15
+ termType: TermType;
16
+ /** The class order for this node */
17
+ classOrder: number;
18
+ /** The node's value */
19
+ value: string;
20
+ protected constructor(value: string);
21
+ /**
22
+ * Creates the substituted node for this one, according to the specified bindings
23
+ * @param bindings - Bindings of identifiers to nodes
24
+ */
25
+ substitute<T extends Node = Node>(bindings: Bindings): T;
26
+ /**
27
+ * Compares this node with another
28
+ * @see {equals} to check if two nodes are equal
29
+ * @param other - The other node
30
+ */
31
+ compareTerm(other: Node): number;
32
+ /**
33
+ * Compares whether the two nodes are equal
34
+ * @param other The other node
35
+ */
36
+ equals(other: Term): boolean;
37
+ /**
38
+ * Creates a hash for this node
39
+ * @deprecated use {rdfFactory.id} instead if possible
40
+ */
41
+ hashString(): string;
42
+ /**
43
+ * Compares whether this node is the same as the other one
44
+ * @param other - Another node
45
+ */
46
+ sameTerm(other: Node): boolean;
47
+ /**
48
+ * Creates a canonical string representation of this node
49
+ */
50
+ toCanonical(): string;
51
+ /**
52
+ * Creates a n-triples string representation of this node
53
+ */
54
+ toNT(): string;
55
+ /**
56
+ * Creates a n-quads string representation of this node
57
+ */
58
+ toNQ(): string;
59
+ /**
60
+ * Creates a string representation of this node
61
+ */
62
+ toString(): string;
63
+ }
File without changes
package/lib/node.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import Node from './node-internal';
2
+ export default Node;
package/lib/node.js CHANGED
File without changes
package/lib/parse.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import Formula from './formula';
2
+ import { ContentType } from './types';
3
+ declare type CallbackFunc = (error: any, kb: Formula | null) => void;
4
+ /**
5
+ * Parse a string and put the result into the graph kb.
6
+ * Normal method is sync.
7
+ * Unfortunately jsdonld is currently written to need to be called async.
8
+ * Hence the mess below with executeCallback.
9
+ * @param str - The input string to parse
10
+ * @param kb - The store to use
11
+ * @param base - The base URI to use
12
+ * @param contentType - The MIME content type string for the input - defaults to text/turtle
13
+ * @param [callback] - The callback to call when the data has been loaded
14
+ */
15
+ export default function parse(str: string, kb: Formula, base: string, contentType?: string | ContentType, callback?: CallbackFunc): void;
16
+ export {};
package/lib/parse.js CHANGED
File without changes
@@ -0,0 +1,3 @@
1
+ export default function sparqlUpdateParser(str: any, kb: any, base: any): {
2
+ query: any;
3
+ };
File without changes
@@ -0,0 +1 @@
1
+ export default function queryToSPARQL(query: any): string;
File without changes
package/lib/query.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This function will match a pattern to the current Store
3
+ *
4
+ * The callback function is called whenever a match is found
5
+ * When fetcher is supplied this will be called to load from the web
6
+ * any new nodes as they are discovered. This will cause the query to traverse the
7
+ * graph of linked data, sometimes called "Link Following Query"
8
+ *
9
+ * @param myQuery - a knowledgebase containing a pattern to use as query
10
+ * @param callback - whenever the pattern in myQuery is met this is called with
11
+ * the new bindings as parameter
12
+ * @param fetcher? - If and only if, you want link following, give a fetcher
13
+ * which has been created for the quadstore being queried.
14
+ * @param onDone - callback when query finished
15
+ */
16
+ export function indexedFormulaQuery(myQuery: any, callback: any, fetcher: any, onDone: any): void;
17
+ /**
18
+ * Query class, for tracking queries the user has in the UI.
19
+ */
20
+ export class Query {
21
+ constructor(name: any, id: any);
22
+ pat: IndexedFormula;
23
+ vars: any[];
24
+ name: any;
25
+ id: any;
26
+ }
27
+ import IndexedFormula from "./store";
package/lib/query.js CHANGED
File without changes
@@ -0,0 +1,78 @@
1
+ declare class RDFaProcessor {
2
+ static parseRDFaDOM(dom: any, kb: any, base: any): void;
3
+ static tokenize(str: any): any;
4
+ static trim(str: any): any;
5
+ constructor(kb: any, options: any);
6
+ options: any;
7
+ kb: any;
8
+ target: any;
9
+ blankNodes: any[];
10
+ htmlOptions: {
11
+ selfClosing: string;
12
+ };
13
+ theOne: string;
14
+ language: any;
15
+ vocabulary: any;
16
+ blankCounter: number;
17
+ langAttributes: {
18
+ namespaceURI: string;
19
+ localName: string;
20
+ }[];
21
+ inXHTMLMode: boolean;
22
+ absURIRE: RegExp;
23
+ finishedHandlers: any[];
24
+ addTriple(origin: any, subject: any, predicate: any, object: any): void;
25
+ ancestorPath(node: any): string;
26
+ copyMappings(mappings: any): {};
27
+ copyProperties(): void;
28
+ deriveDateTimeType(value: any): string | null;
29
+ init(): void;
30
+ newBlankNode(): string;
31
+ newSubjectOrigin(origin: any, subject: any): void;
32
+ parseCURIE(value: any, prefixes: any, base: any): any;
33
+ parseCURIEOrURI(value: any, prefixes: any, base: any): any;
34
+ parsePredicate(value: any, defaultVocabulary: any, terms: any, prefixes: any, base: any, ignoreTerms: any): any;
35
+ parsePrefixMappings(str: any, target: any): void;
36
+ parseSafeCURIEOrCURIEOrURI(value: any, prefixes: any, base: any): any;
37
+ parseTermOrCURIEOrAbsURI(value: any, defaultVocabulary: any, terms: any, prefixes: any, base: any): any;
38
+ parseTermOrCURIEOrURI(value: any, defaultVocabulary: any, terms: any, prefixes: any, base: any): any;
39
+ parseURI(uri: any): any;
40
+ process(node: any, options: any): void;
41
+ push(parent: any, subject: any): {
42
+ parent: any;
43
+ subject: any;
44
+ parentObject: null;
45
+ incomplete: never[];
46
+ listMapping: any;
47
+ language: any;
48
+ prefixes: any;
49
+ terms: any;
50
+ vocabulary: any;
51
+ };
52
+ resolveAndNormalize(base: any, uri: any): string;
53
+ setContext(node: any): void;
54
+ setHTMLContext(): void;
55
+ inHTMLMode: boolean | undefined;
56
+ setInitialContext(): void;
57
+ setXHTMLContext(): void;
58
+ setXMLContext(): void;
59
+ tokenize(str: any): any;
60
+ toRDFNodeObject(x: any): any;
61
+ trim(str: any): any;
62
+ }
63
+ declare namespace RDFaProcessor {
64
+ const XMLLiteralURI: string;
65
+ const HTMLLiteralURI: string;
66
+ const PlainLiteralURI: string;
67
+ const objectURI: string;
68
+ const typeURI: string;
69
+ const nameChar: string;
70
+ const nameStartChar: string;
71
+ const NCNAME: RegExp;
72
+ const dateTimeTypes: {
73
+ pattern: RegExp;
74
+ type: string;
75
+ }[];
76
+ }
77
+ export default RDFaProcessor;
78
+ export function parseRDFaDOM(dom: any, kb: any, base: any): void;
package/lib/rdfaparser.js CHANGED
File without changes
@@ -0,0 +1,60 @@
1
+ export default class RDFParser {
2
+ /** Standard namespaces that we know how to handle @final
3
+ * @member RDFParser
4
+ */
5
+ static ns: {
6
+ RDF: string;
7
+ RDFS: string;
8
+ };
9
+ /** DOM Level 2 node type magic numbers @final
10
+ * @member RDFParser
11
+ */
12
+ static nodeType: {
13
+ ELEMENT: number;
14
+ ATTRIBUTE: number;
15
+ TEXT: number;
16
+ CDATA_SECTION: number;
17
+ ENTITY_REFERENCE: number;
18
+ ENTITY: number;
19
+ PROCESSING_INSTRUCTION: number;
20
+ COMMENT: number;
21
+ DOCUMENT: number;
22
+ DOCUMENT_TYPE: number;
23
+ DOCUMENT_FRAGMENT: number;
24
+ NOTATION: number;
25
+ };
26
+ constructor(store: any);
27
+ /** Our triple store reference @private */
28
+ store: any; /** Our identified blank nodes @private */
29
+ bnodes: {}; /** A context for context-aware stores @private */
30
+ why: any; /** Reification flag */
31
+ reify: boolean;
32
+ /**
33
+ * Frame class for namespace and base URI lookups
34
+ * Base lookups will always resolve because the parser knows
35
+ * the default base.
36
+ *
37
+ * @private
38
+ */
39
+ private frameFactory;
40
+ getAttributeNodeNS(node: any, uri: any, name: any): any;
41
+ /**
42
+ * Build our initial scope frame and parse the DOM into triples
43
+ * @param {DOMTree} document The DOM to parse
44
+ * @param {String} base The base URL to use
45
+ * @param {Object} why The context to which this resource belongs
46
+ */
47
+ parse(document: any, base: string, why: any): boolean;
48
+ base: string | undefined;
49
+ parseDOM(frame: any): void;
50
+ /**
51
+ * Cleans out state from a previous parse run
52
+ * @private
53
+ */
54
+ private cleanParser;
55
+ /**
56
+ * Builds scope frame
57
+ * @private
58
+ */
59
+ private buildFrame;
60
+ }