Hello again,
thx for your help regarding my last question.
Now I have a new one!
(deftemplate RepositoryProcess "Slot1: id des Process', slot2:
initialElements"
(slot processId)
(multislot initialElements))
(deftemplate UserProcess "Slot1: id des Process, Slot2: selectedElements"
;; (slot userProcessId)
(multislot selectedElements))
I assert data to fact from java. I post it, but I don't know if is important
for my question.
....
Hashtable<Individual, Vector<Individual>>
repositoryProcessTable = new
Hashtable<Individual, Vector<Individual>>();
repositoryProcessTable.putAll(owlContainer.getRepositoryProcessTable());
// 1. Iterate over processes
for (Iterator processIter =
repositoryProcessTable.keySet().iterator();
processIter.hasNext();) {
Individual process =(Individual) processIter.next();
String processId = process.toString();
Fact f = new Fact("RepositoryProcess", engine);
f.setSlotValue("processId", new Value(processId,
RU.SYMBOL));
ValueVector vv = new ValueVector();
// 2. Iterate over Elements (Individuals)
for (Iterator initElementsIter =
repositoryProcessTable.get(process).iterator();
initElementsIter.hasNext();) {
Individual element = (Individual)
initElementsIter.next();
ExtendedIterator ie =
element.listRDFTypes(false);
findRDFType: while (ie.hasNext()) {
Object o = ie.next();
if (Petri.Transition.equals(o)) {
vv.add(new Value("trans",
RU.SYMBOL));
break findRDFType;
} else if (Petri.Place.equals(o)) {
vv.add(new Value("place",
RU.SYMBOL));
break findRDFType;
}
}
}
f.setSlotValue("initialElements", new Value(vv,
RU.LIST));
engine.assertFact(f);
}
marker = engine.mark();
}
......
public void loadUserModel() throws JessException {
Vector<Individual> selectedElements= new Vector<Individual>();
selectedElements.addAll(owlContainer.getVecSelectedElements());
Fact userFact = new Fact("UserProcess",engine);
ValueVector vv= new ValueVector();
for (Iterator selectedElementsIter =
selectedElements.iterator();
selectedElementsIter.hasNext();) {
Individual element = (Individual)
selectedElementsIter.next();
ExtendedIterator ie = element.listRDFTypes(false);
findRDFType: while (ie.hasNext()) {
Object o = ie.next();
if (Petri.Transition.equals(o)) {
vv.add(new Value("trans", RU.SYMBOL));
break findRDFType;
} else if (Petri.Place.equals(o)) {
vv.add(new Value("place", RU.SYMBOL));
break findRDFType;
}
}
}
userFact.setSlotValue("selectedElements", new
Value(vv,RU.LIST));
engine.assertFact(userFact);
}
....
As you can see, I just fill the facts and their multislots with "trans" or
"place".
Now my question:
I would like to write a rule which fires when for example.
in pseudo-code
if (selectedElements CONTAINS "trans" && initialElements CONTAINS "place")
then printout processId
So my main-problem is to compare elements/members of multislots in different
templates. I searched the online documentation and the "Jess in Action"-Book
for something like that and I could not find it. Probably I have overseen
something.
Another interesting rule would be:
If (SIZEOF selectedElements == SIZEOF initialElements)
then do somthing
Thank you again in advance for your help.
waschtl
--
View this message in context:
http://www.nabble.com/matching-in-two-multislots-of-two-different-templates-tf4695936.html#a13423072
Sent from the Jess mailing list archive at Nabble.com.
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------