python中面向本体的编程模块:将owl 2.0本体作为python对象加载、修改、保存为owl xml,并通过hermit进行推理。它还可以生成用于编辑实例的对话框。
Owlread的Python项目详细描述
owlready(以前称为ontopy)是python 3中面向本体编程的模块。
note:owlready已被弃用,取而代之的是新版本owlready2:
http://bitbucket.org/jibalamy/owlready2(开发版)
https://pypi.python.org/pypi/Owlready2(稳定版)
猫头鹰罐头:
- Import and export OWL 2.0 ontologies in the OWL/XML format (other file formats are not yet supported).
- Manipulates ontology classes, instances and properties transparently, as if they were normal Python objects.
- Add Python methods to ontology classes.
- Perform automatic classification of classes and instances, using the HermiT reasoner.
- Automatically generate dialog boxes for editing ontology instances, using Editobj3.
owlready是由jean baptiste lamy在limics研究实验室创建的。 它在gnu lgpl许可v3下可用。 如果您在科学著作中使用owlready,请引用以下文章:
Lamy JB. Owlready: Ontology-oriented programming in Python with automatic classification and high level constructs for biomedical ontologies. Artificial Intelligence In Medicine 2017;80C:11-28
如有任何问题或意见,请使用此论坛/邮件列表:http://owlready.8326.n8.nabble.com
我能拿猫头鹰做什么?
从本地存储库或Internet加载本体:
>>> from owlready import * >>> onto_path.append("/path/to/your/local/ontology/repository") >>> onto = get_ontology("http://www.lesfleursdunormal.fr/static/_downloads/pizza_onto.owl") >>> onto.load()
在本体中创建新类,可能混合OWL限制和Python方法:
>>> class NonVegetarianPizza(onto.Pizza): ... equivalent_to = [ ... onto.Pizza ... & ( restriction("has_topping", SOME, onto.MeatTopping) ... | restriction("has_topping", SOME, onto.FishTopping) ... ) ] ... def eat(self): print("Beurk! I'm vegetarian!")
访问本体类,并创建新实例/个体:
>>> onto.Pizza pizza_onto.Pizza >>> test_pizza = onto.Pizza("test_pizza_owl_identifier") >>> test_pizza.has_topping = [ onto.CheeseTopping(), ... onto.TomatoTopping(), ... onto.MeatTopping () ]
导出到owl/xml文件:
>>> test_onto.save()
进行推理,并对实例和类进行分类:
>>> test_pizza.__class__ onto.Pizza >>> # Execute HermiT and reparent instances and classes >>> onto.sync_reasoner() >>> test_pizza.__class__ onto.NonVegetarianPizza >>> test_pizza.eat() Beurk! I'm vegetarian !
有关更多文档,请查看源代码中的doc/和doc/examples/目录。
更改日志
0.2
- 在Windows下修复sync_reasoner和hermit调用(感谢Clare Grasso)
0.3
- 添加警告
- 接受不以“.owl”结尾的本体文件
- 修复加载本体时的错误,包括IRI中没有“”的概念
0.3.1
- 添加到owlready2和nabble论坛/邮件列表的链接
- 从文件添加加载本体
- 添加卸载所有本体()
- 删除调试文件/tmp/sortie_hermit.txt
- 在doc和readme中添加医学科学文章中的人工智能
链接
bitbucket上的owlready(开发存储库):https://bitbucket.org/jibalamy/owlready
pypi上的owlready(python包索引,稳定版本):https://pypi.python.org/pypi/Owlready
文档:http://pythonhosted.org/Owlready
论坛/邮件列表:http://owlready.8326.n8.nabble.com
联系“Jiba”Jean Baptiste Lamy:
<jean-baptiste.lamy *@* univ-paris13 *.* fr> LIMICS University Paris 13, Sorbonne Paris Cité Bureau 149 74 rue Marcel Cachin 93017 BOBIGNY FRANCE