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
Set
arguments replaced withCollection
andStream
arguments. - Guava
Optional
is 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.XMLWriterPreferences
andXMLWriterFactory
are removed and replaced this way. Same forAnonymousIndividualProperties
, whose functions are now taken up byOWLOntologyWriterConfiguration
and can be set onOntologyConfigurator
. Preferences can be set through a properties file or system properties, seeConfigurationOptions
javadoc. - Support for RDF 1.1 means that
PlainLiteral
is 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
,CollectionContainerVisitor
removed.AbstractEntityRegistrationManager
removed - seeAbstractCollector
andAbstractCollectorEx
.MapPointer::getAllValues()
and::getValues()
now return streams.Internals
modified to return Streams on most methods.- Most methods accepting annotations set accept now
Collection<OWLAnnotation>
orStream<OWLAnnotation>
(no? extends OWLAnnotation
any more). OWLDataFactory::getOWLObjectInverseOf()
requires anOWLObjectProperty
.ObjectPropertySimplifier
removed (no longer useful).OWLOntologyChangeDataVisitor
has no longer an Exception generic argument.HashCode
has been removed - hashing computed inOWLObjectImpl
using components().OWLAxiomImplWithEntityAndAnonCaching
removed (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 OWLAxiomVisitorAdapter
is nowSubClassCollector implements OWLAxiomVisitor
. OWLNaryAxiom::asPairwiseAxioms()
returns a collection; same for other methods splitting axioms to pairwise axiomsOWLObjectTypeIndexProvider
,OWLRestrictionImpl
,OWLObjectPropertyExpressionImpl
no longer needed.OWLLiteral
specialised implementations do not need datatypes in the constructor any more.OWLObjectPropertyManager
does not need a manager any more.OWLDocumentFormat::isPrefixOWLDocumentFormat()
and::asPrefixOWLOntologyFormat
renamed 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
.RDFResourceBlankNode
constructor requires a boolean for individuals and a boolean to force id output.Searcher
methods accept and return streams.EntitySearcher
methods accept and return streams.AbstractOWLMetric::getOntologies()
returns a stream.MacroExpansionGCIVisitor
constructor needs an extra boolean argument to confirm annotation preservation.MacroExpansionGCIVisitor::dispose()
no longer needed.SimpleRenderer::setPrefixesFromOntologyFormat()
does not require a manager any more.ReferencedEntitySetProvider
removed as no longer needed.OWLObjectPropertyManager::dispose()
no longer needed.OWLObjectComponentCollector::getResult()
turned toOWLObjectComponentCollector::getObjects()
.OWLObjectPropertyManager
constructor does not need a manager any more.OWLProfileViolationVisitorEx
returnsOptional
values.RDFTranslator
needs an IndividualAppearance
instance to determine whether individual ids should be saved.SyntacticLocalityModuleExtractor
has either an ontology or a set of axioms as input, not both.OWLDatatype::isDatatype()
replaced withOWLDatatype::isOWLDatatype()
.AnnotationWalkingControl
is noworg.semanticweb.owlapi.util.AnnotationWalkingControl
.OWLObjectWalker
constructor requires a boolean flag to visit duplicates.