在Python中加载本体
我有一个用 OWL 编写的本体。有谁知道我可以将它加载到 python 中吗?任何软件包甚至手动? 其他问题中提到的 rdflib 不适合我,因为它主要与 RDF 相关,而“Seth”这个非常好的库不起作用,因为它需要“Pellet”库,而该库的网站似乎已关闭并且它(seth) 也仅适用于 JVM 1.4!
I have an Ontology written in OWL. Does anyone know I can load it into python? any packages or even manually?
rdflib which is mentioned in other questions is not suitable for me because it mainly concerns with RDF and "Seth" which is a very nice library doesn't work, because it requires "Pellet" library for which the website seems to be down and it(seth) also only works with JVM 1.4!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我还没有完全尝试过这一点,但是您可以考虑将本体加载到 Sesame 数据库中,然后查询它使用 Python 包装器。我玩过 RDFAlchemy 和 pySesame 一点,但我仍然不知道它们有多好。总的来说,RDF/OWL 数据库对我来说非常不成熟,因此预计会遇到一些重大的技术障碍。
I've not fully tried this, but you could look at loading your ontology into a Sesame database and then query it using a Python wrapper. I've played with RDFAlchemy and pySesame a little, but I still don't have a feel for how good they are. RDF/OWL databases feel very immature to me in general, so expect to encounter some significant technical hurtles.
如果有人再次偶然发现这个问题,这个包现在可用于与 Python 中的 OWL 本体进行交互: https:// /pypi.org/project/Owlready2/
从项目描述来看,它具有以下功能:
In case anyone stumbles across this question again, this package is now available for interacting with OWL ontologies in Python: https://pypi.org/project/Owlready2/
From the project description, it has these capabilities:
在 rdfAlchemy 中的 commands.py 文件中有一个命令部分就是为此目的而启动的。有一段时间没有使用它了,但它正是您所问问题的开始,即从本体创建 python 骨架。
事实上,它使用粘贴“命令”。如果您转到 rdfalchemy 子目录并输入:
paster rdfSubject -h
,您应该看到:
Within rdfAlchemy in the commands.py file there is commands section that was started for just this purpose. Haven't used it in a while but it is the beginings of exactly what you asked about i.e. creating the python skel from an ontology.
In fact, it uses paster "commands". If you go to the rdfalchemy subdir and type:
paster rdfSubject -h
you should see:
是的,RDFLib 适用于 RDF 语义,因此您需要一个工具包来管理 OWL 语义。
我通常首先使用另一个工具来获取所有三元组(OWLAPI 或 OWLRL),然后将其加载到 RDFLib 中。
Right, RDFLib works at the RDF semantics, so you'd need a toolkit for managing OWL semantics.
What I usually do it to first use another tool to get all the triples (OWLAPI or OWLRL, for instance) and then load it in RDFLib.
我还可以找到这个 ordf 但似乎他们刚刚为自己写了一些文字完全不清楚如何使用,很遗憾!
I could also find this ordf but it seems that they have just written some text for themsleves it is not clear at all how to use it, it's a pity!