Skip to content

Commit

Permalink
Adding metainformation that we have subsetted the ontology
Browse files Browse the repository at this point in the history
  • Loading branch information
pnrobinson committed Nov 16, 2017
1 parent bed8906 commit baa2feb
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,15 @@ public Ontology<T, R> subOntology(TermId subOntologyRoot) {
relationBuilder.put(entry.getKey(),entry.getValue());
}
}
return new ImmutableOntology<T, R>(metaInfo, subGraph, subOntologyRoot,
intersectingTerms,
// Note: natural order returns a builder whose keys are ordered by their natural ordering.
final ImmutableSortedMap.Builder<String,String> metaInfoBuilder = ImmutableSortedMap.naturalOrder();
for (String key : metaInfo.keySet()) {
metaInfoBuilder.put(key,metaInfo.get(key));
}
metaInfoBuilder.put("provenance",String.format("Ontology created as a subset from original ontology with root %s",getTermMap().get(rootTermId).getName() ));
ImmutableSortedMap<String,String> extendedMetaInfo=metaInfoBuilder.build();

return new ImmutableOntology<T, R>(extendedMetaInfo, subGraph, subOntologyRoot,intersectingTerms,
Sets.intersection(obsoleteTermIds, childTermIds), subsetTermMap, relationBuilder.build());
}

Expand Down

0 comments on commit baa2feb

Please sign in to comment.