简体   繁体   English

我应该把我的 owl 文件放在哪里,以便通过 python owlready 加载

[英]where should i put my owl file in order to loadable via python owlready

I'm being in final project of my study.我正在学习的最后一个项目中。 I analyze public conversation about governor election in twitter by mention and hashtag.我通过提及和标签来分析推特上关于州长选举的公开对话。 And then I make an ontology from its result.然后我根据它的结果制作一个本体。 The ontology I make manually with protege and wish to run this protege OWL file with python.我用 protege 手动制作的本体,并希望用 python 运行这个 protege OWL 文件。 According to this link , we can load local copy of the OWL file根据此链接,我们可以加载 OWL 文件的本地副本

>>> onto = onto_path.append("/path/to/owlready/onto/")

I tried similar line of above code like this我尝试了类似的上述代码行

>>> onto = onto_path.append("E:/dir/dir/ontologyfile.owl")
>>> onto.load()

but the error shows up, said that 'NoneType' object has no attribute 'load' .但是错误出现了,说'NoneType' object has no attribute 'load' How can i fix this?我该如何解决这个问题?

From Loading an ontology from OWL files :从 OWL 文件加载本体

If an URL is given, Owlready2 first searches for a local copy of the OWL file and, if not found, tries to download it from the Internet.如果给出了 URL,Owlready2 首先搜索 OWL 文件的本地副本,如果没有找到,则尝试从 Internet 下载它。

This works for me on Windows:这在 Windows 上对我有用:

>>> from owlready import *
>>> onto = get_ontology("file://E:/dir/dir/ontologyfile.owl")
>>> onto.load()

As well as this:还有这个:

>>> from owlready import *
>>> onto_path.append("E:/dir/dir/")
>>> onto = get_ontology("http://absulutelyrandomdomain.com/ontologyfile.owl")
>>> onto.load()

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

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