phillord / tawny-owl

Build OWL Ontologies in a Programmatic Environment
GNU Lesser General Public License v3.0
251 stars 54 forks source link

How do I import a multi-part ontology and set the prefix? #68

Open mathiasp opened 5 years ago

mathiasp commented 5 years ago

I'm trying to import gist https://github.com/semanticarts/gist into tawny-owl, and have it serialized with the gist:-prefix. This is my first try with tawny... I started this way: https://gist.github.com/mathiasp/b00c5d9b5052d74aa5acff674393848e and it sort of works, but it doesn't use the prefix on serialization. Any idea how to go on about this? And is this a good way to import such an ontology. I really didn't get importing something without creating a namespaced file for it... So, any other ontology imported would also need it's own file, or is there a way to do this more elegantly?

And any more proper place for such a quesiton? ;)

Thanks for making tawny-owl available, it looks like something that could help me.

Cheers, Mathias

phillord commented 5 years ago

So, the way that you are importing is fine, although there are simpler ways to do this (i.e. not using defread, just using owl-import directly. This is quite a bit easier to do, but makes it harder to refer to things in those ontologies (you have to use their IRIs).

Now, why is the prefix not working? Well, I don't know. The prefix is being consumed by defread and it should be used when serializing it. But it's not. I shall investigate.

phillord commented 5 years ago

Actually, I am not so convinced.

:prefix "gist"
  ;; normally only things from this IRI will be imported
:iri "http://ontologies.semanticarts.com/o/gistCategory" 

means give the prefix to this IRI, while this:

(clojure.core/partial tawny.read/iri-starts-with-filter "http://ontologies.semanticarts.com/gist")

means "only add these terms to the namespace". Now, if, for example, you use http://ontologies.semanticarts.com/gist/Person the concept, then it doesn't have a prefix because you haven't given one.

At the moment, tawny doesn't have a mechanism for passing in additional prefixes; no reason not to add this though, it would be simple enough.