以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 Semantic Web(语义Web)/描述逻辑/本体 』 (http://bbs.xml.org.cn/list.asp?boardid=2) ---- 关于jena rule的写法 (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=47224) |
-- 作者:ttlxzzccc -- 发布时间:5/20/2007 4:49:00 PM -- 关于jena rule的写法 请问各位大侠,使用jena进行推理时,rule怎样写呀? 小弟看了api,可是不太明白。 Representation of a generic inference rule. This represents the rule specification but most engines will compile this specification into an abstract machine or processing graph. The rule specification comprises a list of antecendents (body) and a list of consequents (head). If there is more than one consequent then a backchainer should regard this as a shorthand for several rules, all with the same body but with a singleton head. Each element in the head or body can be a TriplePattern, a Functor or a Rule. A TriplePattern is just a triple of Nodes but the Nodes can represent variables, wildcards and embedded functors - as well as constant uri or literal graph nodes. A functor comprises a functor name and a list of arguments. The arguments are Nodes of any type except functor nodes (there is no functor nesting). The functor name can be mapped into a registered java class that implements its semantics. Functors play three roles - in heads they represent actions (procedural attachement); in bodies they represent builtin predicates; in TriplePatterns they represent embedded structured literals that are used to cache matched subgraphs such as restriction specifications. We include a trivial, recursive descent parser but this is just there to allow rules to be embedded in code. External rule syntax based on N3 and RDF could be developed. The embedded syntax supports rules such as: [ (?C rdf:type *), guard(?C, ?P) -> (?c rb:restriction some(?P, ?D)) ]. 那位大侠具体讲解一下,举几个例子。小弟感激不尽!!! |
-- 作者:iamwym -- 发布时间:5/20/2007 7:53:00 PM -- 参看SWRL的文档 |
-- 作者:ttlxzzccc -- 发布时间:5/20/2007 9:45:00 PM -- 谢谢iamwym学长。 SWRL的文档?那是什么?^_^小弟是初学者,能不能给讲解一下!!哈哈 |
-- 作者:ttlxzzccc -- 发布时间:5/21/2007 3:46:00 PM -- 看了看Jena 2 Inference support中的The general purpose rule engine ,有点明白了。 可是对其中的前向和后向两种规则还是有点疑问。 前向应该类似于产生式规则,即“如果,那么” 后向好像是找的充分条件似的,即给定目标,找出满足目标的充分条件。 我理解的对吗?各位大侠,给点建议。最好有实例看看,尤其是后向规则,不知道怎么用! 谢谢大家 |
-- 作者:ttlxzzccc -- 发布时间:5/23/2007 9:34:00 AM -- 大家给个意见哈! |
-- 作者:ttlxzzccc -- 发布时间:5/24/2007 2:25:00 PM -- 大家教教小弟!!! |
-- 作者:askaloe -- 发布时间:6/4/2007 12:21:00 AM -- 嗯 我也很想知道jena rule和swrl的关系 |
-- 作者:daximen -- 发布时间:6/6/2007 9:52:00 PM -- 我也接触不久,理解的和你差不多吧,没用过swrl,感觉只是换了一种方式而已。 Jena自带的例子就有用general purpose rule的,你可以运行一下看看。 比如那个 demo.rules可以结合自己的例子写成: # Example rule file @prefix family: <http://www.owl-ontologies.com/Ontology1180361972.owl#>. [rule1: (?A family:hasSibling ?B), (?B family:hasSibling ?C),notEqual(?A,?B) -> (?A family:hasSibling ?C) ] [rule2: (?A family:hasFather ?B),(?B family:hasFather ?C)->(?A family:hasGrandfather ?C)] 然后 sparql查一下就可以看出推理的结果了。 后向的也没用过。 |
-- 作者:liukun19851007 -- 发布时间:12/13/2007 4:32:00 PM -- Rule := bare-rule or [bare-rule] or [ruleName:bare-rule] bare-rule:= term,term.....term->hterm,...hterm //前向推理 or term,term.....term<--term,...term //后向推理 hterm := term or [bare-rule] term := (node,node,node) //三元组 or (node,node,functor) //扩展三元组 or builtin(node,.....node) //调用处理元语 functor := functorName(node,...node) //结构化文字表达 node := uri-ref or prefix:localname //例如:rdf:type or ?varname //变量名 or 'a literal' //字符串 or number //一个数字 |
-- 作者:liukun19851007 -- 发布时间:12/13/2007 4:37:00 PM -- 例如:rule:(?x subclassof ?y),(?y subclassof ?z)->(?x,subclassof,?z) 就是其中的一种格式,以此类推。。 |
-- 作者:HONGDAXIANG -- 发布时间:5/16/2011 10:48:00 PM -- 谁有资料啊???共享啊!! |
-- 作者:aiju0101 -- 发布时间:8/12/2011 4:36:00 PM -- 前向规则容易理解,后向的怕有些困难了! rules的书写却实是难点啊 |
-- 作者:wangtao534 -- 发布时间:9/9/2011 1:17:00 PM -- 去jena 官方网站上看看文档 |
-- 作者:风余 -- 发布时间:3/14/2012 7:18:00 PM -- 哪里有详细的资料看啊? |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
77.881ms |