JESS: Cant get rule to run

View: New views
3 Messages — Rating Filter:   Alert me  

JESS: Cant get rule to run

by Uiratan Cavalcante :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all, i have these functions:

(defrule MASKCreate
  (ModelingTask (task ArchitecturalDesignTask) (ref ?ArchitecturalDesignTask&~nil))
  ?MAKSTask <- (ModelingTask (task MASKModeling) (ref nil))
  =>
  (bind ?ref (make-instance of "Multi-agent Society Knowledge Modeling" (name (str-cat "Multi-agent Society Knowledge Modeling of " ?*project*))))
  (modify ?MAKSTask (name (str-cat "Multi-agent Society Knowledge Modeling of " ?*project*)) (ref ?ref))

  (slot-insert$ ?ArchitecturalDesignTask subtasks 1 ?ref)

  (assert (ModelingProduct (product MASKModel)))
)

(defrule MASKModelTransformation
  (ModelingProduct (product ArchitecturalModel) (ref ArchitecturalModel&~nil))
  (ModelingTask (task MASKModeling) (ref MASKModeling&~nil))
  ?MASKModel <- (ModelingProduct (product MASKModel) (ref nil))
  =>
  (bind ?modelname (str-cat "Multi-agent Society Knowledge Model of " ?*project*))

  (bind ?model (make-instance of "Multi-agent Society Knowledge Model" (name ?modelname)))
  (slot-set ?MASKModel (?name ?modelname) (ref ?model))

  (slot-set ?MASKModeling products ?model)
  (slot-insert$ ?ArchitecturalModel subproducts 1 ?model)

)


When i put

(assert (ModelingTask (task MASKModeling)))

(run)

Its all ok, i got MASKCreate to execute.

At this time i have in my facts:

(MAIN::ModelingProduct (product ArchitecturalModel) (name "Architectural Model of Uiratan") (ref <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>))

(MAIN::ModelingTask (task MASKModeling) (name "Multi-agent Society Knowledge Modeling of Uiratan") (ref <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>))

(MAIN::ModelingProduct (product MASKModel) (name nil) (ref nil))


So, anyone has any idea why cant i run MASKModelTransformation?



Best regards,



--
Uiratan Cavalcante              +55 (98) 8138-9212
TI/TRT-16-MA    (Manhã)     +55 (98) 2109-9430    http://www.trt16.gov.br
GESEC/UFMA   (Tarde)      +55 (98) 2109-8297    http://gesec.deinf.ufma.br
São Luís - MA - Brazil

Re: JESS: Cant get rule to run

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 17, 2009, at 3:29 PM, Uiratan Cavalcante wrote:

> (defrule MASKModelTransformation
>   (ModelingProduct (product ArchitecturalModel) (ref  
> ArchitecturalModel&~nil))


I think you intended that second "ArchitecturalModel" to be a variable  
(?ArchitecturalModel). As it is, it's a symbol, and it definitely  
doesn't match the facts in working memory.

Using the JessDE to edit your code would help in this case; the syntax  
coloring would let you more easily spot errors like this.



---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            ejfried@...
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Cant get rule to run

by Uiratan Cavalcante :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah, that´s it.

Whens these mistakes happens, its time to take a coffee! =)

Thanks, man.


2009/6/17 Ernest Friedman-Hill <ejfried@...>

On Jun 17, 2009, at 3:29 PM, Uiratan Cavalcante wrote:

(defrule MASKModelTransformation
 (ModelingProduct (product ArchitecturalModel) (ref ArchitecturalModel&~nil))


I think you intended that second "ArchitecturalModel" to be a variable (?ArchitecturalModel). As it is, it's a symbol, and it definitely doesn't match the facts in working memory.

Using the JessDE to edit your code would help in this case; the syntax coloring would let you more easily spot errors like this.




--
Uiratan Cavalcante              +55 (98) 8138-9212
TI/TRT-16-MA    (Manhã)     +55 (98) 2109-9430    http://www.trt16.gov.br
GESEC/UFMA   (Tarde)      +55 (98) 2109-8297    http://gesec.deinf.ufma.br
São Luís - MA - Brazil