Hi, I have a bunch of facts in the knowledge base in the form: (PropertyValue pred subj obj). These are facts about football players.
A query to get the team name for a football player would be: (defquery team-search (declare (max-background-rules 100)) (PropertyValue rdf:type ?n football:FootballPlayer) (PropertyValue football:team ?n ?a) (PropertyValue rdf:value ?a ?s) ) Lets assume by running the query, we get a team name having value "Buffalo_Bills" for the FootballPlayer "player:Adams_Sam". I would now like to add a defrule which states: " A FootballPlayer can play for only one team." So when somebody tries to assert that the player also plays in another team..like this: (assert (PropertyValue football:Team player:Adams_Sam anonARP1234)) (assert (PropertyValue rdf:Value anonARP1234 Oakland_Raiders)) I should be able to report a violation and not assert these new facts into the knowledge base. What would be a good way to write such a rule. Here is my line of thought: I am trying to say: if count-query-results team-search returns 1, then a team value for the player already exists, and do not assert these facts (I am not clear how to write this as a Jess rule). I would appreciate any help in writing this rule. Please let me know if you need any other information. Also, let me know if there is another/better way of doing this. Thanks in advance, Kapil Dukle University of South Carolina -------------------------------------------------------------------- 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] --------------------------------------------------------------------
