2

this is a very simple question, but I don't seem to find an answer in forums/docs.

I have an OntModel that imports other ontologies, and I simply want to retrieve the URI of the root ontology. Looking directly at statements won't work in my case: some ontologies import "URLs", whose corresponding document has a different URI. Is there some method to simply retrieve the URI of an ontology ?

1 Answers1

2

easy :)

model.getNsPrefixURI("");
Laurens Koppenol
  • 2,946
  • 2
  • 20
  • 33
  • While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. – JAL Aug 10 '15 at 17:27
  • I assume this simple gets the the `xmlns` attribute, which isn't followed by any identifier like `xmlns:owl`. I am wondering why this only takes the source ontology into account and not any other imported ontologies. – F Lekschas Aug 21 '15 at 20:36
  • What if it has xml:base and not the empty xmlns: (ex: http://topbraid.org/schema/schema.rdf)? – Amit Apr 24 '16 at 20:01