@wazootech/sparql-engine 0.5.8-rc.0 → 0.5.9
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/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as SparqlRequest, c as SparqlValue, i as SparqlEngineInterface, n as SparqlBinding, o as SparqlResponse, r as SparqlConstructResults, s as SparqlSelectResults, t as SparqlAskResults } from "./sparql-engine-interface-Bies9KjE.js";
|
|
2
2
|
import { i as RdfQuad, l as RdfTerm, o as RdfSource, s as RdfStore } from "./rdf-terms-DGpxNnyn.js";
|
|
3
3
|
import { B as Triple, z as Term } from "./ast-CIKmrXH9.js";
|
|
4
|
-
import { n as SparqlSyntaxError, t as parseTurtleQuads } from "./turtle-parser-
|
|
4
|
+
import { n as SparqlSyntaxError, t as parseTurtleQuads } from "./turtle-parser-G8iweqtS.js";
|
|
5
5
|
import { n as MemoryStream, t as MemoryStore } from "./memory-store-DhAGI-j6.js";
|
|
6
6
|
import { A as canonicalizeRdfTerm, C as XSD_INTEGER, I as sameRdfTerm, L as termKey, M as rdfTermToSparqlValue, N as sparqlTermToRdfTerm, O as numericValue, S as XSD_FLOAT, T as compareNumericValues, _ as XSD_BOOLEAN, b as XSD_DECIMAL, g as XSD, h as NUMERIC_DATATYPES, i as compareRdfTerms, j as canonicalizeSparqlValue, k as CanonicalTerm, m as formatNumber, r as dataFactory, t as DataFactory, w as XSD_STRING, x as XSD_DOUBLE } from "./public-BNHiaGho.js";
|
|
7
7
|
import { a as serializeJsonResults, i as serializeXmlResults, n as TurtleWriterOptions, r as serializeTurtle, t as TurtleFormat } from "./mod-C4GFefO7.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as parseTurtleQuads, r as SparqlSyntaxError, t as Parser } from "./parser-
|
|
1
|
+
import { n as parseTurtleQuads, r as SparqlSyntaxError, t as Parser } from "./parser-BnLGz638.js";
|
|
2
2
|
import { a as narrowQuadObject, c as quadDedupKey, d as sameRdfTerm, f as termKey, h as blankNodeTerm, i as defaultGraphInstance, l as requireQuadGraph, o as narrowQuadPredicate, s as narrowQuadSubject, t as DataFactory$1 } from "./data-factory-76Dxrf0g.js";
|
|
3
3
|
import { C as XSD_INTEGER, D as numberFromNumeric, E as doubleFromText, O as numberFromText, S as XSD_FLOAT, T as compareNumericValues, _ as XSD_BOOLEAN, a as md5Hex, b as XSD_DECIMAL, c as parseDateTime, d as canonicalizeRdfTerm, f as canonicalizeSparqlValue, g as XSD, h as NUMERIC_DATATYPES, i as typedValuesEqual, k as numericValue, l as timezoneDurationLexical, m as sparqlTermToRdfTerm, n as orderTypedValues, o as XSD_DATE, p as rdfTermToSparqlValue, r as typedValue, s as parseCalendar, t as compareRdfTerms, u as timezoneOf, v as XSD_DATETIME, w as XSD_STRING, x as XSD_DOUBLE, y as XSD_DAYTIME_DURATION } from "./term-s9I2y-ck.js";
|
|
4
4
|
import { n as MemoryStream, r as matchQuadStream, t as MemoryStore } from "./memory-store-Mq4x2Ya1.js";
|
|
@@ -60012,6 +60012,24 @@ var SparqlLrParser = class extends LrParser {
|
|
|
60012
60012
|
function parseSparql(input) {
|
|
60013
60013
|
new SparqlLrParser().parse(new SparqlLexer(input));
|
|
60014
60014
|
}
|
|
60015
|
+
// src/parser/turtle-labels.ts
|
|
60016
|
+
/**
|
|
60017
|
+
* createLabelMaker returns a function that makes up blank node labels for one
|
|
60018
|
+
* document: `b1`, `b2` and so on, without the ones the document writes itself
|
|
60019
|
+
* anywhere in its text.
|
|
60020
|
+
*/
|
|
60021
|
+
function createLabelMaker(text) {
|
|
60022
|
+
const written = new Set(Array.from(text.matchAll(/_:(b\d+)/g), (match) => match[1]));
|
|
60023
|
+
let count = 0;
|
|
60024
|
+
return () => {
|
|
60025
|
+
let label;
|
|
60026
|
+
do {
|
|
60027
|
+
count += 1;
|
|
60028
|
+
label = `b${count}`;
|
|
60029
|
+
} while (written.has(label));
|
|
60030
|
+
return label;
|
|
60031
|
+
};
|
|
60032
|
+
}
|
|
60015
60033
|
// src/parser/turtle-context.ts
|
|
60016
60034
|
/**
|
|
60017
60035
|
* Typed parse context and semantic actions for the generated Turtle / TriG /
|
|
@@ -60046,7 +60064,7 @@ const XSD_DECIMAL = XSD + "decimal";
|
|
|
60046
60064
|
const XSD_DOUBLE = XSD + "double";
|
|
60047
60065
|
const XSD_BOOLEAN = XSD + "boolean";
|
|
60048
60066
|
/** createTurtleParseState returns the empty statement-level state. */
|
|
60049
|
-
function createTurtleParseState() {
|
|
60067
|
+
function createTurtleParseState(text = "") {
|
|
60050
60068
|
return {
|
|
60051
60069
|
graph: void 0,
|
|
60052
60070
|
subject: void 0,
|
|
@@ -60054,7 +60072,7 @@ function createTurtleParseState() {
|
|
|
60054
60072
|
object: void 0,
|
|
60055
60073
|
reifier: void 0,
|
|
60056
60074
|
tripleTerm: void 0,
|
|
60057
|
-
|
|
60075
|
+
nextLabel: createLabelMaker(text),
|
|
60058
60076
|
saveStack: [],
|
|
60059
60077
|
reifierStack: [],
|
|
60060
60078
|
collectionStack: [],
|
|
@@ -60076,12 +60094,12 @@ const turtleContext = {
|
|
|
60076
60094
|
* resetTurtleContext prepares `turtleContext` for a new document: a fresh
|
|
60077
60095
|
* state, empty prefix map, empty quad buffer, and the given base IRI.
|
|
60078
60096
|
*/
|
|
60079
|
-
function resetTurtleContext(baseIri) {
|
|
60097
|
+
function resetTurtleContext(baseIri, text) {
|
|
60080
60098
|
turtleContext.factory = DataFactory;
|
|
60081
60099
|
turtleContext.base = baseIri;
|
|
60082
60100
|
turtleContext.prefixes = /* @__PURE__ */ new Map();
|
|
60083
60101
|
turtleContext.quads = [];
|
|
60084
|
-
turtleContext.state = createTurtleParseState();
|
|
60102
|
+
turtleContext.state = createTurtleParseState(text);
|
|
60085
60103
|
}
|
|
60086
60104
|
function graphTerm() {
|
|
60087
60105
|
const graph = turtleContext.state.graph;
|
|
@@ -60142,8 +60160,7 @@ function rdfTypeTerm() {
|
|
|
60142
60160
|
}
|
|
60143
60161
|
/** freshBlankNode mints a blank node unique within the current document. */
|
|
60144
60162
|
function freshBlankNode() {
|
|
60145
|
-
turtleContext.state.
|
|
60146
|
-
return turtleContext.factory.blankNode("b" + turtleContext.state.bnodeCounter);
|
|
60163
|
+
return turtleContext.factory.blankNode(turtleContext.state.nextLabel());
|
|
60147
60164
|
}
|
|
60148
60165
|
/** labelledBlankNode builds the blank node of a `_:label` token. */
|
|
60149
60166
|
function labelledBlankNode(token) {
|
|
@@ -69094,8 +69111,9 @@ function parseTurtleDocument(input) {
|
|
|
69094
69111
|
* statements carry their named graph; unlabeled triples go to the default
|
|
69095
69112
|
* graph.
|
|
69096
69113
|
*
|
|
69097
|
-
*
|
|
69098
|
-
* parse
|
|
69114
|
+
* Labels are unique within the document only: the counter starts again for each
|
|
69115
|
+
* parse. To store the quads of several documents together, relabel their blank
|
|
69116
|
+
* nodes first, as LOAD does.
|
|
69099
69117
|
*
|
|
69100
69118
|
* Parse state lives in the typed `turtleContext` (`turtle-context.ts`), which
|
|
69101
69119
|
* this function resets before each document; the generated parser reads and
|
|
@@ -69107,7 +69125,7 @@ function parseTurtleDocument(input) {
|
|
|
69107
69125
|
* @returns the parsed quads, with graph labels preserved
|
|
69108
69126
|
*/
|
|
69109
69127
|
function parseTurtleQuads(text, baseIri = "") {
|
|
69110
|
-
resetTurtleContext(baseIri);
|
|
69128
|
+
resetTurtleContext(baseIri, text);
|
|
69111
69129
|
parseTurtleDocument(text);
|
|
69112
69130
|
return turtleContext.quads;
|
|
69113
69131
|
}
|
package/dist/parser.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* replacement for the `sparqljs` `Parser` export.
|
|
27
27
|
*/
|
|
28
28
|
import { A as Quads, B as Triple, C as MinusPattern, D as PathElement, E as Ordering, F as SelectQuery, G as ValuePatternRow, H as UnionPattern, I as SelectSubQuery, J as VariableTerm, K as ValuesPattern, L as ServicePattern, M as Query, N as QueryModifiers, O as Pattern, P as ReifiedQuad, R as SparqlQuery, S as MembershipExpression, T as OptionalPattern, U as UpdateOperation, V as TriplePredicate, W as UpdateQuery, Y as Wildcard, _ as GraphRefAll, a as ClearDropOperation, b as InsertDeleteOperation, c as CreateOperation, d as Expression, f as FilterPattern, g as GraphPattern, h as GraphOrDefault, i as BindPattern, j as QuadsPattern, k as PropertyPath, l as DescribeQuery, m as FunctionCallExpression, n as AskQuery, o as ConstructQuery, p as FromClause, q as VariableExpression, r as BgpPattern, s as CopyMoveOperation, t as AggregateExpression, u as ExistsExpression, v as GroupPattern, w as OperationExpression, x as LoadOperation, y as Grouping, z as Term } from "./ast-CIKmrXH9.js";
|
|
29
|
-
import { n as SparqlSyntaxError, t as parseTurtleQuads } from "./turtle-parser-
|
|
29
|
+
import { n as SparqlSyntaxError, t as parseTurtleQuads } from "./turtle-parser-G8iweqtS.js";
|
|
30
30
|
export interface SparqlParserOptions {
|
|
31
31
|
/** Pre-registered prefixes; the standard `xsd:` prefix is always included. */
|
|
32
32
|
prefixes?: Record<string, string>;
|
package/dist/parser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Parser, t as SparqlParser, r as SparqlSyntaxError, n as parseTurtleQuads } from "./parser-
|
|
1
|
+
export { t as Parser, t as SparqlParser, r as SparqlSyntaxError, n as parseTurtleQuads } from "./parser-BnLGz638.js";
|
|
@@ -67,8 +67,9 @@ declare class SparqlSyntaxError extends Error {
|
|
|
67
67
|
* statements carry their named graph; unlabeled triples go to the default
|
|
68
68
|
* graph.
|
|
69
69
|
*
|
|
70
|
-
*
|
|
71
|
-
* parse
|
|
70
|
+
* Labels are unique within the document only: the counter starts again for each
|
|
71
|
+
* parse. To store the quads of several documents together, relabel their blank
|
|
72
|
+
* nodes first, as LOAD does.
|
|
72
73
|
*
|
|
73
74
|
* Parse state lives in the typed `turtleContext` (`turtle-context.ts`), which
|
|
74
75
|
* this function resets before each document; the generated parser reads and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wazootech/sparql-engine",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Run SPARQL 1.1 and 1.2 queries and updates over your RDF data in TypeScript, on Node.js, Bun, Deno and in the browser. No WebAssembly, no framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sparql",
|