标签: owlready

使用 owlready 合并两个本体

我已经2 ontologies使用owlready2库做了

list(ontology1.classes())             

[old_dataset_ontology.weather,
 old_dataset_ontology.season]

list(ontology1.individuals())

[old_dataset_ontology.rainy,
 old_dataset_ontology.windy,
 old_dataset_ontology.cold,
 old_dataset_ontology.clouds]


list(ontology2.classes())             

[new_dataset_ontology.weather,
 new_dataset_ontology.season,
 new_dataset_ontology.season1]

list(ontology2.individuals())

[new_dataset_ontology.rainy,
 new_dataset_ontology.windy,
 new_dataset_ontology.cold1]
Run Code Online (Sandbox Code Playgroud)

我想要merge他们,但我找不到办法olwready2。文档中没有任何内容。我只想要一个简单的字符串匹配并删除重复的类和 indiv

有任何想法吗?

python owl ontology python-3.x owlready

6
推荐指数
1
解决办法
565
查看次数

在 Python 中使用 HermiT

我们有一个本体,但我们需要使用推理器 HermiT 来推断给定表达的情绪。我们不知道如何在 python 中使用和实现推理器,我们在互联网上找不到很好的解释。我们发现我们可以为此使用 sync_reasoner() ,但这究竟是做什么的?我们是否每次都必须手动调用推理器还是自动发生?

python ontology hermit reasoner owlready

5
推荐指数
1
解决办法
604
查看次数

Owlready2 访问公理

我无法访问现有本体的类公理。我知道某个类包含我需要的公理。例如,类“cold”包含公理:

\n\n

冷 \xe2\x8a\x93 啤酒 \xe2\x8a\x91 正,和

\n\n

冷 \xe2\x8a\x93 披萨 \xe2\x8a\x91 负

\n\n

有办法访问这些吗?

\n\n
from owlready2 import *   \n\nonto_path.append("\\Path_to_owl_file")\nonto = get_ontology("some_owl_file.owl")\nonto = onto.load()\n\nclasses = list(onto.classes()) # Get all classes from the ontology\n\nfirst_class = classes[0]\n# Access axioms from this class\n
Run Code Online (Sandbox Code Playgroud)\n\n

提前致谢!

\n

python ontology python-3.x owlready

5
推荐指数
0
解决办法
663
查看次数

标签 统计

ontology ×3

owlready ×3

python ×3

python-3.x ×2

hermit ×1

owl ×1

reasoner ×1