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
28 changes: 0 additions & 28 deletions .mailmap

This file was deleted.

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.14")
implementation("ch.qos.logback:logback-core:1.3.14")

//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
2 changes: 2 additions & 0 deletions src/config/container.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@
<entry name="omero.client.import.mde.path">omero</entry>
<!-- escape ice special characters, see https://doc.zeroc.com/ice/3.6/properties-and-configuration/configuration-file-syntax -->
<entry name="omero.client.login_escape_characters">#=\s\\</entry>
<!-- sparql endpoint for sparql queries to parse the ontology terms used by mde-->
<entry name="omero.client.import.mde.sparqlEndpoint">http://sparql.hegroup.org/sparql/</entry>
</services>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions src/config/containerImporter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
<entry name="omero.client.import.mde.path">omero</entry>
<!-- escape ice special characters, see https://doc.zeroc.com/ice/3.6/properties-and-configuration/configuration-file-syntax -->
<entry name="omero.client.login_escape_characters">#=\s\\</entry>
<!-- sparql endpoint for sparql queries to parse the ontology terms used by mde-->
<entry name="omero.client.import.mde.sparqlEndpoint">http://sparql.hegroup.org/sparql/</entry>
</services>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public static String getMDEPath() {
Environment env = (Environment) registry.lookup(LookupNames.ENV);
return env.getMDEConfigPath();
}
public static String getMDESparqlEndpoint(){
Environment env = (Environment) registry.lookup(LookupNames.ENV);
return env.getMDESparqlEndpoint();
}

/**
* Returns <code>true</code> if the currently logged in user
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
Loading