Skip to content

Commit

Permalink
Create the resource IRIs only once (a bit more efficient)
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Jul 3, 2016
1 parent 35a8d8b commit f225574
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,19 @@ public static void parseDataNodeWp(PathwayElement elem, Model model, DataHandler
Resource datanodeRes = data.getDataNodes().get(elem.getXref());
if(datanodeRes == null) {
if (url.contains("chebi/CHEBI:")){
datanodeRes = model.createResource(url.trim().replaceAll(" ", "_"));
datanodeRes.addProperty(DC.identifier, model.createResource(url.trim().replaceAll(" ", "_")));
String resourceURL = url.trim().replaceAll(" ", "_");
datanodeRes = model.createResource(resourceURL);
datanodeRes.addProperty(DC.identifier, model.createResource(resourceURL));
}
else if (url.contains("chebi")){
datanodeRes = model.createResource(url.trim().replaceAll(" ", "_").replace("chebi/","chebi/CHEBI:"));
datanodeRes.addProperty(DC.identifier, model.createResource(url.trim().replaceAll(" ", "_").replace("chebi/","chebi/CHEBI:")));
String resourceURL = url.trim().replaceAll(" ", "_").replace("chebi/","chebi/CHEBI:");
datanodeRes = model.createResource(resourceURL);
datanodeRes.addProperty(DC.identifier, model.createResource(resourceURL));
}
else{
datanodeRes = model.createResource(url.trim().replaceAll(" ", "_"));
datanodeRes.addProperty(DC.identifier, model.createResource(url.trim().replaceAll(" ", "_")));
String resourceURL = url.trim().replaceAll(" ", "_");
datanodeRes = model.createResource(resourceURL);
datanodeRes.addProperty(DC.identifier, model.createResource(resourceURL));
}

datanodeRes.addLiteral(DC.source, elem.getXref().getDataSource().getFullName());
Expand Down

0 comments on commit f225574

Please sign in to comment.