How to create an ontology in python? [closed]

2019-03-09 22:24发布

Are there libraries or certain "techniques" that you can use to create an ontology of elements?

Or "design patterns"?

I am talking about just a "graph" of things. Suppose I have a bunch of words. Certain words are "under" other words or "related" to other words. I need a good way to group them and know their relationship.

7条回答
Juvenile、少年°
2楼-- · 2019-03-09 23:05

Suppose I have a bunch of words. Certain words are "under" other words or "related" to other words. I need a good way to group them and know their relationship.

Take a look at wordnet, which is available in RDF format i.e. according to an RDF Schema ontology. This is exactly what you describe.

http://www.w3.org/2006/03/wn/wn20/


(C. Fellbaum. WordNet: An Electronic Lexical Database. MIT Press, 1998. See also http://wordnet.princeton.edu/ )

(van Assem, Gangemi and Schreiber (eds.). RDF/OWL Representation of WordNet, W3C Working Draft 19 June 2006 W3C Working Draft 19 June 2006; http://www.w3.org/TR/2006/WD-wordnet-rdf-20060619/)

查看更多
等我变得足够好
4楼-- · 2019-03-09 23:08

an ontology is a dictionary that defines URIs and agree on a meaning for each of them. A trivial ontology is just a bunch of URIs you pick more or less out of the blue. This method unfortunately does not give you any information about semantic relationships of your ontological entities. To explain these relationships you normally describe them with an OWL file, and you normally use tools for this. I use Protege. it's quite ok.

查看更多
Root(大扎)
5楼-- · 2019-03-09 23:11

You can use rdflib for storing triples. You then have to make your own decisions about the kind of ontology you want to build. Look at the OWL format for that.

I toyed with python and ontologies during my PhD, so perhaps a quick scan through my thesis can give you some ideas. For instance a short OWL summary or a UML model of a plone ontology tool.

查看更多
聊天终结者
6楼-- · 2019-03-09 23:11

RDFLIB is a mature implementation of a triple store, with plenty of documentation.

However, this library worked for me only for smaller projects. For example there is a nice RDF/XML catalog of the Gutenberg Project Library, which i wasn't able to hack around with (on my dual-core, 2GBRAM machine), because it's simply too large (~ 100M) - even Java/Protege had a tendency to stall on this filesizes. It's a pity.

Alternative: http://seth-scripting.sourceforge.net/

查看更多
Summer. ? 凉城
7楼-- · 2019-03-09 23:24

If it makes sense to represent something as a directed graph, why not just use a graph class? Python-graph offers simple pure-python graph representations. NetworkX has a slightly harder to use C implementation.

查看更多
登录 后发表回答