@traqula/rules-sparql-1-1-adjust 0.0.1-alpha.143 → 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.
Files changed (2) hide show
  1. package/lib/index.cjs +53 -55
  2. package/package.json +4 -4
package/lib/index.cjs CHANGED
@@ -10623,16 +10623,15 @@ function triplesSameSubjectImpl(name, allowPaths) {
10623
10623
  {
10624
10624
  ALT: () => {
10625
10625
  const subject = SUBRULE(varOrTerm);
10626
- const propNotEmpty = SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty);
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.map((partial) => partial({ subject: subjectNode.node })),
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, MANY, SUBRULE1, SUBRULE2, OPTION, OR1, OR2, context }) => () => {
10655
+ impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (subject) => {
10657
10656
  const result = [];
10658
- const resultAppendage = [];
10659
- const firstProperty = allowPaths ? OR1([
10660
- { ALT: () => SUBRULE1(verbPath) },
10661
- { ALT: () => SUBRULE1(verbSimple) }
10662
- ]) : SUBRULE1(verb);
10663
- const firstObjects = SUBRULE1(allowPaths ? objectListPath : objectList);
10664
- ACTION(() => {
10665
- const filterSubject = context.dataFactory.namedNode("internal:filterSubject");
10666
- for (const cObject of firstObjects) {
10667
- const triple = cObject({ subject: filterSubject, predicate: firstProperty });
10668
- const generator = (rest) => cObject({ ...rest, predicate: firstProperty });
10669
- if (triple.subject === filterSubject) {
10670
- result.push(generator);
10671
- } else {
10672
- resultAppendage.push(generator);
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 [...result, ...resultAppendage];
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
- (part) => ({ ...part, object: node.node }),
10730
- ...node.triples.map((val) => () => val)
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
- const propList = SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty);
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: subject,
10762
- triples: propList.map((part) => part({ subject }))
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, OPTION1, OPTION2 }) => () => {
10892
+ impl: ({ ACTION, AT_LEAST_ONE, AT_LEAST_ONE_SEP, SUBRULE, CONSUME, OPTION }) => () => {
10903
10893
  const triples = [];
10904
- triples.push(SUBRULE(triplesSameSubject));
10905
- OPTION1(() => {
10906
- CONSUME(symbols_exports.dot);
10907
- OPTION2(() => {
10908
- triples.push(SUBRULE(triplesTemplate));
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.flat(1);
10909
+ return triples;
10912
10910
  }
10913
10911
  };
10914
10912
  var verb = {
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.143+7e8a4c4",
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.143+7e8a4c4",
42
- "@traqula/rules-sparql-1-1": "^0.0.1-alpha.143+7e8a4c4"
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": "7e8a4c4897f112e7291b733121a83726bacfdd0b"
44
+ "gitHead": "b7fd73efdfc32dec46beaa040431ba031a723b53"
45
45
  }