Skip to content

Commit

Permalink
improve /suggestNodeClass ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Cuddihy committed Mar 11, 2022
1 parent e5fb84b commit 54619a7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.ge.research.semtk.ontologyTools.OntologyClass;
import com.ge.research.semtk.ontologyTools.OntologyInfo;
import com.ge.research.semtk.ontologyTools.OntologyProperty;
import com.ge.research.semtk.ontologyTools.OntologyRange;

public class ValidationAssistant {

Expand All @@ -43,7 +44,13 @@ public static ArrayList<String> suggestNodeClass(OntologyInfo oInfo, NodeGroup n
int localScore = 1000;
ArrayList<NodeItem> incoming = ng.getConnectingNodeItems(snode);
for (NodeItem nItem : incoming) {
for (String range : nItem.getRangeUris()) {
// don't presume nItem.getRangeUris is validated. Check oInfo instead.
Node incomingNode = ng.getNodeItemParentSNode(nItem);
OntologyClass incomingClass = oInfo.getClass(incomingNode.getUri());
OntologyProperty nItemOProp = oInfo.getProperty(nItem.getUriConnectBy());
OntologyRange oRange = nItemOProp.getRange(incomingClass, oInfo);

for (String range : oRange.getUriList()) {
if (oInfo.classIsA(oClass, oInfo.getClass(range))) {
// add incoming node range
score.put(range, ++localScore);
Expand Down

0 comments on commit 54619a7

Please sign in to comment.