Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new-parser] Broken OOPath expressions #5711

Closed
yurloc opened this issue Feb 20, 2024 · 2 comments
Closed

[new-parser] Broken OOPath expressions #5711

yurloc opened this issue Feb 20, 2024 · 2 comments
Assignees

Comments

@yurloc
Copy link
Contributor

yurloc commented Feb 20, 2024

Parent issue

Failing tests

  • org.drools.model.codegen.execmodel.QueryTest#testQueryWithOOPath
  • org.drools.model.codegen.execmodel.OOPathTest

Notes

  • Both STANDARD_FROM_DRL and PATTERN_DSL.

Rule code snippet

query listSafeCities
$cities : List() from accumulate (Person ( $city: /address#InternationalAddress[state == "Safecountry"]/city), collectList($city))
end

Error output

### parse : ANTLR4_PARSER_ENABLED = true
line 2:50 no viable alternative at input '(Person ( $city: /'
line 2:50 no viable alternative at input '$city: /'
line 2:50 extraneous input '/' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}
line 2:58 mismatched input '#' expecting {'(', '.'}
line 2:129 extraneous input ')' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}
21:45:06.913 [main] ERROR o.d.d.parser.antlr4.DRLParserWrapper.parse:77 - Exception while creating PackageDescr
java.lang.IllegalStateException: ctx.lhsPattern().size() == 0 : 
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:441)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$LhsPatternBindContext.accept(DRLParser.java:1961)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:795)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:775)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnaryContext.accept(DRLParser.java:1862)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:795)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.lambda$visitQuerydef$4(DRLVisitorImpl.java:307)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitQuerydef(DRLVisitorImpl.java:308)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitQuerydef(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$QuerydefContext.accept(DRLParser.java:1321)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitDrlStatementdef(DRLParserBaseVisitor.java:27)
	at org.drools.drl.parser.antlr4.DRLParser$DrlStatementdefContext.accept(DRLParser.java:405)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:795)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:91)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$CompilationUnitContext.accept(DRLParser.java:318)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
	at org.drools.drl.parser.antlr4.DRLParserHelper.compilationUnitContext2PackageDescr(DRLParserHelper.java:87)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:75)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:55)
	at org.drools.drl.parser.DrlParser.lambda$parse$2(DrlParser.java:189)
	at org.drools.drl.parser.DrlParser.compileWithAntlr4Parser(DrlParser.java:202)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:189)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:177)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:166)
	at org.drools.compiler.builder.impl.resources.DrlResourceHandler.process(DrlResourceHandler.java:55)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.buildResource(PackageDescrBuilder.java:73)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.build(PackageDescrBuilder.java:51)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:173)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:116)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:109)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:274)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:220)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:84)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:285)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:251)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:208)
	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:151)
	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:132)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:121)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:114)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:110)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:106)
	at org.drools.model.codegen.execmodel.QueryTest.testQueryWithOOPath(QueryTest.java:300)
21:45:06.913 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:defaultKieBase
[2,50]: no viable alternative at input '(Person ( $city: /'
[2,50]: no viable alternative at input '$city: /'
[2,50]: extraneous input '/' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}
[2,58]: mismatched input '#' expecting {'(', '.'}
[2,129]: extraneous input ')' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}
[0,0]: 
[0,0]: Parser returned a null Package


java.lang.AssertionError: [Message [id=1, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=no viable alternative at input '(Person ( $city: /'], Message [id=2, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=no viable alternative at input '$city: /'], Message [id=3, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=extraneous input '/' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}], Message [id=4, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=mismatched input '#' expecting {'(', '.'}], Message [id=5, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=extraneous input ')' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', '?', IDENTIFIER}], Message [id=6, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=0, column=0
   text=], Message [id=7, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=0, column=0
   text=Parser returned a null Package]]

	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:157)
	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:132)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:121)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:114)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:110)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:106)
	at org.drools.model.codegen.execmodel.QueryTest.testQueryWithOOPath(QueryTest.java:300)
@yurloc yurloc changed the title [new-parser] OOPath in queries doesn't work [new-parser] Broken OOPath expressions Feb 23, 2024
@tkobayas tkobayas self-assigned this Mar 19, 2024
@tkobayas
Copy link
Contributor

/take

@tkobayas
Copy link
Contributor

Fixed by #5805

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🎯 Done in 🦉 KIE Podling Board Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants