Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

'tRules' Component - issue with rule DRL file syntax and KnowledgeBase

Hello,

 

I followed this tutorial and was able to create rules locally (tutorialRule_0.txt attached).  Though I create this DRL file using Talend Studio, I get a syntax error and KnowledgeBase error when I run a job -

 

[statistics] connecting to socket on port 3802
[statistics] connected
[1,0]: [ERR 107] Line 1:0 mismatched input '#' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
[3,25]: [ERR 107] Line 3:25 mismatched input 'here' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
[8,0]: [ERR 107] Line 8:0 mismatched input '#' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
[8,20]: [ERR 102] Line 8:20 mismatched input 'variables'
[9,0]: [ERR 102] Line 9:0 mismatched input 'global'
[9,17]: [ERR 102] Line 9:17 mismatched input 'list'
[10,7]: [ERR 102] Line 10:7 mismatched input 'HashMap'
[13,0]: [ERR 102] Line 13:0 mismatched input 'rule'
[13,5]: [ERR 102] Line 13:5 mismatched input '"ValidEmails"'
[41,2]: [ERR 102] Line 41:2 mismatched input '#' in rule "InvalidEmails"
[0,0]: Parser returned a null Package

 

Exception in component tRules_1
java.lang.IllegalArgumentException: Could not parse knowledge.
    at newproject1.tutorialjob_0_1.tutorialJob$1KnowledgeBase_tRules_1.readKnowledgeBaseDRL(tutorialJob.java:1143)
[FATAL]: newproject1.tutorialjob_0_1.tutorialJob - tRules_1 Could not parse knowledge.
[statistics] disconnected
    at newproject1.tutorialjob_0_1.tutorialJob$1KnowledgeBase_tRules_1.readKnowledgeBase(tutorialJob.java:1116)
    at newproject1.tutorialjob_0_1.tutorialJob.tFileInputExcel_1Process(tutorialJob.java:1195)
    at newproject1.tutorialjob_0_1.tutorialJob.runJobInTOS(tutorialJob.java:2272)
    at newproject1.tutorialjob_0_1.tutorialJob.main(tutorialJob.java:2106)
Job tutorialJob ended at 01:10 03/01/2018. [exit code=1]

 

I tried removing the commented lines with '#'s from rule DRL file but got an error with 'input' and 'output' object types and KnowledgeBase:

 

Unable to resolve ObjectType '$inputStruct$' : [Rule name='ValidEmails']
Unable to resolve ObjectType '$inputStruct$' : [Rule name='InvalidEmails']

Rule Compilation error : [Rule name='ValidEmails']
    defaultpkg/Rule_ValidEmails1914298844.java (7:417) : $outputStruct0$ cannot be resolved to a type
    defaultpkg/Rule_ValidEmails1914298844.java (7:444) : $outputStruct0$ cannot be resolved to a type
    defaultpkg/Rule_ValidEmails1914298844.java (8:485) : Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
    defaultpkg/Rule_ValidEmails1914298844.java (8:485) : Syntax error, insert "AssignmentOperator Expression" to complete Assignment
    defaultpkg/Rule_ValidEmails1914298844.java (8:485) : Syntax error, insert ";" to complete Statement
    defaultpkg/Rule_ValidEmails1914298844.java (8:485) : outputStruct0$ cannot be resolved to a variable
    defaultpkg/Rule_ValidEmails1914298844.java (9:503) : list cannot be resolved
    defaultpkg/Rule_ValidEmails1914298844.java (10:553) : input cannot be resolved to a variable
[FATAL]: newproject1.emailjob1_0_1.EmailJob1 - tRules_2 Could not parse knowledge.
[statistics] disconnected

Rule Compilation error : [Rule name='InvalidEmails']
    defaultpkg/Rule_InvalidEmails477598557.java (7:418) : $outputStruct1$ cannot be resolved to a type
    defaultpkg/Rule_InvalidEmails477598557.java (7:445) : $outputStruct1$ cannot be resolved to a type
    defaultpkg/Rule_InvalidEmails477598557.java (8:486) : Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
    defaultpkg/Rule_InvalidEmails477598557.java (8:486) : Syntax error, insert "AssignmentOperator Expression" to complete Assignment
    defaultpkg/Rule_InvalidEmails477598557.java (8:486) : Syntax error, insert ";" to complete Statement
    defaultpkg/Rule_InvalidEmails477598557.java (8:486) : outputStruct1$ cannot be resolved to a variable
    defaultpkg/Rule_InvalidEmails477598557.java (9:504) : list cannot be resolved
    defaultpkg/Rule_InvalidEmails477598557.java (10:554) : input cannot be resolved to a variable

Exception in component tRules_2
java.lang.IllegalArgumentException: Could not parse knowledge.
    at newproject1.emailjob1_0_1.EmailJob1$1KnowledgeBase_tRules_2.readKnowledgeBaseDRL(EmailJob1.java:1139)
    at newproject1.emailjob1_0_1.EmailJob1$1KnowledgeBase_tRules_2.readKnowledgeBase(EmailJob1.java:1112)
    at newproject1.emailjob1_0_1.EmailJob1.tFileInputExcel_1Process(EmailJob1.java:1191)
    at newproject1.emailjob1_0_1.EmailJob1.runJobInTOS(EmailJob1.java:2259)
    at newproject1.emailjob1_0_1.EmailJob1.main(EmailJob1.java:2093)
Job EmailJob1 ended at 01:22 03/01/2018. [exit code=1]

 
 Can someone help? Thanks.

Labels (4)
1 Reply
Anonymous
Not applicable
Author

Hello,

Could you please indicate on which talend build version you got this issue?

Best regards

Sabrina