我已经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
有任何想法吗?
我们有一个本体,但我们需要使用推理器 HermiT 来推断给定表达的情绪。我们不知道如何在 python 中使用和实现推理器,我们在互联网上找不到很好的解释。我们发现我们可以为此使用 sync_reasoner() ,但这究竟是做什么的?我们是否每次都必须手动调用推理器还是自动发生?
我无法访问现有本体的类公理。我知道某个类包含我需要的公理。例如,类“cold”包含公理:
\n\n冷 \xe2\x8a\x93 啤酒 \xe2\x8a\x91 正,和
\n\n冷 \xe2\x8a\x93 披萨 \xe2\x8a\x91 负
\n\n有办法访问这些吗?
\n\nfrom 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\nRun Code Online (Sandbox Code Playgroud)\n\n提前致谢!
\n