Migrate to version 5 - owlcs/owlapi GitHub Wiki
Version 5 main change is Java 8 support - so a lot of methods returning Streams have appeared.
Changes that your existing code might need:
- Many
Setarguments replaced withCollectionandStreamarguments. - Guava
Optionalis replaced withjava.util.Optional. - All loading and saving preferences are now handled through
OntologyConfigurator, whose instances belong to anOWLOntologyManager. All settings are effective on the next load/save operation. Loading and writing preferences can be overridden with setter methods.XMLWriterPreferencesandXMLWriterFactoryare removed and replaced this way. Same forAnonymousIndividualProperties, whose functions are now taken up byOWLOntologyWriterConfigurationand can be set onOntologyConfigurator. Preferences can be set through a properties file or system properties, seeConfigurationOptionsjavadoc. - Support for RDF 1.1 means that
PlainLiteralis treated slightly differently. For example,dl.getOWLLiteral("test", "en")returns false ongetDatatype().getIRI().isPlainLiteral()and true forisRDFPlainLiteral(). Therefore usingOWLLiteral::isRDFPlainLiteral()is the recommended way to check for plain literals. OWLOntologyDocumentSourceBase.getNextDocumentIRI()is nowIRI.getNextDocumentIRI().CollectionContainer,OWLEntityCollectionContainerCollector,CollectionContainerVisitorremoved.AbstractEntityRegistrationManagerremoved - seeAbstractCollectorandAbstractCollectorEx.MapPointer::getAllValues()and::getValues()now return streams.Internalsmodified to return Streams on most methods.- Most methods accepting annotations set accept now
Collection<OWLAnnotation>orStream<OWLAnnotation>(no? extends OWLAnnotationany more). OWLDataFactory::getOWLObjectInverseOf()requires anOWLObjectProperty.ObjectPropertySimplifierremoved (no longer useful).OWLOntologyChangeDataVisitorhas no longer an Exception generic argument.HashCodehas been removed - hashing computed inOWLObjectImplusing components().OWLAxiomImplWithEntityAndAnonCachingremoved (no longer necessary).- All visitor Adapter classes removed; these are implemented in the interfaces with default methods. Implementation of default behaviour always returns Object. So for example
SubClassCollector extends OWLAxiomVisitorAdapteris nowSubClassCollector implements OWLAxiomVisitor. OWLNaryAxiom::asPairwiseAxioms()returns a collection; same for other methods splitting axioms to pairwise axiomsOWLObjectTypeIndexProvider,OWLRestrictionImpl,OWLObjectPropertyExpressionImplno longer needed.OWLLiteralspecialised implementations do not need datatypes in the constructor any more.OWLObjectPropertyManagerdoes not need a manager any more.OWLDocumentFormat::isPrefixOWLDocumentFormat()and::asPrefixOWLOntologyFormatrenamed toOWLDocumentFormat.OWLDocumentFormat::getOntologyLoaderMetaData()returns ajava.util.Optional.OWLOntologyDocumentTarget::getWriter()returns ajava.util.Optional.OWLOntologyDocumentSource::getMIMEType()returns ajava.util.Optional.OWLOntologyDocumentTarget::getWriter()returns ajava.util.Optional.OWLOntologyDocumentTarget::getDocumentIRI()returns ajava.util.Optional.OWLOntologyDocumentTarget::getDocumentIRI()returns ajava.util.Optional.OWLOntologyDocumentSource::getOutputStream()returns ajava.util.Optional.OWLOntologyDocumentSource::getInputStream()returns ajava.util.Optional.ToStringRenderer::getInstance()returns anOWLObjectRenderer.ToStringRenderer::setRenderer()requires ajavax.inject.Provider<OWLObjectRenderer>instead of justOWLObjectRenderer.RDFResourceBlankNodeconstructor requires a boolean for individuals and a boolean to force id output.Searchermethods accept and return streams.EntitySearchermethods accept and return streams.AbstractOWLMetric::getOntologies()returns a stream.MacroExpansionGCIVisitorconstructor needs an extra boolean argument to confirm annotation preservation.MacroExpansionGCIVisitor::dispose()no longer needed.SimpleRenderer::setPrefixesFromOntologyFormat()does not require a manager any more.ReferencedEntitySetProviderremoved as no longer needed.OWLObjectPropertyManager::dispose()no longer needed.OWLObjectComponentCollector::getResult()turned toOWLObjectComponentCollector::getObjects().OWLObjectPropertyManagerconstructor does not need a manager any more.OWLProfileViolationVisitorExreturnsOptionalvalues.RDFTranslatorneeds an IndividualAppearanceinstance to determine whether individual ids should be saved.SyntacticLocalityModuleExtractorhas either an ontology or a set of axioms as input, not both.OWLDatatype::isDatatype()replaced withOWLDatatype::isOWLDatatype().AnnotationWalkingControlis noworg.semanticweb.owlapi.util.AnnotationWalkingControl.OWLObjectWalkerconstructor requires a boolean flag to visit duplicates.