Ontology importing another ontology

Hi Stardog team & community,

I have an ontology A which imports another ontology B via owl:imports.
Both are given in an .owl file each in turtle syntax.

Now I would like to know what the best way of getting this into Stardog would be, preserving the fact that one imports the other.

What I tried, using the db "Load Data" button in the "Databases" tab in Studio:

  • Importing the first ontology A alone.
    Then I have the contents of ontology A available, but there is no hint or warning whatsoever that ontology B is missing; in Explorer and Designer, the import is never mentioned, except for the rdf triple in Studio.
    Relations to classes in B are simply not shown in any visualization, so it is not visible something is missing.

  • Importing both ontologies A and B.
    Here, all classes and properties from both are available as if they had been in one file.
    But still I cannot distinguish between that scenario and simply uploading two unrelated ontologies - i.e. I don't see any hint of the owl:imports except for the triple in Studio.
    If the ontologies contain classes with the same name, they cannot even be distinguished in Explorer; only in Designer, I can access the URI.

Therefore, the question is: what would be the best way to get an ontology with an owl:imports into Stardog, preserving the following?

  • The fact that one ontology and its classes are imported by the other
  • If an import statement points to an ontology not present, a hint/warning/information is given
  • It is possible to distinguish between classes of the same name from different ontologies

An additional question is if we necessarily have to upload the imported ontology B, or if there is a way of using it while it resides outside of Stardog, just by owl:imports -ing it.

Help would be much appreciated.

  • The fact that one ontology and its classes are imported by the other

As you've seen Stardog doesn't automatically download and add owl:imports The fact that one ontology imports another is given by the owl:imports statement itself. Actually having loaded the imported ontology is not recorded but you could always add your own assertion if that's needed. You could optionally create a custom archetype that when used would load any ontology that is specified.

  • If an import statement points to an ontology not present, a hint/warning/information is given

I'm not sure of the exact reason for not automatically loading owl:imports but I can speculate that it's to avoid possibly costly network calls, timeouts, 404's and other unpredictable behavior and a hint would require downloading it to check if it's loaded with all kinds of problems itself. Graph isomorphism, blank nodes, etc.

  • It is possible to distinguish between classes of the same name from different ontologies

You can distinguish between classes fo the same name from different ontologies by loading them into separate named graphs.

Hope that helps.

1 Like

Thank you for your answers, @zachary.whitley.
I think I'll have to read up on archetypes and check the possibilities of loading ontologies into different named graphs.