owlcs / owlapi

OWL API main repository
821 stars 315 forks source link

RioOWLRDFParser OWLManager global configuration for SILENT MissingImportHandlingStrategy #998

Closed daltontc closed 3 years ago

daltontc commented 3 years ago

Is there a way to use the Rio parsers (like RioOWLXMLParserFactory, etc) with an OWLManager that is configured with a MissingImportHandlingStrategy of SILENT?

From what I can tell it instantiates a new OWLManager when parsing that doesn't have hooks to change settings. Is this actually the case? Or is there some global configuration that can be set?

ignazio1977 commented 3 years ago

It's not OWLManager that configures the import handling strategy, it's the OWLOntologyManager instances it produces.

You could set the OWLOntologyManagerFactory instance you wish to use on the RioOWLXMLParser object itself, creating it pretty much lie the factory does and just overriding the default setup. However the simplest approach I can think of is to set the environment variable org.semanticweb.owlapi.model.parameters.ConfigurationOptions.MISSING_IMPORT_HANDLING_STRATEGY = SILENT This will make any OWLOntologyManager use the same setting, regardless of where their creation is managed. This applies to all the managers created in the same VM; if you need more specific settings, you'll have to implement an instance of OWLOntologyManagerFactory and create the managers, setting the property on each one.