Skip to content

Migrate to version 5

Ignazio Palmisano edited this page Feb 28, 2016 · 1 revision

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 with Collection and Stream arguments.
  • Guava Optional is replaced with java.util.Optional.
  • All loading and saving preferences are now handled through OntologyConfigurator, whose instances belong to an OWLOntologyManager. All settings are effective on the next load/save operation. Loading and writing preferences can be overridden with setter methods. XMLWriterPreferences and XMLWriterFactory are removed and replaced this way. Same for AnonymousIndividualProperties, whose functions are now taken up by OWLOntologyWriterConfiguration and can be set on OntologyConfigurator. Preferences can be set through a properties file or system properties, see ConfigurationOptions javadoc.
  • Support for RDF 1.1 means that PlainLiteral is treated slightly differently. For example, dl.getOWLLiteral("test", "en") returns false on getDatatype().getIRI().isPlainLiteral() and true for isRDFPlainLiteral(). Therefore using OWLLiteral::isRDFPlainLiteral() is the recommended way to check for plain literals.
  • OWLOntologyDocumentSourceBase.getNextDocumentIRI() is now IRI.getNextDocumentIRI().
  • CollectionContainer, OWLEntityCollectionContainerCollector, CollectionContainerVisitor removed.
  • AbstractEntityRegistrationManager removed - see AbstractCollector and AbstractCollectorEx.
  • MapPointer::getAllValues() and ::getValues() now return streams.
  • Internals modified to return Streams on most methods.
  • Most methods accepting annotations set accept now Collection<OWLAnnotation> or Stream<OWLAnnotation> (no ? extends OWLAnnotation any more).
  • OWLDataFactory::getOWLObjectInverseOf() requires an OWLObjectProperty.
  • ObjectPropertySimplifier removed (no longer useful).
  • OWLOntologyChangeDataVisitor has no longer an Exception generic argument.
  • HashCode has been removed - hashing computed in OWLObjectImpl 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 now SubClassCollector implements OWLAxiomVisitor.
  • OWLNaryAxiom::asPairwiseAxioms() returns a collection; same for other methods splitting axioms to pairwise axioms
  • OWLObjectTypeIndexProvider, 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 to OWLDocumentFormat.
  • OWLDocumentFormat::getOntologyLoaderMetaData() returns a java.util.Optional.
  • OWLOntologyDocumentTarget::getWriter() returns a java.util.Optional.
  • OWLOntologyDocumentSource::getMIMEType() returns a java.util.Optional.
  • OWLOntologyDocumentTarget::getWriter() returns a java.util.Optional.
  • OWLOntologyDocumentTarget::getDocumentIRI() returns a java.util.Optional.
  • OWLOntologyDocumentTarget::getDocumentIRI() returns a java.util.Optional.
  • OWLOntologyDocumentSource::getOutputStream() returns a java.util.Optional.
  • OWLOntologyDocumentSource::getInputStream() returns a java.util.Optional.
  • ToStringRenderer::getInstance() returns an OWLObjectRenderer.
  • ToStringRenderer::setRenderer() requires a javax.inject.Provider<OWLObjectRenderer> instead of just OWLObjectRenderer.
  • 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 to OWLObjectComponentCollector::getObjects().
  • OWLObjectPropertyManager constructor does not need a manager any more.
  • OWLProfileViolationVisitorEx returns Optional 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 with OWLDatatype::isOWLDatatype().
  • AnnotationWalkingControl is now org.semanticweb.owlapi.util.AnnotationWalkingControl.
  • OWLObjectWalker constructor requires a boolean flag to visit duplicates.