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

Fix ontology loads #377

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ dependencies {
}
implementation("ch.qos.logback:logback-classic:1.3.5")
implementation("ch.qos.logback:logback-core:1.3.5")

//implementation("org.aksw.jena-sparql-api:jena-sparql-api-core:3.17.0-1")
implementation("org.apache.jena:jena-core:3.17.0")
implementation("org.apache.jena:jena-arq:3.17.0")

}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public OntologyElement(String val, String id, String uri) {
this.val = val;
parseId(id);
this.uri=uri;
ImporterAgent.getRegistry().getLogger().debug(null,"[MDE] -- SET OntologyElement:"+toString());
//ImporterAgent.getRegistry().getLogger().debug(this,"[MDE] -- create OntologyElement:"+toString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
import org.openmicroscopy.shoola.agents.fsimporter.ImporterAgent;
import org.openmicroscopy.shoola.agents.fsimporter.mde.util.OntologyElement;
import org.openmicroscopy.shoola.agents.fsimporter.mde.util.TagData;
import org.openmicroscopy.shoola.agents.fsimporter.mde.util.parser.BioPortal_Parser;
import org.openmicroscopy.shoola.agents.fsimporter.mde.util.parser.OLS_Parser;
import org.openmicroscopy.shoola.agents.fsimporter.mde.util.parser.OntologyParser_sparql;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -145,39 +143,26 @@ private List<OntologyElement> parseOntology(Element eElement) {
eElement = (Element) n;
}

String ontology_RESTAPI_url=eElement.getAttribute(ATTR_RESTURL);
String api_key = "";
if(eElement.hasAttribute(ATTR_API_KEY)){
api_key=eElement.getAttribute(ATTR_API_KEY);
}
String ontologyAcronym = eElement.getAttribute(ATTR_ONTO_ACRO);
String ontologyRef = eElement.getAttribute(ATTR_ONTO_REF);

ImporterAgent.getRegistry().getLogger().debug(null,"[MDE]"+
String.format("Parse Ontology: {acronym:%s,id:%s}",ontologyAcronym,ontologyRef));

if(ontology_RESTAPI_url==null || ontology_RESTAPI_url.isEmpty() ||
ontologyAcronym==null || ontologyAcronym.isEmpty() ||
if(ontologyAcronym==null || ontologyAcronym.isEmpty() ||
ontologyRef==null || ontologyRef.isEmpty()){
return null;
}

BioPortal_Parser oParser = new BioPortal_Parser(ontology_RESTAPI_url,api_key,ontologyAcronym);
try {
labelList = oParser.getSubLabels(ontologyAcronym, ontologyRef);
ImporterAgent.getRegistry().getLogger().debug(this,"[MDE]"+
String.format("Parse Ontology: {acronym:%s,id:%s}",ontologyAcronym,ontologyRef));

if (labelList == null) {
OLS_Parser olsParser = new OLS_Parser(ontology_RESTAPI_url,ontologyAcronym);
labelList= olsParser.getSubLabels(ontologyAcronym, ontologyRef);
}
if (labelList ==null){
ImporterAgent.getRegistry().getLogger().debug(null,"[MDE] "+String.format("Ontology element at %s has no childs",ontologyRef));
}
} catch (Exception e) {
ImporterAgent.getRegistry().getLogger().warn(this,
"[MDE] can't parse given ontology item [" + ontologyAcronym + ", " + ontologyRef + "]");
e.printStackTrace();
}
OntologyParser_sparql parser= new OntologyParser_sparql();
labelList=parser.getSubLabels(ontologyAcronym,ontologyRef);

ImporterAgent.getRegistry().getLogger().debug(this,"[MDE]"+
String.format("Retrieve subclasses: %d",labelList!=null?labelList.size():0));
}
return labelList;
}
Expand Down

This file was deleted.

Loading