Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Removing dependency on local maven repo [knife] #175

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Map;
import java.util.Set;

import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.reasoner.OWLReasoner;

Expand Down Expand Up @@ -109,7 +109,7 @@ public Set<String> getAllValidEvidenceIds(Set<String> codes, boolean includeChil
}

private String getId(OWLClass cls) {
return Owl2Obo.getIdentifier(cls.getIRI());
return OWLAPIOwl2Obo.getIdentifier(cls.getIRI());
}

@Override
Expand Down
4 changes: 0 additions & 4 deletions OWLTools-Core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>org.semanticweb.hermit</artifactId>
</dependency>
<dependency>
<groupId>org.bbop</groupId>
<artifactId>oboformat-tools</artifactId>
</dependency>
<dependency>
<groupId>uk.ac.ebi.interpro</groupId>
<artifactId>graphdraw</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Set;

import org.obolibrary.obo2owl.Obo2OWLConstants;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom;
Expand Down Expand Up @@ -307,9 +307,9 @@ public static OWLAxiom reduceAxiomAnnotationsToOboBasic(OWLAxiom axiom, OWLOntol
IRI iri = p.getIRI();
/*
* if the property IRI is not in a predefined annotation property in
* Obo2Owl assume that it's not OBO-Basic
* OWLAPIObo2Owl assume that it's not OBO-Basic
*/
if (Obo2Owl.ANNOTATIONPROPERTYMAP.containsValue(iri) == false) {
if (OWLAPIObo2Owl.ANNOTATIONPROPERTYMAP.containsValue(iri) == false) {
// remove axiom annotation
changed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Vector;

import org.apache.log4j.Logger;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
Expand Down Expand Up @@ -1917,7 +1917,7 @@ public List<OWLObjectProperty> getRelationOrChain(String id) {
public List<OWLObjectProperty> expandRelationChain(OWLObjectProperty property) {

// create the annotation property which marks sub property chain as a valid expansion for a property
IRI iri = IRI.create(Obo2Owl.IRI_PROP_ISREVERSIBLEPROPERTYCHAIN);
IRI iri = IRI.create(OWLAPIObo2Owl.IRI_PROP_ISREVERSIBLEPROPERTYCHAIN);
final OWLAnnotationProperty prop = getDataFactory().getOWLAnnotationProperty(iri);

// get all OWLSubPropertyChainOfAxiom from all ontologies in this graph for a given property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import org.obolibrary.obo2owl.Obo2OWLConstants.Obo2OWLVocabulary;
import org.obolibrary.obo2owl.Obo2OWLConstants;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatConstants.OboFormatTag;
import org.semanticweb.owlapi.model.AxiomType;
Expand Down Expand Up @@ -595,7 +595,7 @@ public boolean getIsAnonymous(OWLObject c) {
* @return {@link OWLAnnotationProperty}
*/
public OWLAnnotationProperty getAnnotationProperty(String tag){
return getDataFactory().getOWLAnnotationProperty(Obo2Owl.trTagToIRI(tag));
return getDataFactory().getOWLAnnotationProperty(OWLAPIObo2Owl.trTagToIRI(tag));
}


Expand Down Expand Up @@ -834,7 +834,7 @@ public List<String> getDefXref(OWLObject c, List<String> sargs){
* @return OBO-style identifier, using obo2owl mapping
*/
public String getIdentifier(OWLObject owlObject) {
return Owl2Obo.getIdentifierFromObject(owlObject, this.sourceOntology, null);
return OWLAPIOwl2Obo.getIdentifierFromObject(owlObject, this.sourceOntology, null);
}

/**
Expand All @@ -850,7 +850,7 @@ public String getIdentifier(OWLObject owlObject, boolean useShorthand) {
return getIdentifier(owlObject);
}
if (owlObject instanceof OWLNamedObject) {
return Owl2Obo.getIdentifier(((OWLNamedObject) owlObject).getIRI());
return OWLAPIOwl2Obo.getIdentifier(((OWLNamedObject) owlObject).getIRI());
}
return null;
}
Expand Down Expand Up @@ -878,7 +878,7 @@ public String getIdentifier(OWLObject owlObject, List<String> sargs) {
* @return OBO-style identifier, using obo2owl mapping
*/
public String getIdentifier(IRI iriId) {
return Owl2Obo.getIdentifier(iriId);
return OWLAPIOwl2Obo.getIdentifier(iriId);
}
public IRI getIRIByIdentifier(String id) {
return getIRIByIdentifier(id, false);
Expand All @@ -896,7 +896,7 @@ public IRI getIRIByIdentifier(String id, boolean isAutoResolve) {
// or for relations with a non identifiers with-out a colon, e.g. negative_regulation
if (!id.contains(":")) {
final OWLAnnotationProperty shortHand = getDataFactory().getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_OIO_shorthand.getIRI());
final OWLAnnotationProperty oboIdInOwl = getDataFactory().getOWLAnnotationProperty(Obo2Owl.trTagToIRI(OboFormatTag.TAG_ID.getTag()));
final OWLAnnotationProperty oboIdInOwl = getDataFactory().getOWLAnnotationProperty(OWLAPIObo2Owl.trTagToIRI(OboFormatTag.TAG_ID.getTag()));
for (OWLOntology o : getAllOntologies()) {
for(OWLObjectProperty p : o.getObjectPropertiesInSignature()) {
// check for short hand or obo ID in owl
Expand Down Expand Up @@ -924,7 +924,7 @@ public IRI getIRIByIdentifier(String id, boolean isAutoResolve) {


// otherwise use the obo2owl method
Obo2Owl b = new Obo2Owl(getManager()); // re-use manager, creating a new one can be expensive as this is a highly used code path
OWLAPIObo2Owl b = new OWLAPIObo2Owl(getManager()); // re-use manager, creating a new one can be expensive as this is a highly used code path
b.setObodoc(new OBODoc());
return b.oboIdToIRI(id);
}
Expand Down Expand Up @@ -1377,7 +1377,7 @@ public OWLObject getOWLObject(IRI s) {
* @return id of source ontology
*/
public String getOntologyId(){
return Owl2Obo.getOntologyId(this.getSourceOntology());
return OWLAPIOwl2Obo.getOntologyId(this.getSourceOntology());
}

/**
Expand All @@ -1391,9 +1391,9 @@ public String getOntologyId(){
public Map<String, String> getVersions() {
Map<String, String> versions = new HashMap<String, String>();
for (OWLOntology o : getAllOntologies()) {
String oid = Owl2Obo.getOntologyId(o);
String oid = OWLAPIOwl2Obo.getOntologyId(o);
if (oid != null) {
String dataVersion = Owl2Obo.getDataVersion(o);
String dataVersion = OWLAPIOwl2Obo.getDataVersion(o);
if (dataVersion != null) {
versions.put(oid, dataVersion);
}
Expand All @@ -1419,7 +1419,7 @@ public Map<String, String> getVersions() {
}

private String getOntologyAnnotationValue(OWLOntology o, OboFormatTag tag) {
IRI dateTagIRI = Obo2Owl.trTagToIRI(tag.getTag());
IRI dateTagIRI = OWLAPIObo2Owl.trTagToIRI(tag.getTag());
Set<OWLAnnotation> annotations = o.getAnnotations();
for (OWLAnnotation annotation : annotations) {
OWLAnnotationProperty property = annotation.getProperty();
Expand Down
4 changes: 2 additions & 2 deletions OWLTools-Core/src/main/java/owltools/io/ParserWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.geneontology.obographs.io.OgYamlGenerator;
import org.geneontology.obographs.model.GraphDocument;
import org.geneontology.obographs.owlapi.FromOwl;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.obolibrary.oboformat.model.Frame;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatConstants.OboFormatTag;
Expand Down Expand Up @@ -228,7 +228,7 @@ public void saveOWL(OWLOntology ont, OWLDocumentFormat owlFormat,
// special work-around for skipping the OBO validation before write
// see also OWL-API issue: https://github.com/owlcs/owlapi/issues/290
// see also saveOWL(OWLOntology, OWLOntologyFormat, String) for redundant code
Owl2Obo bridge = new Owl2Obo();
OWLAPIOwl2Obo bridge = new OWLAPIOwl2Obo(manager);
OBODoc doc;
BufferedWriter bw = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.UUID;

import org.apache.log4j.Logger;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLAxiom;
Expand Down Expand Up @@ -158,7 +158,7 @@ public OWLOntology extractPropertyOntology(IRI newIRI, Set<OWLProperty> props) t
df.getOWLLiteral(id));
axioms.add(ax);
LOG.info(ax);
String pid = Owl2Obo.getIdentifier(prop.getIRI());
String pid = OWLAPIOwl2Obo.getIdentifier(prop.getIRI());
axioms.add(
df.getOWLAnnotationAssertionAxiom(
df.getOWLAnnotationProperty(IRI.create("http://www.geneontology.org/formats/oboInOwl#hasDbXref")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import org.apache.log4j.Logger;
import org.obolibrary.obo2owl.Obo2OWLConstants;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
Expand Down Expand Up @@ -728,8 +728,8 @@ public IRI makeViewClassIRI(IRI vcIRI, IRI vpIRI, String sep) {
if (!isUseOriginalClassIRIs) {
String vcIRIstr = vcIRI.toString();
if (isAssumeOBOStyleIRIs) {
String baseId = Owl2Obo.getIdentifier(vcIRI);
String relId = Owl2Obo.getIdentifier(vpIRI);
String baseId = OWLAPIOwl2Obo.getIdentifier(vcIRI);
String relId = OWLAPIOwl2Obo.getIdentifier(vpIRI);
vcIRIstr = Obo2OWLConstants.DEFAULT_IRI_PREFIX
+ baseId.replace(":", "_") + sep
+ relId.replace("_", "-").replace(":", "-");
Expand Down
4 changes: 2 additions & 2 deletions OWLTools-Core/src/test/java/owltools/TaxonGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import org.junit.Before;
import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.oboformat.model.FrameMergeException;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
Expand All @@ -33,7 +33,7 @@ public void before() throws Exception {
files.add(getResource("taxon_union_terms.obo").getAbsolutePath());

OBOFormatParser p = new OBOFormatParser();
Obo2Owl obo2Owl = new Obo2Owl();
OWLAPIObo2Owl obo2Owl = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager() );
OBODoc merged = null;
for(String file : files) {
OBODoc oboDoc = p.parse(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.model.OWLOntology;
Expand All @@ -32,9 +32,9 @@ public void testReduceAxiomAnnotationsToOboBasicOWLOntology() throws Exception {

OBOFormatParser p = new OBOFormatParser();
OBODoc inputOboDoc = p.parse(inputFile);
Obo2Owl obo2Owl = new Obo2Owl();
OWLAPIObo2Owl obo2Owl = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager() );
OWLOntology owlOntology = obo2Owl.convert(inputOboDoc);
Owl2Obo owl2Obo = new Owl2Obo();
OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(OWLManager.createOWLOntologyManager() );

// check round-trip first before removing
equals(inputFile, owl2Obo.convert(owlOntology));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Collection;

import org.junit.Test;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.obolibrary.oboformat.model.Clause;
import org.obolibrary.oboformat.model.Frame;
import org.obolibrary.oboformat.model.OBODoc;
Expand All @@ -27,7 +27,7 @@ public void testRemoveCardinalityConstraints() throws Exception {
OWLOntology owlOntology = graph.getSourceOntology();
CardinalityContraintsTools.removeCardinalityConstraints(owlOntology);

Owl2Obo owl2Obo = new Owl2Obo();
OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(OWLManager.createOWLOntologyManager() );
OBODoc obo = owl2Obo.convert(owlOntology);

assertNoQualifiers("TEST:1000", obo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Set;

import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatConstants.OboFormatTag;
import org.obolibrary.oboformat.parser.OBOFormatParser;
Expand Down Expand Up @@ -161,7 +161,7 @@ public void testSubset() throws Exception {
private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws Exception{
OBOFormatParser p = new OBOFormatParser();
OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
Obo2Owl bridge = new Obo2Owl();
OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager() );
OWLOntology ontology = bridge.convert(obodoc);
OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
return wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.io.FileReader;

import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.model.OWLObject;
Expand Down Expand Up @@ -55,7 +55,7 @@ public void getRelationById() throws Exception {
private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws Exception{
OBOFormatParser p = new OBOFormatParser();
OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
Obo2Owl bridge = new Obo2Owl();
OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager() );
OWLOntology ontology = bridge.convert(obodoc);
OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
return wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDocumentFormat;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.OWLOntologyManagerFactory;

import owltools.OWLToolsTestBasics;
import owltools.graph.OWLGraphEdge;
Expand Down Expand Up @@ -77,7 +80,7 @@ public void testOnt() throws Exception{
private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws Exception{
OBOFormatParser p = new OBOFormatParser();
OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
Obo2Owl bridge = new Obo2Owl();
OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager());
OWLOntology ontology = bridge.convert(obodoc);
OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
return wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.io.FileReader;

import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.obo2owl.OWLAPIObo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.model.OWLAxiom;
Expand Down Expand Up @@ -39,7 +39,7 @@ public void testConvert() throws Exception{
private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws Exception{
OBOFormatParser p = new OBOFormatParser();
OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
Obo2Owl bridge = new Obo2Owl();
OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(OWLManager.createOWLOntologyManager() );
OWLOntology ontology = bridge.convert(obodoc);
OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
return wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.junit.Test;
import org.obolibrary.obo2owl.OboInOwlCardinalityTools;
import org.obolibrary.obo2owl.Owl2Obo;
import org.obolibrary.obo2owl.OWLAPIOwl2Obo;
import org.obolibrary.oboformat.model.Clause;
import org.obolibrary.oboformat.model.Frame;
import org.obolibrary.oboformat.model.OBODoc;
Expand Down Expand Up @@ -46,7 +46,7 @@ public void testMireot() throws Exception {
OWLOntology sourceOntology = g.getSourceOntology();
OboInOwlCardinalityTools.checkAnnotationCardinality(sourceOntology);

Owl2Obo owl2Obo = new Owl2Obo();
OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(OWLManager.createOWLOntologyManager() );
OBODoc oboDoc = owl2Obo.convert(sourceOntology);
if (RENDER_ONTOLOGY_FLAG) {
renderOBO(oboDoc);
Expand Down
Loading