5

I have ontology which has another ontology imported in it. I want to know how OWLOntologyManager's loadOntologyFromOntologyDocument(OWLOntologyDocumentSource documentSource, OWLOntologyLoaderConfiguration config) works internally. I have used OWLOntologyLoaderConfiguration class to handle the Missing Imports (want to know which import fails with help of MissingImportListener class).

I am able to listen the missing imports. But if any of my ontology file having import for WEB resource then above method fetches it from its location. Is there any way so that I can restrict the call for WEB resource and asks to load the copy which I have in my system ?

e.g In case of BBC's sport ontology loading method loads following ontologies internally :

  1. http://purl.org/NET/c4dm/event.owl
  2. FOAF (http://xmlns.com/foaf/0.1/)
  3. Time (http://www.w3.org/2006/time)

just like opening BBC's sport ontology inside Protege.

SuhasD
  • 728
  • 2
  • 7
  • 20

1 Answers1

2

You can use AutoIRIMapper - create one pointing at the folder containing local copies and add it to the manager before loading the ontology you're after.

For ontologies that are available at a different address, use SimpleIRIMapper, which will act as a redirect from the original address to a new address.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • Actually different ontologies are in my working system not on hard drive. I know, if anything is not available in my working system then load API will go for WEB resource. But instead I want to raise trigger that dont go for WEB resource instead ask user for it (even if WEB resource is available). I want to restrict my system going for a WEB resource. – SuhasD Jul 12 '16 at 14:35
  • According to my experiment load method will go for IRIMapper first , if not found will go for WEB resource. If not available then it will either throws `UnloadableImportException` OR evokes `MissingImportListener` if any. Am I right on this ? – SuhasD Jul 12 '16 at 14:39
  • To introduce a user interface trigger, you'll need to write your own `OWLOntologyIRIMapper` implementation. There's nothing already available that allows that. – Ignazio Jul 12 '16 at 14:42
  • I try to use `AutoIRIMapper` but it fails. I have a file `ontology.owl` which is in `Manchester OWL Syntax` format, `AutoIRIMapper` failed to locate it. What would be the possible reason for it ? – SuhasD Jul 13 '16 at 13:02
  • AutoIRIMapper does not support Manchester syntax at the moment. As a workaround you need to save the local copy as rdf/xml – Ignazio Jul 13 '16 at 13:14
  • ok. Want to know how load method works with different formats ? I created separate question for it. http://stackoverflow.com/questions/38349636/owl-api-identify-owl-format-based-on-its-string-contents. Also want to know how to identify it just by getting file contents as STRING. – SuhasD Jul 13 '16 at 13:20
  • The load is format agnostic, the issue is that AutoIRIMapper tries to scan only the file header, not do a full parse. It's limited to only a few formats. – Ignazio Jul 13 '16 at 13:34