944,072 Members | Top Members by Rank

Ad:
Nov 29th, 2006
0

Anyone familiar with Jess?

Expand Post »
Hello to all!

I've been parusing this site for awhile now, must say that its very helpful for tips and learning about coding in general.

Anyways, here is my first foray into posting and of course, it begins with a question.

I have to emulate a blood bank in Jess and i'm running into some problems with the output. Here's what I have so far:

(deftemplate person "the person template"
    (slot name)
    (slot blood)
)

(deftemplate blood "the blood type template"
    (slot kind)
    (slot is-compatible-with)
    (slot not-compatible)
)
    
(deffacts blood-bank-clients
    (person (name John)(blood O))
    (person (name Paul)(blood A))
    (person (name George)(blood B))
    (person (name Ringo)(blood AB))
    (blood (kind O) (is-compatible-with O) 
        (kind O)(not-compatible A)
        (kind O)(not-compatible B)
        (kind O)(not-compatible AB) )
    (blood (kind A) (is-compatible-with O)
    (kind O)(is-compatible-with A)
            (kind A)(not-compatible B)
            (kind A)(not-compatible AB) )
    (blood (kind B) (is-compatible-with O)
    (kind B)(is-compatible-with B)
            (kind B)(not-compatible A)
            (kind B)(not-compatible AB) )
    (blood (kind AB) (is-compatible-with O)
    (kind AB)(is-compatible-with A)
    (kind AB)(is-compatible-with B)
    (kind AB)(is-compatible-with AB) )
)

(defrule compatible
        (person (name ?person1) (blood ?kind1))
        (person (name ?person2) (blood ?kind2))
        (blood (kind ?kind1) (is-compatible-with ?kind2))
        =>
        (assert (compatible ?person1 ?person2))
)

(defrule match
         (compatible ?person1 ?person2)
         (compatible ?person2 ?person1)
         (test (neq ?person1 ?person2))
         =>
         (printout t " is compatible with " ?person1 " to " ?person2 crlf) 
)
I'm having major problems understanding what's going on because our professor's material on Jess is quite sparse and useless. I can get the facts to load properly, but for some reason it's not printing out who is compatible with who based on blood type.

Any help would be great!

- Indy
Last edited by Indymaestro; Nov 29th, 2006 at 7:24 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Indymaestro is offline Offline
2 posts
since Nov 2006
Nov 29th, 2006
0

Re: Anyone familiar with Jess?

Welcome out of the world of the lurkers and into the world of the posters! Never heard of Jess but kinda looks like scheme to me.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,646 posts
since Feb 2002
Nov 29th, 2006
0

Re: Anyone familiar with Jess?

Thanks for the greeting.

From what I can garner, Jess is a rule-based programming language used for expert systems.

Wow, going to lectures *are* really paying off!
Last edited by Indymaestro; Nov 29th, 2006 at 7:39 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Indymaestro is offline Offline
2 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Prolog permutation
Next Thread in Legacy and Other Languages Forum Timeline: float 2 binary help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC