owltools.ontologyrelease
Class OntologyVersionTools

java.lang.Object
  extended by owltools.ontologyrelease.OntologyVersionTools

public class OntologyVersionTools
extends Object

Tools to handle the writing and reading of version information of owl ontology files.

Author:
hdietze

Method Summary
static String format(Date date)
          Format a date into the canonical format of YYYY-MM-DD.
static String getOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology)
          Retrieve the ontology version from the OboInOwl remark.
static Date getOboInOWLVersionDate(org.semanticweb.owlapi.model.OWLOntology ontology)
          Retrieve the ontology version from the OboInOwl remark and parse as Date.
static String getOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology)
          Retrieve the ontology version as string.
static Date getOntologyVersionDate(org.semanticweb.owlapi.model.OWLOntology ontology)
          Retrieve the ontology version as Date.
static org.semanticweb.owlapi.model.IRI getOntologyVersionIRI(org.semanticweb.owlapi.model.OWLOntology ontology)
          Retrieve the ontology version as IRI.
static boolean isOBOOntologyVersion(String version)
          Check, whether the given version string is an OBO-specific IRI.
static Date parseVersion(String version)
          Try to parse the string as a Date using the both patterns for version IRI and OboInOwl.
static org.semanticweb.owlapi.model.AddAxiom setOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology, Date date)
          Set the OboInOWL remark to the given date.
static org.semanticweb.owlapi.model.AddAxiom setOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology, String version)
          Set the OboInOWL remark to the given ontology version.
static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology, Date date, String ontologyId, String filename)
          Set the ontology version IRI in the OntologyID.
static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.model.IRI iri)
          Set the ontology version IRI in the OntologyID.
static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology, String versionIRI)
          Set the ontology version IRI in the OntologyID to the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOntologyVersionDate

public static Date getOntologyVersionDate(org.semanticweb.owlapi.model.OWLOntology ontology)
Retrieve the ontology version as Date. Expects that the version IRI is in the OBO specific format.

Parameters:
ontology -
Returns:
date or null

getOntologyVersion

public static String getOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology)
Retrieve the ontology version as string.

Parameters:
ontology -
Returns:
string or null

getOntologyVersionIRI

public static org.semanticweb.owlapi.model.IRI getOntologyVersionIRI(org.semanticweb.owlapi.model.OWLOntology ontology)
Retrieve the ontology version as IRI.

Parameters:
ontology -
Returns:
iri or null

setOntologyVersion

public static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                            String versionIRI)
Set the ontology version IRI in the OntologyID to the given string.

Parameters:
ontology - target ontology
versionIRI - string which can be parsed in a legal IRI
Returns:
ontology change

setOntologyVersion

public static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                            Date date,
                                                                            String ontologyId,
                                                                            String filename)
Set the ontology version IRI in the OntologyID. Uses the date, ontologyId, and filename to construct an OBO specific IRI.

Parameters:
ontology -
date -
ontologyId -
filename -
Returns:
ontology change

setOntologyVersion

public static org.semanticweb.owlapi.model.SetOntologyID setOntologyVersion(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                            org.semanticweb.owlapi.model.IRI iri)
Set the ontology version IRI in the OntologyID.

Parameters:
ontology -
iri -
Returns:
ontology change

getOboInOWLVersion

public static String getOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology)
Retrieve the ontology version from the OboInOwl remark.

Parameters:
ontology -
Returns:
version or null

getOboInOWLVersionDate

public static Date getOboInOWLVersionDate(org.semanticweb.owlapi.model.OWLOntology ontology)
Retrieve the ontology version from the OboInOwl remark and parse as Date.

Parameters:
ontology -
Returns:
date or null

setOboInOWLVersion

public static org.semanticweb.owlapi.model.AddAxiom setOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                       String version)
Set the OboInOWL remark to the given ontology version.

Parameters:
ontology -
version -
Returns:
ontology change

setOboInOWLVersion

public static org.semanticweb.owlapi.model.AddAxiom setOboInOWLVersion(org.semanticweb.owlapi.model.OWLOntology ontology,
                                                                       Date date)
Set the OboInOWL remark to the given date.

Parameters:
ontology -
date -
Returns:
ontology change

isOBOOntologyVersion

public static boolean isOBOOntologyVersion(String version)
Check, whether the given version string is an OBO-specific IRI.

Parameters:
version -
Returns:
true, if the version matches an OBO specific ontology version pattern

parseVersion

public static Date parseVersion(String version)
Try to parse the string as a Date using the both patterns for version IRI and OboInOwl.

Parameters:
version -
Returns:
date or null

format

public static String format(Date date)
Format a date into the canonical format of YYYY-MM-DD.

Parameters:
date -
Returns:
string


Copyright © 2010-2011. All Rights Reserved.