Re: JESS: get object from a list
"nikos erinis" <[email protected]> Tue, 11 Jan 2011 15:45:28 +0100
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <4345_1294793581_p0C0qxCQ006246_AANLkTikMQpx1LBR7HYvja1gGxoMHi+O_Qx-HJq-xcq8t@mail.gmail.com> |
I am working on protege 3.4.4 with JessTab and the query is in Jess! You are right, i am getting a real java.util.List and i could print out the list (i haven't tried it yet, i suppose it would work) but how can i sort out some of the elements of the list. i think it is better if i send you the code so you can see what i really want to do. i tried to write it as detailed as possible with comments and everything. thank you very much fo your time. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (clear) (reset) (import java.util.*) (mapclass ...) ;;(bind ?ceilinglist (new java.util.ArrayList)) (defquery SearchComponentsInProcess "all components with a specific process are being searched" (declare (variables ?QueriedProcess)) (object (is-a TragwerksBauteile) ) ;;... and the slot: hasProcess has the value: ?QueriedProcess ;; ;;I want to find all objects of a specific type that have a certain slotvalue. ) (defquery SearchBasedComponents "all components are being searched that support the upper structural component (basedOn...)" (declare (variables ?SupportiveComponent)) (object (is-a TragwerksBauteile) ) ;;... and the slot: basedOn has the value: ?SupportiveComponent ) (bind ?ListWithComponentsInProcess (run-query* SearchComponentsInProcess ShellProcess)) (while (?ListWithComponentsInProcess hasNext) do (bind ?bauteil (?ListWithComponentsInProcess next)) (bind ?ListWithBasedComponents (run-query* SearchBasedComponents ?bauteil)) (while (?ListWithBasedComponents hasNext) do (bind ?basedComponent (?ListWithBasedComponents next)) ;; z.B. für das gestützte Bauteil einen bestimmeten slot setzen ;; z.B. den Einschalungsprozess starten ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; On Mon, Jan 10, 2011 at 3:03 PM, Ernest Friedman-Hill <[email protected]>wrote: > On Jan 10, 2011, at 5:52 AM, nikos erinis wrote: > >> What I want to do is to separate classes with the same properties, so I >> defined a query. >> The thing is that I get back a "Java List" that I have no access to. So >> there is my question: >> How can I access the list so I can use some objects (instances) of the >> list? >> > > What sort of query, now? In Jess, or in Protege? > > If it's something in Protege that returns a real java.util.List, then you > could print out theList.get(0).getClass().getName() to find out what the > list elements are. But I'm not sure what the difficulty is that you're > having. > > > --------------------------------------------------------- > Ernest Friedman-Hill > Informatics & Decision Sciences, Sandia National Laboratories > PO Box 969, MS 9012, Livermore, CA 94550 > http://www.jessrules.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]