/** * @return the configuration for this object. This is a read only accessor, * since the configuration is an immutable object. To change the * configuration, use the setter in this interface to set a modified * configuration. */ @Nonnull @Override public OWLOntologyLoaderConfiguration getOntologyLoaderConfiguration() { return delegate.getOntologyLoaderConfiguration(); }
/** * @param ontology ontology to parse into */ public OWLXMLPH(OWLOntology ontology) { this(ontology, null, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into * @param topHandler top level handler */ public OWLXMLPH(OWLOntology ontology, OWLEH<?, ?> topHandler) { this(ontology, topHandler, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into * @param topHandler top level handler */ public OWLXMLPH(OWLOntology ontology, OWLEH<?, ?> topHandler) { this(ontology, topHandler, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into */ public OWLXMLPH(OWLOntology ontology) { this(ontology, null, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into * @param topHandler top level handler */ public OWLXMLPH(OWLOntology ontology, OWLEH<?, ?> topHandler) { this(ontology, topHandler, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into * @param topHandler top level handler */ public OWLXMLPH(OWLOntology ontology, OWLEH<?, ?> topHandler) { this(ontology, topHandler, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into */ public OWLXMLPH(OWLOntology ontology) { this(ontology, null, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * @param ontology ontology to parse into */ public OWLXMLPH(OWLOntology ontology) { this(ontology, null, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * Requests that the manager loads an imported ontology that is described by an imports * statement. This method is generally used by parsers and other kinds of loaders. For simply * loading an ontology, use the loadOntologyXXX methods. The method respects the list of ignored * imports in the specified configuration. In other words, if this methods is called for an * ignored import as specified by the configuration object then the import won't be loaded. The * ontology loader configuration used is the default one for this manager. * * @param declaration The declaration that describes the import to be loaded. * @throws UnloadableImportException if there was a problem creating and loading the import and * silent missing imports handling is not turned on. If silent missing import handling * is turned on then this exception will not be thrown. */ default void makeLoadImportRequest(OWLImportsDeclaration declaration) { makeLoadImportRequest(declaration, getOntologyLoaderConfiguration()); }
/** * Requests that the manager loads an imported ontology that is described by an imports * statement. This method is generally used by parsers and other kinds of loaders. For simply * loading an ontology, use the loadOntologyXXX methods. The method respects the list of ignored * imports in the specified configuration. In other words, if this methods is called for an * ignored import as specified by the configuration object then the import won't be loaded. The * ontology loader configuration used is the default one for this manager. * * @param declaration The declaration that describes the import to be loaded. * @throws UnloadableImportException if there was a problem creating and loading the import and * silent missing imports handling is not turned on. If silent missing import handling * is turned on then this exception will not be thrown. */ default void makeLoadImportRequest(OWLImportsDeclaration declaration) { makeLoadImportRequest(declaration, getOntologyLoaderConfiguration()); }
/** * Requests that the manager loads an imported ontology that is described by an imports * statement. This method is generally used by parsers and other kinds of loaders. For simply * loading an ontology, use the loadOntologyXXX methods. The method respects the list of ignored * imports in the specified configuration. In other words, if this methods is called for an * ignored import as specified by the configuration object then the import won't be loaded. The * ontology loader configuration used is the default one for this manager. * * @param declaration The declaration that describes the import to be loaded. * @throws UnloadableImportException if there was a problem creating and loading the import and * silent missing imports handling is not turned on. If silent missing import handling * is turned on then this exception will not be thrown. */ default void makeLoadImportRequest(OWLImportsDeclaration declaration) { makeLoadImportRequest(declaration, getOntologyLoaderConfiguration()); }
/** * Parses the ontology with a concrete representation available at {@code documentIRI} and adds * its axioms to {@code ontology}. Implementors of this method should load imported ontologies * through * {@link OWLOntologyManager#makeLoadImportRequest(org.semanticweb.owlapi.model.OWLImportsDeclaration, OWLOntologyLoaderConfiguration) * makeLoadImportRequest()}. * * @param documentIRI the IRI of the document to parse * @param ontology the ontology to which the parsed axioms are added * @return the format of the parsed ontology * @throws OWLParserException if there was a parsing problem parsing the ontology. * @throws OWLOntologyChangeException if there was a problem updating {@code ontology}. * Typically this depends on the document being parsed containing an ontology with an * ontology IRI clashing with one already loaded. * @throws UnloadableImportException if one or more imports could not be loaded. */ default OWLDocumentFormat parse(IRI documentIRI, OWLOntology ontology) { return parse(new IRIDocumentSource(documentIRI, null, null), ontology, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * Parses the ontology with a concrete representation available at {@code documentIRI} and adds * its axioms to {@code ontology}. Implementors of this method should load imported ontologies * through * {@link OWLOntologyManager#makeLoadImportRequest(org.semanticweb.owlapi.model.OWLImportsDeclaration, OWLOntologyLoaderConfiguration) * makeLoadImportRequest()}. * * @param documentIRI the IRI of the document to parse * @param ontology the ontology to which the parsed axioms are added * @return the format of the parsed ontology * @throws OWLParserException if there was a parsing problem parsing the ontology. * @throws OWLOntologyChangeException if there was a problem updating {@code ontology}. * Typically this depends on the document being parsed containing an ontology with an * ontology IRI clashing with one already loaded. * @throws UnloadableImportException if one or more imports could not be loaded. */ default OWLDocumentFormat parse(IRI documentIRI, OWLOntology ontology) { return parse(new IRIDocumentSource(documentIRI, null, null), ontology, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * Parses the ontology with a concrete representation available at {@code documentIRI} and adds * its axioms to {@code ontology}. Implementors of this method should load imported ontologies * through * {@link OWLOntologyManager#makeLoadImportRequest(org.semanticweb.owlapi.model.OWLImportsDeclaration, OWLOntologyLoaderConfiguration) * makeLoadImportRequest()}. * * @param documentIRI the IRI of the document to parse * @param ontology the ontology to which the parsed axioms are added * @return the format of the parsed ontology * @throws OWLParserException if there was a parsing problem parsing the ontology. * @throws OWLOntologyChangeException if there was a problem updating {@code ontology}. * Typically this depends on the document being parsed containing an ontology with an * ontology IRI clashing with one already loaded. * @throws UnloadableImportException if one or more imports could not be loaded. */ default OWLDocumentFormat parse(IRI documentIRI, OWLOntology ontology) { return parse(new IRIDocumentSource(documentIRI, null, null), ontology, ontology.getOWLOntologyManager().getOntologyLoaderConfiguration()); }
/** * Parse the axioms from the given axiom string. Returns null for empty and * null strings. * * @param axioms axioms * @param translationManager translationManager * @return set of axioms or null * @see #translate(Collection, OWLOntologyManager) */ public static Collection<OWLAxiom> translate(@Nullable String axioms, OWLOntologyManager translationManager) { if (axioms == null || axioms.isEmpty()) { return Collections.emptySet(); } try { OWLFunctionalSyntaxOWLParser p = new OWLFunctionalSyntaxOWLParser(); OWLOntologyDocumentSource documentSource = new StringDocumentSource(axioms); OWLOntology ontology = translationManager.createOntology(); p.parse(documentSource, ontology, translationManager.getOntologyLoaderConfiguration()); return asList(ontology.axioms()); } catch (UnloadableImportException | OWLOntologyCreationException | OWLParserException e) { throw new OWLRuntimeException(e); } }
/** * Parse the axioms from the given axiom string. Returns null for empty and * null strings. * * @param axioms axioms * @param translationManager translationManager * @return set of axioms or null * @see #translate(Collection, OWLOntologyManager) */ public static Collection<OWLAxiom> translate(@Nullable String axioms, OWLOntologyManager translationManager) { if (axioms == null || axioms.isEmpty()) { return Collections.emptySet(); } try { OWLFunctionalSyntaxOWLParser p = new OWLFunctionalSyntaxOWLParser(); OWLOntologyDocumentSource documentSource = new StringDocumentSource(axioms); OWLOntology ontology = translationManager.createOntology(); p.parse(documentSource, ontology, translationManager.getOntologyLoaderConfiguration()); return asList(ontology.axioms()); } catch (UnloadableImportException | OWLOntologyCreationException | OWLParserException e) { throw new OWLRuntimeException(e); } }
/** * Parse the axioms from the given axiom string. Returns null for empty and * null strings. * * @param axioms axioms * @param translationManager translationManager * @return set of axioms or null * @see #translate(Collection, OWLOntologyManager) */ public static Collection<OWLAxiom> translate(@Nullable String axioms, OWLOntologyManager translationManager) { if (axioms == null || axioms.isEmpty()) { return Collections.emptySet(); } try { OWLFunctionalSyntaxOWLParser p = new OWLFunctionalSyntaxOWLParser(); OWLOntologyDocumentSource documentSource = new StringDocumentSource(axioms); OWLOntology ontology = translationManager.createOntology(); p.parse(documentSource, ontology, translationManager.getOntologyLoaderConfiguration()); return asList(ontology.axioms()); } catch (UnloadableImportException | OWLOntologyCreationException | OWLParserException e) { throw new OWLRuntimeException(e); } }
/** * Parse the axioms from the given axiom string. Returns null for empty and * null strings. * * @param axioms axioms * @param translationManager translationManager * @return set of axioms or null * @see #translate(Collection, OWLOntologyManager) */ public static Collection<OWLAxiom> translate(@Nullable String axioms, OWLOntologyManager translationManager) { if (axioms == null || axioms.isEmpty()) { return Collections.emptySet(); } try { OWLFunctionalSyntaxOWLParser p = new OWLFunctionalSyntaxOWLParser(); OWLOntologyDocumentSource documentSource = new StringDocumentSource(axioms); OWLOntology ontology = translationManager.createOntology(); p.parse(documentSource, ontology, translationManager.getOntologyLoaderConfiguration()); return asList(ontology.axioms()); } catch (UnloadableImportException | OWLOntologyCreationException | OWLParserException e) { throw new OWLRuntimeException(e); } }
public OWLAPILoader() { iriMapper = new LimitedMapIRIMapper(); manager = OWLManager.createOWLOntologyManager(); manager.setOntologyLoaderConfiguration(manager .getOntologyLoaderConfiguration() .setMissingImportHandlingStrategy( MissingImportHandlingStrategy.SILENT)); manager.addMissingImportListener(new MissingImportListener() { @Override public void importMissing(MissingImportEvent event) { if (!ignoreImports) { IRI importURI = event.getImportedOntologyURI(); System.err.println("WARNING: Cannot import " + importURI); event.getCreationException().printStackTrace(); } } }); clear(); }