简体   繁体   English

OWLOntologyManager.addAxioms()操作的价格是多少?

[英]How expensive is the OWLOntologyManager.addAxioms() operation?

I was wondering how expensive (time-wise) the 我想知道(在时间上)

OWLOntologyManager.addAxioms(OWLOntology ont, java.util.Set<? extends OWLAxiom> axioms)

operation is. 操作是。 The main reason I am asking is I am working with a very large dataset and wanted to know if it would be more efficient to add axioms to my ontology immediately as they are created or wait until all the axioms are ready and add them in one method call? 我要问的主要原因是我正在使用一个非常大的数据集,并想知道在创建它们时立即将公理添加到我的本体还是等待直到所有公理都准备好并以一种方法添加它们会更有效呼叫?

Additionally, and this is just because I'm curious, are the various OWLAxiom creation methods constant time operations ? 另外,这只是因为我很好奇,各种OWLAxiom创建方法是恒定时间操作吗? If not, how expensive are they? 如果没有,它们的价格是多少?

Just in case you are wondering, I plan to apply the pellet reasoner in a buffering mode and flush the changes once all ontology modifications are complete. 万一您想知道,我计划在缓冲模式下应用粒子推理程序,并在完成所有本体修改后刷新更改。

Adding axioms requires a few maps to be updated (depending on the type of axiom, one or more indexes may exist). 添加公理需要更新一些映射(取决于公理的类型,可能存在一个或多个索引)。 If there are listeners waiting to hear about changes to an ontology, they will be notified as well - it is up to the listener whether or not expensive operations are carried out. 如果有听众在等待听到有关本体更改的信息,则也会通知他们-是否执行昂贵的操作取决于听众。

Reasoners are an example of listeners: typically they will collect axioms until flush() is called, in a temporary collection. 推理程序是侦听器的一个示例:通常,它们将在临时集合中收集公理,直到调用flush()为止。

Time cost wise, this should amount to one or more insertions in a hash map (or concurrent hash map), and iteration on a list of listeners, usually containing very few elements. 从时间上考虑,这应该等于在一个哈希映射(或并发哈希映射)中插入一个或多个,并在一个侦听器列表上进行迭代,通常只包含很少的元素。 The cost is expected to be close to constant, however for large ontologies the increase in memory use might cause slowdown for garbage collection. 成本预计将接近恒定,但是对于大型本体,内存使用量的增加可能会导致垃圾收集速度变慢。

For recent versions of OWL API (4.0.2, for example) adding axioms as the ontology is being parsed from a file uses temporary lists rather than sets - this reduces the hashing cost. 对于最新版本的OWL API(例如,4.0.2),在从文件中解析本体时添加公理使用临时列表而非集合-这样可以减少哈希成本。 The lists are turned into sets once loading finishes - on the first read access to the axiom collections, to be precise. 一旦加载完成,这些列表就会变成集合-确切地说,是在对公理集合的首次读取访问中。

When compared with reasoning costs, any of these costs should be irrelevant - reasoning is expected to take much longer, as it is a much more complex operation. 与推理成本相比,这些成本中的任何一个都应该无关紧要-推理将花费更长的时间,因为它的操作要复杂得多。

Buffering and then flushing once changes are completed is likely to be the best strategy in this case. 在这种情况下,缓冲并在完成更改后进行刷新可能是最好的策略。

OWL API could use better batching of axioms for insertion, but in its current versions there is little difference between adding a set of axioms and adding a single axiom. OWL API可以使用更好的批量公理进行插入,但是在其当前版本中,添加一组公理和添加单个公理之间几乎没有区别。

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

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