Drools Error- ERR 102 Line 9:143 mismatched input '==' in rule - drools

I am trying to configure a Decision table to evaluate certain condition.
Below is the snippet from my decision table.
While doing so I am getting following error
[ERR 102] Line 8:143 mismatched input '==' in rule "Rules_11".
I am not sure about what I am doing wrong.

The problem is in line 9
The condition cannot have a variable with a comparison floating there.
$selectedAttribute.code in line 9 doesn't mean anything, that's not a Conditional element.

Related

Minizinc unexpected syntax error

What does the following error mean(and I don't even have line no.83 either in .mzn or .dzn:
Error: invalid integer literal in line no. 83
Error: syntax error, unexpected ':', expecting FZ_INT_LIT in line no. 83
Is it because the numbers in my arrays are too large for the solver to handle?

Unexpected matlab expression in function

I have the following call to a function:
callfun(I1, I2, [X Y ones(n,1)], w, m)
But, I'm getting:
Error: File: callfun.m Line: 20 Column: 3
Unexpected MATLAB expression.
Why is that?
Thanks.
The error says, that your function callfun has a syntax error in line 20. Probably some character which is not allowed.
It can be also a problem of duplicated function definition. A function inside callfun.m may have the same name as a built-in MATLAB function, what yields an error.
From http://www.mathworks.com/matlabcentral/answers/214993-how-to-solve-error-unexpected-matlab-expression-workspacefunc-287:
Do you have any user-defined functions called builtin, strjoin, or strsplit? MATLAB has these defined internally, and having any outside functions that shadow these built-in ones would result in this error. If you are unsure if you have created such functions, typing the command:
>>which functionName -all
will show you the path to all items on the MATLAB path with the name "functionName"

Multiple functions in Matlab file

I have a Matlab file with multiple functions defined. When calling the file, I get the following error: "Error: File: kmeans.m Line: 20 Column: 1\n Function definition is misplaced or improperly nested."
How can I get rid of the error?
Make sure every function has a matching end.

Mismatched input <eof> with drools

I have an Optaplanner drools file, and when I run the code below:
// ############################################################################
// Hard constraints
// ############################################################################
rule "DevCanOnlyDoOneTask"
when
$T1:Task(assignedDev==$D)
$T2:Task(assignedDev==$D)
(($T2.getAllottedStartTime()<=$T1.getAllottedStartTime())&&($T1.getAllottedStartTime()<$T2.getAllottedStartTime()+$T2.getDuration()))||(($T1.getAllottedStartTime()<=$T2.getAllottedStartTime())&&($T2.getAllottedStartTime()<$T1.getAllottedStartTime()+$T1.getDuration())) //line 21
then
scoreHolder.addHardConstraintMatch(kcontext,-1000);
end
// ############################################################################
// Soft constraints
// ############################################################################
rule "MaximiseEarliestFinishTime"
when
$TA: TaskAssignment($EFT: getEFT())
then
scoreHolder.addSoftConstraintMatch(kcontext,+$TA.getEFT());
I get the following error message (note I have commented on where the relevant are in the code above):
08:08:41.613 [main] ERROR o.d.c.k.b.impl.AbstractKieModule - Unable to build KieBaseModel:defaultKieBase
[21,36]: [ERR 102] Line 21:36 mismatched input '<=' in rule "DevCanOnlyDoOneTask"
[36,66]: [ERR 102] Line 36:66 mismatched input '<eof>' in rule "MaximiseEarliestFinishTime"
[0,0]: Parser returned a null Package
I assume there is something fundamentally wrong with the syntax I am using, but I am finding it difficult to pin down exactly what.
Thanks guys
Line 36:66 mismatched input '<eof>' in rule "MaximiseEarliestFinishTime"
All rules must end with the keyword end.
As for line 21, either put an eval around it (see drools docs for more info) or better yet, do those restrictions as part of $T2:Task. Also, the $D in $T1:Task doesn't exist yet, so you probably want to define it (bind it) instead of == compare it.

How to get error line/column number from SQL syntax error or executing exception from libpq?

When I execute a SQL command via libpq, it reports error message if there's some error something like this.
Error Domain=PQConnection Code=1 "ERROR: syntax error at or near "fef"
LINE 1: fef
^
This is string message. I can parse the message - because it's very regular - to get line/column number, but that's unreliable. Is there any other API to get line/column numbers? Any regularized integer form would be nice.
Use PQresultErrorField function with key PG_DIAG_STATEMENT_POSITION.
From manual
PG_DIAG_STATEMENT_POSITION A string containing a decimal integer
indicating an error cursor position as an index into the original
statement string. The first character has index 1, and positions are
measured in characters not bytes.