简体   繁体   English

使用推理时如何提高sparql查询的性能?

[英]How can I increase performance of sparql query while using inferencing?

I want to increase performance of my sparql queries. 我想提高我的sparql查询的性能。 I have to run all type of sparql query. 我必须运行所有类型的sparql查询。 I have total 17,500,000 triples in the graph and i have other graph containg only knowledge. 我在图中共有17,500,000个三元组,而我还有其他仅包含知识的图。 this graph containing same as and subclassOf property. 此图包含和和subclassOf属性相同。 Total triples of this graph is around 50,000,000, I am using on the fly inferencing in the sparql query. 该图的三元组总数约为50,000,000,我正在sparql查询中进行即时推断。

I am using virtuoso as a database. 我正在使用virtuoso作为数据库。 It has inferencing functionality. 它具有推理功能。

When I run query with inferencing, it is taking 80 secs for simple query. 当我运行带有推断的查询时,简单查询需要80秒钟的时间。 and without using inferencing it is taking 10 secs. 并且不使用推断就需要10秒钟。

Sparql Query: Sparql查询:

 DEFINE input:inference 'myrule' 
 select DISTINCT  ?uri1  ?uri2  
 from <GRAPH_NAME>  
 where {?uri1   rdf:type ezdi:Aspirin. 
 ?patient ezdi:is_treated_with ?uri1. 
 ?patient rdf:type ezdi:Patient. 
 ?uri2 rdf:type ezdi:Hypertension .
 ?patient ezdi:is_suffering_with ?uri2. 
 ?patient rdf:type ezdi:Patient  } ORDER BY ?patient

I have done all the indexing providing by the virtuoso. 我已经完成了演奏家提供的所有索引。 System has 32 GB RAM. 系统具有32 GB RAM。 And I have done NumberOfBuffer setting virtuoso.ini file. 并且我已经完成了NumberOfBuffer设置virtuoso.ini文件。

I dont know what is the issue with inferencing. 我不知道推理有什么问题。 But I have to use Inferencing in the sparql Query. 但是我必须在sparql查询中使用推理。

If u know something then plz share ur idea. 如果您知道一些事情,请与我们分享您的想法。

Thank You 谢谢

An ontology of 5M triples is quite large, though strictly speaking, that's not problematic. 5M三元组的本体相当大,尽管严格地说,这没有问题。 Performance with regards to reasoning is far more closely tied to the expressivity of your ontology than it's size. 推理的性能与其本体的表现力紧密相关,而不是其大小。 You could create an ontology with several order of magnitude fewer triples that would be harder to reasoning with. 您可以创建一个本体,其本体的三元组数量要少几个数量级,这将很难进行推理。

With that said, there's not much I can specifically suggest. 话虽如此,我没有什么特别的建议。 Virtuoso specific tuning is best left to their developers, so you might get some traction on their mailing list. Virtuoso特定的调整最好留给他们的开发人员,因此您可能会在他们的邮件列表上有一些吸引力。

It appears that you're using some custom inferencing "my_rule" -- though in the comments you also claim RDFS & sameAs. 看来您正在使用一些自定义推断“ my_rule”-尽管在注释中您还声明了RDFS和sameAs。 You probably need to figure out what reasoning you're actually using, what profile (RDFS or OWL2 QL, RL, EL, DL) that your ontology falls into, and learn a little bit about how reasoning actually works. 您可能需要弄清楚您实际使用的推理,本体属于哪种配置文件(RDFS或OWL2 QL,RL,EL,DL),并了解推理的实际工作原理。 Further, equality reasoning is difficult, which you claim to be using in addition to RDFS. 此外,相等推理是困难的,您声称除了RDFS之外还要使用平等推理。 It might be possible that Virtuoso can compute the equivalence relations eagerly which could reduce the overhead of the query, but again, that is something you should take up with them on their mailing list. Virtuoso可能会急切地计算等价关系,从而减少查询的开销,但是同样,您应该在他们的邮件列表中处理这些问题。

Reasoning is not easy by any means, and there's no silver bullet for magically making reasoning faster beyond using a simpler, ie less expressive, ontology or less data, or both. 无论如何,推理都不是一件容易的事,并且没有比魔术师更容易使用推理的灵丹妙药了,而不仅仅是使用更简单的表达方式,本体论或数据更少,或两者兼而有之。

Lastly, you might try other databases which are designed for reasoning, such as OWLIM or Stardog . 最后,您可以尝试其他为推理而设计的数据库,例如OWLIMStardog Not all databases are created equal, and it's entirely possible you've encoded something in your TBox which Virtuoso might not handle well, but could be handled easily by another system. 并非所有数据库都是平等创建的,而且很有可能您已经在TBox中编码了Virtuoso可能无法很好处理但可以被另一个系统轻松处理的某些内容。

There are many factors which could lead to the performance issue you describe. 许多因素可能导致您描述的性能问题。 The most common is to make an error in the NumberOfBuffers setting in the INI file -- which we cannot see, and so cannot diagnose, here. 最常见的是在INI文件的NumberOfBuffers设置中产生错误-在这里我们看不到,因此无法诊断。

Questions specifically regarding Virtuoso are generally best raised on the public OpenLink Discussion Forums , the Virtuso Users mailing list , or through a confidential Support Case . 通常,最好在公开的OpenLink讨论论坛Virtuso用户邮件列表或通过机密的支持案例中提出有关Virtuoso的问题。 If you bring this there, we should be able to help you in more detail. 如果您将其带到那里,我们应该能够为您提供更多详细信息。

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

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