ClassCastException trying to deserialize a drools session
by radai rosenblatt
Hi.
I'm getting this trying to read a serialized drools session (java 7, drools
5.1.1):
Caused by: java.lang.ClassCastException: org.drools.reteoo.RuleTerminalNode
cannot be cast to org.drools.reteoo.RightTupleSink
at
org.drools.marshalling.impl.InputMarshaller.readRightTuple(InputMarshaller.java:401)
[drools-core.jar:5.1.1]
at
org.drools.marshalling.impl.InputMarshaller.readRightTuples(InputMarshaller.java:391)
[drools-core.jar:5.1.1]
at
org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:326)
[drools-core.jar:5.1.1]
at
org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:205)
[drools-core.jar:5.1.1]
at
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:91)
[drools-core.jar:5.1.1]
this happens when trying to deserialize using Marshaller.unmarshal().
is this a known (hopefully fixed?) issue with 5.1.1 ? is it possible im
doing something wrong?
--
View this message in context: http://drools.46999.n3.nabble.com/ClassCastException-trying-to-deserializ...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
How to track constraint truth [was: Non short circuit ANDing]
by Wolfgang Laun
To summarize the discussion of the major part of the cited thread:
* There are situations when it is of interest to learn which of the
several constraints of a rule are true and which block it from firing.
* It is known that manually writing a set cooperating rules can
solve this problem (e.g., Rule Design Pattern "Learning the Reason for
Failure")
* Some automatism supporting the creation of such a set would help
Considering such a support, one wonders which level of complexity in
the primary rule it must be able to handle. The task in itself
procures a limitation, e.g., when one pattern must match so that a
binding is available which is used in a successive pattern. (More
formally: the dependency graph of bindings restricts the investigation
of the truth of LHS sub-terms.) Furthermore, any solution using
reverse-engineering from the internal representation of a LHS isn't
simple, and the API for accessing a compiled rule isn't "stable".
But I think that simple scenarios can be handled by a simple rule
authoring tool. I'll explain this by using an example: a rule
investigating offered cars according to a buyer's wishes:
class Car {
String colour;
int price;
int horsepower;
boolean abs;
}
rule "car"
when
$car: Car( colour == "red", price < 1000, horsepower >= 150, abs == true )
then ... end
To permit the individual investigation of constraints, this might be
rewritten as:
rule "car"
when
$car: Car()
then end
rule "car colour == \"red\"" extends "car"
when
Car( this == car, colour == "red" )
then // Gosh, a red one!
end
rule "car price < 1000" extends "car"
when
Car( this == car, price < 1000 )
then // Hey, it's cheap enough!
end
And so on. - For a fully automatic process, a "Collector" fact has to
be maintained for each fact (or Cartesian product of facts) matching
the initial rule (i.e., "car"). Into this Collector, positive results
from the extending rules are injected, so that, ultimately, it can be
examined for full information. Here's a couple of examples of rules
doing just that, with the rule id and failure count as positional
properties:
rule "success"
when
$c: Collector( "car", 0; )
then
System.out.println( "Found the car I want: " + $c.get( "car" ) );
end
rule "almost"
when
$c: Collector( "car", 1; )
then
System.out.println( "Almost the car I want: " + $c.get( "car" ) );
$c.missing();
end
Given the Car( "red", 1200, 160, true ), the second rule fires and produces:
Almost found the car I want: Car [colour=red, price=1200,
horsepower=160, abs=true]
missed: price < 1000 in Car
How to write the original rule is the last point. The actual user
interface could be simpler, but here is a basic fluent API:
public String makeRuleText(){
RuleSet ruleSet = new RuleSet( "com.sample", "car" )
.add(new BasicPattern( "car", Car.class ) )
.add( new Constraint( "colour == \"red\"" ) )
.add( new Constraint( "price < 1000" ) )
.add( new Constraint( "horsepower >= 150") )
.add( new Constraint( "abs == true" ) );
return ruleSet.toString();
}
Cheers
Wolfgang
11 years, 9 months
Rule to order by priority [Planner]
by André Fróes
Hello there. I've been trying to create a rule to plan the my workorders
with higher priority first, but I'm not bein able to.
I tried creating a rule something like "conflictingLecturesInSamePeriod",
but I'm getting lost.
Example: I've implemented my previous example of engineer/workorders and
added shitf and priority. The priorities goes from 1 to 5, the lowest it
is, the more urgent it is (1-Highest, 2-High, etc..)
I don't know how to compare it to the other in the list, so I tried
checking with previous ID, but no success:
******************************
rule "workOrderByPriority"
when
$leftWorkOrderPriority : WorkOrder($leftWOP : id, $leftPriority :
priority.priorityID)
$righttWorkOrderPriority : WorkOrder(id >= $leftWOP, $rightPriority :
priority.priorityID)
$engineer: Engineer($id : id)
then
insertLogical(new IntConstraintOccurrence("workOrderByPriority",
ConstraintType.NEGATIVE_SOFT,
1,
<UNKNOWN>, $engineer));
end
*******************************
this above is the second attempt, the <UNKNOWN> is because i'm lost about
what to add and also if i should add something there.
the first try just pass straight forward
*******************************
rule "workOrderByPriority"
when
$engineer : Engineer($worktime : worktime)
$priority : WorkOrder($priorityId : priority.priorityID)
then
insertLogical(new IntConstraintOccurrence("workOrderByPriority",
ConstraintType.NEGATIVE_SOFT,
2,
$priority, $engineer));
end
*******************************
i know i'm far from get even closer. In order to define the planner
according to priority I think I should compare it with entire list isn't? I
noticed that in some rules, and entire list is pointed.
I searched the guide and example for some tips, but the best I found was
the course that compared 2 courses that I believe that will be the same
thing i'll have to do with priorities.
11 years, 9 months
[Announce] EulerGUI 1.13
by Jean-Marc Vanel
Hi
I am pleased to announce the release 1.13 of EulerGUI, a development
tool and a framework for the Semantic Web and rules, under LGPL
license, in Java and Scala.
There was no announcement here on Drools list since version 1.7.1 of
EulerGUI in January 2011.
As some of you know, EulerGUI is using Drools since beginning of 2009,
as an engine for N3 logic (http://www.w3.org/2000/10/swap/doc/Rules) .
N3 is a language for the Semantic Web equivalent to RDF, but much
easier to read and write by hand.
Moreover, N3 has an extension for rules, e.g. :
{ ?x parent ?y } => { ?y child ?x }.
Such rules are translated in Drools language under the hood. This
allows to make experts systems without writing any Java class for
business domain.
Moreover, it' possible to reuse the thousands of ontologies available
in search engines. And there are also the hundreds of SPARQL data
sources available in the Linked Open Data ( http://linkeddata.org/ ),
notably http://dbpedia.org .
The improvements since version 1.7.1 mainly concern :
- N3 Drools inference engine: more builtins, embedded Java objects,
- Semantic Web client GUI for SPARQL queries and update
- local Jena TDB database (SPARQL)
- generate a project skeleton ontology for missing declarations
- new N3 sources : ATTEMPTO Controled English; Squall Controled
English for SPARQL
- download N3 sources from Internet in multithread, with cache
- popup by which it is possible to kill an inference launch
- in tools menu, add all referred Ontologies to current project
- N3 command line interface ( BasicRuntime ) as a separate program
- and many fixes
The download is here:
https://sourceforge.net/projects/eulergui/files/eulergui/1.13/
Full CHANGES list:
https://eulergui.svn.sourceforge.net/svnroot/eulergui/trunk/eulergui/CHAN...
Documentation:
http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/d...
--
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel ; chat: irc://irc.freenode.net#eulergui
--
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel ; chat: irc://irc.freenode.net#eulergui
--
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel ; chat: irc://irc.freenode.net#eulergui
11 years, 9 months
Danish letters error in guvnor decision table
by Manasi
Hi,
Currently I am using following code to insrt data directly in to the
decision table created in my local Guvnor.
ClientRequest request = new
ClientRequest("http://localhost:8080/drools-guvnor/rest/packages/KissProcessGenerator.Fu...");
String username = "admin";
String password = "admin";
String base64encodedUsernameAndPassword = base64Encode(username + ":" +
password);
request.header("Authorization", "Basic " +
base64encodedUsernameAndPassword);
request.accept("text/plain");
String content = null;
try {
content = (String)request.get().getEntity(String.class);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GuidedDecisionTable52 dt =
GuidedDTXMLPersistence.getInstance().unmarshal(content);
List<List<DTCellValue52>> list=dt.getData();
List<DTCellValue52> newlist = new ArrayList<DTCellValue52>();
newlist.add(new DTCellValue52(1));//0
newlist.add(new DTCellValue52("YOA2 (Anlæg Sjælland 2)"));//1
list.add(newlist);
dt.setData(list);
String newContent = GuidedDTXMLPersistence.getInstance().marshal(dt);
request = new
ClientRequest("http://localhost:8080/drools-guvnor/rest/packages/KissProcessGenerator.Fu...");
request.header("Authorization", "Basic " +
base64encodedUsernameAndPassword);
request.body("application/xml", newContent);
try {
request.put();
return "SUCCESS";
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Above code works fine if inserted data is in english but if data to be
inserted is in danish letters alphabets are not stored properly.
Please find attached sreenshot. (Doc1_error.doc)
In screen shot in "Team" column danish letters are displayed as ? symbol.
I want to use charset=ISO-8859-1 for danish letters.
Please let me know how to allow danish letters in guvnor decision table
using above code. Doc1_error.doc
<http://drools.46999.n3.nabble.com/file/n4022029/Doc1_error.doc>
--
View this message in context: http://drools.46999.n3.nabble.com/Danish-letters-error-in-guvnor-decision...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Drools Clips
by Grant Rettke
Hi,
Anyone using or have used Drools Clips before? If so, what is your
opinion of it? If not, why not?
I'm pretty curious about it and wanted to start here before pinging
the dev list on who is maintaining it (nor not).
Best wishes,
--
Grant Rettke | ACM, AMA, COG, IEEE
grettke(a)acm.org | http://www.wisdomandwonder.com/
Wisdom begins in wonder.
((λ (x) (x x)) (λ (x) (x x)))
11 years, 9 months
Is it posibble to keep two date formats in drools like 'dd-MMM-yyyy' and 'dd-MMM-yyyy HH:mm'
by richie
Hi,
The default date format in drools is 'dd-MMM-yyyy', but in the definition of
rule attribute date-effective, it says it contain a date and time
definition, so if I set date-effective to "30-Jan-2013 08:00", then the time
set in date-effective will be ignored, so I changed the date format to
'dd-MMM-yyyy HH:mm', now the effective date works correctly, but then we got
problem here, if user input a date like "30-Jan-2013" the drools will failed
to execute, so must force user to input a date like this "30-Jan-2013
00:00", this is not user friendly and the string "00:00" is meaningless.
What I want to know is, if it's possible to keep this two formats both?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Is-it-posibble-to-keep-two-date-formats...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months