@traqula/rules-sparql-1-1-adjust 0.0.1-alpha.141 → 0.0.1-alpha.145
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/lib/index.cjs +62 -69
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -9550,10 +9550,16 @@ function resolveIRI(iri3, base) {
|
|
|
9550
9550
|
return base.replace(/(?:\?.*)?$/u, iri3);
|
|
9551
9551
|
// Resolve root relative IRIs at the root of the base IRI
|
|
9552
9552
|
case "/":
|
|
9553
|
-
|
|
9553
|
+
const baseMatch = base.match(/^(?:[a-z]+:\/*)?[^\/]*/);
|
|
9554
|
+
if (!baseMatch) {
|
|
9555
|
+
throw new Error(`Could not determine relative IRI using base: ${base}`);
|
|
9556
|
+
}
|
|
9557
|
+
const baseRoot = baseMatch[0];
|
|
9558
|
+
return baseRoot + iri3;
|
|
9554
9559
|
// Resolve all other IRIs at the base IRI's path
|
|
9555
9560
|
default:
|
|
9556
|
-
|
|
9561
|
+
const basePath = base.replace(/[^\/:]*$/, "");
|
|
9562
|
+
return basePath + iri3;
|
|
9557
9563
|
}
|
|
9558
9564
|
}
|
|
9559
9565
|
|
|
@@ -10418,12 +10424,6 @@ var blankNode = {
|
|
|
10418
10424
|
{
|
|
10419
10425
|
ALT: () => {
|
|
10420
10426
|
const label = CONSUME(terminals_exports.blankNodeLabel).image;
|
|
10421
|
-
ACTION(() => {
|
|
10422
|
-
if (context.flushedBlankNodeLabels.has(label)) {
|
|
10423
|
-
throw new Error("Detected reuse blank node across different request string.");
|
|
10424
|
-
}
|
|
10425
|
-
context.usedBlankNodeLabels.add(label);
|
|
10426
|
-
});
|
|
10427
10427
|
return ACTION(() => context.dataFactory.blankNode(label.replace("_:", "e_")));
|
|
10428
10428
|
}
|
|
10429
10429
|
},
|
|
@@ -10623,16 +10623,15 @@ function triplesSameSubjectImpl(name, allowPaths) {
|
|
|
10623
10623
|
{
|
|
10624
10624
|
ALT: () => {
|
|
10625
10625
|
const subject = SUBRULE(varOrTerm);
|
|
10626
|
-
|
|
10627
|
-
return ACTION(() => propNotEmpty.map((partial) => partial({ subject })));
|
|
10626
|
+
return SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, subject);
|
|
10628
10627
|
}
|
|
10629
10628
|
},
|
|
10630
10629
|
{
|
|
10631
10630
|
ALT: () => {
|
|
10632
10631
|
const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode);
|
|
10633
|
-
const restNode = SUBRULE(allowPaths ? propertyListPath : propertyList);
|
|
10632
|
+
const restNode = SUBRULE(allowPaths ? propertyListPath : propertyList, subjectNode.node);
|
|
10634
10633
|
return ACTION(() => [
|
|
10635
|
-
...restNode
|
|
10634
|
+
...restNode,
|
|
10636
10635
|
...subjectNode.triples
|
|
10637
10636
|
]);
|
|
10638
10637
|
}
|
|
@@ -10645,7 +10644,7 @@ var triplesSameSubjectPath = triplesSameSubjectImpl("triplesSameSubjectPath", tr
|
|
|
10645
10644
|
function propertyListImpl(name, allowPaths) {
|
|
10646
10645
|
return {
|
|
10647
10646
|
name,
|
|
10648
|
-
impl: ({ SUBRULE, OPTION }) => () => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty)) ?? []
|
|
10647
|
+
impl: ({ SUBRULE, OPTION }) => (subject) => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, subject)) ?? []
|
|
10649
10648
|
};
|
|
10650
10649
|
}
|
|
10651
10650
|
var propertyList = propertyListImpl("propertyList", false);
|
|
@@ -10653,42 +10652,30 @@ var propertyListPath = propertyListImpl("propertyListPath", true);
|
|
|
10653
10652
|
function propertyListNotEmptyImplementation(name, allowPaths) {
|
|
10654
10653
|
return {
|
|
10655
10654
|
name,
|
|
10656
|
-
impl: ({ ACTION, CONSUME,
|
|
10655
|
+
impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (subject) => {
|
|
10657
10656
|
const result = [];
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
const
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
MANY(() => {
|
|
10677
|
-
CONSUME(symbols_exports.semi);
|
|
10678
|
-
OPTION(() => {
|
|
10679
|
-
const predicate = allowPaths ? OR2([
|
|
10680
|
-
{ ALT: () => SUBRULE2(verbPath) },
|
|
10681
|
-
{ ALT: () => SUBRULE2(verbSimple) }
|
|
10682
|
-
]) : SUBRULE2(verb);
|
|
10683
|
-
const objects = SUBRULE2(allowPaths ? objectListPath : objectList);
|
|
10684
|
-
ACTION(() => {
|
|
10685
|
-
result.push(
|
|
10686
|
-
...objects.map((object2) => (partS) => object2({ ...partS, predicate }))
|
|
10687
|
-
);
|
|
10657
|
+
let parsedSemi = true;
|
|
10658
|
+
AT_LEAST_ONE({
|
|
10659
|
+
GATE: () => parsedSemi,
|
|
10660
|
+
DEF: () => {
|
|
10661
|
+
parsedSemi = false;
|
|
10662
|
+
const predicate = allowPaths ? OR1([
|
|
10663
|
+
{ ALT: () => SUBRULE1(verbPath) },
|
|
10664
|
+
{ ALT: () => SUBRULE1(verbSimple) }
|
|
10665
|
+
]) : SUBRULE1(verb);
|
|
10666
|
+
const triples = SUBRULE1(
|
|
10667
|
+
allowPaths ? objectListPath : objectList,
|
|
10668
|
+
subject,
|
|
10669
|
+
predicate
|
|
10670
|
+
);
|
|
10671
|
+
ACTION(() => result.push(...triples));
|
|
10672
|
+
MANY2(() => {
|
|
10673
|
+
CONSUME(symbols_exports.semi);
|
|
10674
|
+
parsedSemi = true;
|
|
10688
10675
|
});
|
|
10689
|
-
}
|
|
10676
|
+
}
|
|
10690
10677
|
});
|
|
10691
|
-
return
|
|
10678
|
+
return result;
|
|
10692
10679
|
}
|
|
10693
10680
|
};
|
|
10694
10681
|
}
|
|
@@ -10705,11 +10692,11 @@ var verbSimple = {
|
|
|
10705
10692
|
function objectListImpl(name, allowPaths) {
|
|
10706
10693
|
return {
|
|
10707
10694
|
name,
|
|
10708
|
-
impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => () => {
|
|
10695
|
+
impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => (subject, predicate) => {
|
|
10709
10696
|
const objects = [];
|
|
10710
10697
|
AT_LEAST_ONE_SEP({
|
|
10711
10698
|
DEF: () => {
|
|
10712
|
-
const objectTriples = SUBRULE(allowPaths ? objectPath : object);
|
|
10699
|
+
const objectTriples = SUBRULE(allowPaths ? objectPath : object, subject, predicate);
|
|
10713
10700
|
ACTION(() => objects.push(...objectTriples));
|
|
10714
10701
|
},
|
|
10715
10702
|
SEP: symbols_exports.comma
|
|
@@ -10723,11 +10710,11 @@ var objectListPath = objectListImpl("objectListPath", true);
|
|
|
10723
10710
|
function objectImpl(name, allowPaths) {
|
|
10724
10711
|
return {
|
|
10725
10712
|
name,
|
|
10726
|
-
impl: ({ ACTION, SUBRULE }) => () => {
|
|
10713
|
+
impl: ({ ACTION, SUBRULE }) => (subject, predicate) => {
|
|
10727
10714
|
const node = SUBRULE(allowPaths ? graphNodePath : graphNode);
|
|
10728
10715
|
return ACTION(() => [
|
|
10729
|
-
|
|
10730
|
-
...node.triples
|
|
10716
|
+
{ subject, predicate, object: node.node },
|
|
10717
|
+
...node.triples
|
|
10731
10718
|
]);
|
|
10732
10719
|
}
|
|
10733
10720
|
};
|
|
@@ -10753,13 +10740,16 @@ function blankNodePropertyListImpl(name, allowPaths) {
|
|
|
10753
10740
|
name,
|
|
10754
10741
|
impl: ({ ACTION, SUBRULE, CONSUME, context }) => () => {
|
|
10755
10742
|
CONSUME(symbols_exports.LSquare);
|
|
10756
|
-
|
|
10743
|
+
let blankNode2;
|
|
10744
|
+
const propList = SUBRULE(
|
|
10745
|
+
allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty,
|
|
10746
|
+
ACTION(() => blankNode2 = context.dataFactory.blankNode())
|
|
10747
|
+
);
|
|
10757
10748
|
CONSUME(symbols_exports.RSquare);
|
|
10758
10749
|
return ACTION(() => {
|
|
10759
|
-
const subject = context.dataFactory.blankNode();
|
|
10760
10750
|
return {
|
|
10761
|
-
node:
|
|
10762
|
-
triples: propList
|
|
10751
|
+
node: blankNode2,
|
|
10752
|
+
triples: propList
|
|
10763
10753
|
};
|
|
10764
10754
|
});
|
|
10765
10755
|
}
|
|
@@ -10899,16 +10889,24 @@ var prefixDecl2 = {
|
|
|
10899
10889
|
};
|
|
10900
10890
|
var triplesTemplate = {
|
|
10901
10891
|
name: "triplesTemplate",
|
|
10902
|
-
impl: ({ SUBRULE, CONSUME,
|
|
10892
|
+
impl: ({ ACTION, AT_LEAST_ONE, AT_LEAST_ONE_SEP, SUBRULE, CONSUME, OPTION }) => () => {
|
|
10903
10893
|
const triples = [];
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10894
|
+
let parsedDot = true;
|
|
10895
|
+
AT_LEAST_ONE({
|
|
10896
|
+
GATE: () => parsedDot,
|
|
10897
|
+
DEF: () => {
|
|
10898
|
+
parsedDot = false;
|
|
10899
|
+
const template = SUBRULE(triplesSameSubject);
|
|
10900
|
+
ACTION(() => {
|
|
10901
|
+
triples.push(...template);
|
|
10902
|
+
});
|
|
10903
|
+
OPTION(() => {
|
|
10904
|
+
CONSUME(symbols_exports.dot);
|
|
10905
|
+
parsedDot = true;
|
|
10906
|
+
});
|
|
10907
|
+
}
|
|
10910
10908
|
});
|
|
10911
|
-
return triples
|
|
10909
|
+
return triples;
|
|
10912
10910
|
}
|
|
10913
10911
|
};
|
|
10914
10912
|
var verb = {
|
|
@@ -12652,6 +12650,7 @@ var updateUnit = {
|
|
|
12652
12650
|
var update = {
|
|
12653
12651
|
name: "update",
|
|
12654
12652
|
impl: ({ ACTION, SUBRULE, CONSUME, OPTION1, OPTION2, context }) => () => {
|
|
12653
|
+
const blankLabelsUsedInInsertData = /* @__PURE__ */ new Set();
|
|
12655
12654
|
const prologueValues = SUBRULE(prologue);
|
|
12656
12655
|
const result = {
|
|
12657
12656
|
type: "update",
|
|
@@ -12661,12 +12660,6 @@ var update = {
|
|
|
12661
12660
|
};
|
|
12662
12661
|
OPTION1(() => {
|
|
12663
12662
|
const updateOperation = SUBRULE(update1);
|
|
12664
|
-
ACTION(() => {
|
|
12665
|
-
for (const label of context.usedBlankNodeLabels) {
|
|
12666
|
-
context.flushedBlankNodeLabels.add(label);
|
|
12667
|
-
}
|
|
12668
|
-
context.usedBlankNodeLabels.clear();
|
|
12669
|
-
});
|
|
12670
12663
|
const recursiveRes = OPTION2(() => {
|
|
12671
12664
|
CONSUME(symbols_exports.semi);
|
|
12672
12665
|
return SUBRULE(update);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/rules-sparql-1-1-adjust",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.145+b7fd73e",
|
|
4
4
|
"description": "TRAQULA Lexer and Grammar Rules for sparql 1.1-ADJUST",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@traqula/core": "^0.0.1-alpha.
|
|
42
|
-
"@traqula/rules-sparql-1-1": "^0.0.1-alpha.
|
|
41
|
+
"@traqula/core": "^0.0.1-alpha.145+b7fd73e",
|
|
42
|
+
"@traqula/rules-sparql-1-1": "^0.0.1-alpha.145+b7fd73e"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b7fd73efdfc32dec46beaa040431ba031a723b53"
|
|
45
45
|
}
|