[rules-dev] Xtext and the Rete DSL.
Mark Proctor
mproctor at codehaus.org
Mon Nov 8 06:34:40 EST 2010
On 08/11/2010 10:59, Wolfgang Laun wrote:
> What precisely do you mean by "Rete DSL"?
> -W
I wrote a low level testing DSL for rete networks a while back:
http://blog.athico.com/2009/11/rete-dsl-testing-harness.html
Hmm the new blog template needs some work....
You can see the tests here:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-core/src/test/resources/org/drools/reteoo/test/
The tests look a little like:
TestCase "Join Node assert/retract test case"
Setup
ObjectTypeNode:
otnLeft1, org.drools.Person;
LeftInputAdapterNode:
lian0, otnLeft1;
ObjectTypeNode:
otnRight1, org.drools.Person;
ObjectTypeNode:
otnRight2, org.drools.Person;
Binding:
p1, 0, org.drools.Person, age;
JoinNode:
join1, lian0, otnRight1;
age, !=, p1;
JoinNode:
join2, join1, otnRight2;
age, !=, p1;
Facts:
new org.drools.Person('darth', 35), new org.drools.Person('bobba', 36),
new org.drools.Person('yoda', 37), new org.drools.Person('luke', 38),
new org.drools.Person('dave', 33), new org.drools.Person('bob', 32);
Test "Assert/retract test"
/**
* check single left assertion and retraction
*/
assert:
otnLeft1, [h0];
join1:
leftMemory, [[h0]];
join2:
leftMemory, [];
retract:
otnLeft1, [h0];
/**
* check single right assertion and retraction
*/
assert:
otnRight1, [h1];
join1:
rightMemory, [h1];
join2:
leftMemory, [];
retract:
otnRight1, [h1];
/**
* check single left then right assertion
*/
assert:
otnLeft1, [h0];
otnRight1, [h1];
join1:
leftMemory, [[h0]];
rightMemory, [h1];
join2:
leftMemory, [[h0, h1]];
retract:
otnLeft1, [h0];
otnRight1, [h1];
/**
* check single right then left assertion
*/
assert:
otnRight1, [h1];
otnLeft1, [h0];
join1:
leftMemory, [[h0]];
rightMemory, [h1] ;
join2:
leftMemory, [[h0, h1]];
retract:
otnLeft1, [h0];
otnRight1, [h1];
>
> On 8 November 2010 11:33, Leonardo Gomes <leonardo.f.gomes at gmail.com
> <mailto:leonardo.f.gomes at gmail.com>> wrote:
>
> I've been using the Rete DSL a lot these days and was thinking
> that it could be a good idea to provide some Eclipse
> infra-structure (syntax highlighting, code completion, validation)
> to it using Xtext (http://www.eclipse.org/Xtext/). It's built on
> top of antlr, so maybe we could even reuse the grammar that we
> already have. I know that, by default, you should right you
> grammar using their simplified version.
>
> Maybe the guys there would also be interested in providing
> something to Drools. It could be a showcase for them.
>
> Not sure if this also applies to the Eclipse DRL things that we have.
>
> Cheers,
> Leonardo.
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org <mailto:rules-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20101108/be6ac38f/attachment.html
More information about the rules-dev
mailing list