简体   繁体   English

推理没有给出相同的结果*

[英]Reasoning doesn't give same results with *

I am enabling Forward chaining like this: 我正在启用这样的正向链接:

static final String inputData = "http://cgi.di.uoa.gr/~pms509/past_projects/2014-2015/hw1/kallikratis.n3";
MemoryStore store = new MemoryStore();
Repository repo = new SailRepository(new ForwardChainingRDFSInferencer(store));
System.out.println("Forward chaining enabled");
repo.initialize();

//Store file
File file = new File(inputData);
String fileBaseURI = "http://www.semanticweb.org/owl/owlapi/turtle";
RDFFormat fileRDFFormat = RDFFormat.N3;

RepositoryConnection con = repo.getConnection();
con.add(file, fileBaseURI, fileRDFFormat);
...

and then I query like this: 然后我这样查询:

"SELECT ?class "                                +
"WHERE {"                                       +
        "?rsrc geo:has_name \"foo\" . "         +
        "?rsrc geo:belongs_to ?a ."             +
"}";

However this will not give me same results as with geo:belongs_to* . 但是这不会给我与geo:belongs_to*相同的结果。 I will get only the direct belongs_to linkage, not the inferred ones, as I would expect! 正如我所料,我只会获得直接的belongs_to链接,而不是推断的链接。

I want to get same results however, why I am not? 我想得到相同的结果,为什么我不是?

The RDFS inferencer only does, well, RDFS inferencing - that is, it reasons using the rules defined in the RDF Semantics . RDFS推理器只能执行RDFS推理 - 也就是说,它使用RDF语义中定义的规则。 These rules only cover relatively basic things such as subclass/type inheritance, and domain/range inference. 这些规则涵盖相对基本的事物,例如子类/类型继承和域/范围推断。 So for example, if your data has a class Car and it defines Car as a subclass of Vehicle , then the RDFS inferencer will infer that any instance of the class Car is also an instance of Vehicle . 因此,例如,如果您的数据具有Car类并且它将Car定义为Vehicle的子类,则RDFS推理器将推断Car类的任何实例也是 Vehicle的实例。

But this kind of inheritance only works for these specific relations (subclass, type, subpropertyof). 但是这种继承适用于这些特定的关系(子类,类型,子属性)。 It does not automatically infer in the general case, that if X someProperty Y and Y someProperty Z , that it then follows that X someProperty Z . 它不会在一般情况下自动推断,如果X someProperty YY someProperty Z ,那么它就跟着那个X someProperty Z

If you want that kind of reasoning support, you either need a custom rule reasoner (Sesame has some limited support for this, with improved support in the form of SPIN rules coming out soon), or you need to move to the next level of expressivity in ontology languages, which is OWL (in which case, a Sesame-compatible OWL reasoner like Ontotext GraphDB or Stardog is needed). 如果您需要这种推理支持,您需要一个自定义规则推理器(芝麻对此有一些有限的支持,以及即将推出的SPIN规则形式的改进支持),或者您需要进入下一级别的表达性在本体语言中,它是OWL(在这种情况下,需要与Ontotext GraphDB或Stardog一样的芝麻兼容的OWL推理器)。 Or alternatively, just solve it at query time (for example by using a transitive property path). 或者,只需在查询时解决它(例如通过使用传递属性路径)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM