Skip to content

Commit

Permalink
Merge pull request #279 from owlcollab/issue-276-url_bending
Browse files Browse the repository at this point in the history
changing URLs for files in gaf checking
  • Loading branch information
kltm authored Apr 2, 2019
2 parents 3ffa1cb + e216ac1 commit dbd5871
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public synchronized void init() {
Document doc = null;
try {
URI uri;
if(!(path.startsWith("http://") || path.startsWith("file:///"))){
if(!(path.startsWith("http://") || path.startsWith("file://") || path.startsWith("https://"))){
File f = new File(path);
uri = f.toURI();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;
import java.util.Set;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -68,13 +69,15 @@ private static Set<String> buildAbbreviations(String path){
InputStream is = null;
LineIterator it = null;
try{
if(path.startsWith("http://") || path.startsWith("file:/")){
is = new URL(path).openStream();
File destination = new File("/tmp/tmp.xrf_abbs");
destination.deleteOnExit();
if(path.startsWith("http://") || path.startsWith("https://")){
FileUtils.copyURLToFile(new URL(path), destination, 10000, 10000);
} else {
destination = new File(path);
}
else {
is = new FileInputStream(new File(path));
}

// Copy from destination, always a file now.
is = new FileInputStream(destination);
it = new LineIterator(new InputStreamReader(is));

while (it.hasNext()) {
Expand All @@ -95,6 +98,7 @@ private static Set<String> buildAbbreviations(String path){
finally {
IOUtils.closeQuietly(is);
LineIterator.closeQuietly(it);

}

return set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package owltools.gaf.rules.go;

import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -45,8 +46,8 @@ public GoAnnotationRulesFactoryImpl(String qcfile, String xrfabbslocation, Parse
}

public GoAnnotationRulesFactoryImpl(OWLGraphWrapper graph, TraversingEcoMapper eco, String taxonModule) {
this("http://www.geneontology.org/quality_control/annotation_checks/annotation_qc.xml",
"http://www.geneontology.org/doc/GO.xrf_abbs", graph, eco, taxonModule);
this("https://raw.githubusercontent.com/owlcollab/owltools/master/docs/legacy/annotation_qc.xml",
"http://current.geneontology.org/metadata/GO.xrf_abbs", graph, eco, taxonModule);
}

@Override
Expand Down

0 comments on commit dbd5871

Please sign in to comment.