以文本方式查看主题 - W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL (http://bbs.xml.org.cn/index.asp) -- 『 Semantic Web(语义Web)/描述逻辑/本体 』 (http://bbs.xml.org.cn/list.asp?boardid=2) ---- 如何在ontModel上合用owl自带规则和自定义规则 (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=53646) |
-- 作者:anzhiruosu -- 发布时间:10/11/2007 3:01:00 PM -- 如何在ontModel上合用owl自带规则和自定义规则 看了jena中有关推理的文档,好像如果想应用自定义规则的话,只能建立一个infmodel,这样的话infmodel就不包含owl语言自带的规则,比如那些transtive,functional规则。我现在想直接建立一个ontmodel,这样可以用ontModelSpec.OWL_MEN_RULE_INF来设置这个模型,然后我还想在上面运用自定义规则。请问该如何操作才能达到这个目的? |
-- 作者:jpz6311whu -- 发布时间:10/13/2007 3:35:00 PM -- Combining RDFS/OWL with custom rules Sometimes one wishes to write generic inference rules but combine them with some RDFS or OWL infernece. With the current Jena architecture limited forms of this is possible but you need to be aware of the limitations. There are two ways of achieving this sort of configuration within Jena (not counting using an external engine that already supports such a combination). Firstly, it is possible to cascade reasoners, i.e. to construct one InfModel using another InfModel as the base data. The strength of this appoach is that the two inference processes are separate and so can be of different sorts. For example one could create a GenericRuleReasoner whose base model is an external OWL reasoner. The chief weakness of the approach is that it is "layered" - the outer InfModel can see the results of the inner InfModel but not vice versa. For some applications that layering is fine and it is clear which way the inference should be layered, for some it is not. A second possible weakness is performance. A query to an InfModel is generally expensive and involves lots of queries to the data. The outer InfModel in our layered case will typically issue a lot of queries to the inner model, each of which may trigger more inferenece. If the inner model caches all of its inferences (e.g. a forward rule engine) then there may not be very much redundancy there but if not then performance can suffer dramatically. Secondly, one can create a single GenericRuleReasoner whose rules combine rules for RDFS or OWL and custom rules. At first glance this looks like it gets round the layering limitation. However, the default Jena RDFS and OWL rulesets use the Hybrid rule engine. The hybrid engine is itself layered, forward rules do not see the results of any backward rules. Thus layering is still present though you have finer grain control - all your inferences you want the RDFS/OWL rules to see should be forward, all the inferences which need all of the results of the RDFS/OWL rules should be backward. Note that the RDFS and OWL rulesets assume certain settings for the GenericRuleReasoner so a typical configuration is: Model data = FileManager.get().loadModel("file:data.n3"); Where the myrules.rules file will use @include to include one of the RDFS or OWL rule sets. One useful variant on this option, at least in simple cases, is to manually include a pure (non-hybrid) ruleset for the RDFS/OWL fragment you want so that there is no layering problem. [The reason the default rulesets use the hybrid mode is a performance tradeoff - trying to balance the better performance of forward reasoning with the cost of computing all possible answers when an application might only want a few.] A simple example of this is that the interesting bits of RDFS can be captured by enabled TranstiveClosureCaching and including just the four core rules: [rdfs2: (?x ?p ?y), (?p rdfs:domain ?c) -> (?x rdf:type ?c)]
|
-- 作者:bzbc -- 发布时间:10/15/2007 5:37:00 PM -- 楼上你说后面的那几个规则是意思呢? |
-- 作者:jpz6311whu -- 发布时间:10/15/2007 10:26:00 PM -- 关于rdfs2,rdfs3...这些规则在w3c官方网站上的RDF Semantic文档中有介绍: http://www.w3.org/TR/rdf-mt/ |
-- 作者:hunterdong -- 发布时间:11/14/2007 4:09:00 PM -- 非常有用,多谢。。 居然出自 Jena Inference support而我没看到,汗一个。。。 OWL_MEN_RULE_INF这个东东好像只有api里有。。网上没任何介绍 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
58.594ms |