新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Semantic Web(语义Web,语义网或语义万维网, Web 3.0)及相关理论,如:Ontology(本体,本体论), OWL(Web Ontology Langauge,Web本体语言), Description Logic(DL, 描述逻辑),RDFa,Ontology Engineering等。
    [返回] 中文XML论坛 - 专业的XML技术讨论区W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → jess in Action 中的第一个例子,运行不出结果,懂的帮忙看看,谢谢! 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3996 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: jess in Action 中的第一个例子,运行不出结果,懂的帮忙看看,谢谢! 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     csuxiao 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:15
      积分:107
      门派:W3CHINA.ORG
      注册:2009/12/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给csuxiao发送一个短消息 把csuxiao加入好友 查看csuxiao的个人资料 搜索csuxiao在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看csuxiao的博客楼主
    发贴心情 jess in Action 中的第一个例子,运行不出结果,懂的帮忙看看,谢谢!

    这是我的代码,主要抄书上的
    (deftemplate pants-color (slot of) (slot is))
    (deftemplate position (slot of) (slot is))

    ;;(pants-color (of Bob) (is red))

    (defrule generate-possibilities
       => (foreach ?name (create$ Fred Joe Bob Tom)
            (foreach ?color (create$ red blue plaid orange)
                (assert (pants-color (of ?name)
                    (is ?color))))
        (foreach ?positon (create$ 1 2 3 4)
            (assert (position (of ?name)
                    (is ?position))))
        ))


    (defrule find-solution
    ;; There is a golfer named Fred, whose position is ?p1
    ;; and pants color is ?c1
    (position (of Fred) (is ?p1))
    (pants-color (of Fred) (is ?c1))
    ;; The golfer to Fred's immediate right
    ;; is wearing blue pants.
    (position (of ?n&~Fred)
    (is ?p&:(eq ?p (+ ?p1 1))))
    (pants-color (of ?n&~Fred)
    (is blue&~?c1))
        
    ;; Joe is in position #2
    ;;(position (of Joe) (is ?p2&2&~?p1))
    ;;(pants-color (of Joe) (is ?c2&~?c1))
        
    ;; We don't know anything about Joe, really
    (position (of Joe) (is ?p2&~?p1))
    (pants-color (of Joe) (is ?c2&~?c1))   
        
    ;; Bob is wearing the plaid pants
    (position (of Bob)
    (is ?p3&~?p1&~?p&~?p2))
    (pants-color (of Bob&~?n)
    (is plaid&?c3&~?c1&~?c2))
        
    ;; Tom isn't in position 1 or 4
    ;; and isn't wearing orange
    (position (of Tom&~?n)
    (is ?p4&~1&~4&~?p1&~?p2&~?p3))
    (pants-color (of Tom)
    (is ?c4&~orange&~blue&~?c1&~?c2&~?c3))
        
        
    =>
    (printout t Fred " " ?p1 " " ?c1 crlf)
    (printout t Joe " " ?p2 " " ?c2 crlf)
    (printout t Bob " " ?p3 " " ?c3 crlf)
    (printout t Tom " " ?p4 " " ?c4 crlf crlf))   

    用Eclipse运行结果,居然没有结果

    Jess, the Rule Engine for the Java Platform
    Copyright (C) 2008 Sandia Corporation
    Jess Version 7.1p2 11/5/2008
    然后就完了.......

    使用jess直接运行是这样的
    Jess> (batch "examples/reason.clp")
    TRUE
    结果只有个TRUE,到底是怎么回事啊
    书上说应该显示为
    Fred 1 orange
    Joe 2 blue
    Bob 4 plaid
    Tom 3 red
    请各位指教!!!


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2010/3/19 19:51:00
     
     csuxiao 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:15
      积分:107
      门派:W3CHINA.ORG
      注册:2009/12/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给csuxiao发送一个短消息 把csuxiao加入好友 查看csuxiao的个人资料 搜索csuxiao在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看csuxiao的博客2
    发贴心情 
    还有。。。谁有 jess  in action 的代码么,怎么到官方网站下不了啊?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2010/3/19 20:15:00
     
     csuxiao 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:15
      积分:107
      门派:W3CHINA.ORG
      注册:2009/12/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给csuxiao发送一个短消息 把csuxiao加入好友 查看csuxiao的个人资料 搜索csuxiao在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看csuxiao的博客3
    发贴心情 
    怎么没有搭理呢?Jess 的这个程序为什么运行不来呢?有没有高手知道呢?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2010/3/23 9:25:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/19 23:14:55

    本主题贴数3,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    46.875ms