JESS: compare slots but only with the last two instances

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JESS: compare slots but only with the last two instances

nikos erinis
hi fellows,
it's me again :)
i wrote to you about a week ago. i wanted to compare slots but i didnt get any answers. i realised the question was very "dumm".
i foun the solution on my own. 
but now i have a bigger problem. 
i just want to compare the slot of an instance but only with the last two instances and the next two instances...
is this possible!?
thank you for your time !
Reply | Threaded
Open this post in threaded view
|

RE: JESS: compare slots but only with the last two instances

Friedman-Hill, Ernest
Assuming that there's some definite ordering among your instances, you just need to make those explicit somehow -- give each instance a slot holding a serial number -- and then you can identify "the next two" and "the last two" by comparing those numbers. Otherwise it's the same as comparing any two facts.
 
If they're Java objects, you can generate the IDs in Java using a static member variable. if they're Jess facts, you could use the (default-dynamic) slot property to automatically create a value when the fact is asserted.


From: [hidden email] [mailto:[hidden email]] On Behalf Of nikos erinis
Sent: Wednesday, October 19, 2011 7:14 AM
To: jess-users
Subject: JESS: compare slots but only with the last two instances

hi fellows,
it's me again :)
i wrote to you about a week ago. i wanted to compare slots but i didnt get any answers. i realised the question was very "dumm".
i foun the solution on my own. 
but now i have a bigger problem. 
i just want to compare the slot of an instance but only with the last two instances and the next two instances...
is this possible!?
thank you for your time !
Reply | Threaded
Open this post in threaded view
|

Re: JESS: compare slots but only with the last two instances

nikos erinis
hey...thx a lot for your help, but i dont know how to make the loop stop in the next two instances.
i use the jesstab on protege so i have jess-facts after mapping.
i want to delete the instance which is in the middle of other instances (+ / - 2 instances) and has a different slot-value from the instances above and below. 

thank you for your help.!


On Wed, Oct 19, 2011 at 4:46 PM, Friedman-Hill, Ernest <[hidden email]> wrote:
Assuming that there's some definite ordering among your instances, you just need to make those explicit somehow -- give each instance a slot holding a serial number -- and then you can identify "the next two" and "the last two" by comparing those numbers. Otherwise it's the same as comparing any two facts.
 
If they're Java objects, you can generate the IDs in Java using a static member variable. if they're Jess facts, you could use the (default-dynamic) slot property to automatically create a value when the fact is asserted.


From: [hidden email] [mailto:[hidden email]] On Behalf Of nikos erinis
Sent: Wednesday, October 19, 2011 7:14 AM
To: jess-users
Subject: JESS: compare slots but only with the last two instances

hi fellows,
it's me again :)
i wrote to you about a week ago. i wanted to compare slots but i didnt get any answers. i realised the question was very "dumm".
i foun the solution on my own. 
but now i have a bigger problem. 
i just want to compare the slot of an instance but only with the last two instances and the next two instances...
is this possible!?
thank you for your time !