Map<String, Double> concepts = ontoSpreadState.getConcepts();
Map<String,PathTO[]> spreadPathTable = ontoSpreadState.getSpreadPathTable();
DefaultGraph graph = new DefaultGraph();
ArrayList <Node> nodes = new ArrayList <Node> ();
ArrayList <Edge> edges = new ArrayList <Edge> ();
ConceptTO pathConceptTO = null;
Node spreadedNode = new SpreadingNode(formatActivation(conceptTO.getName(),concepts.get(conceptTO.getUri())), conceptTO.getUri());
Node activatedRoot = new PrintNode(ApplicationResources.getString("initial.node.activated") );
for (String conceptUri : spreadPathTable.keySet()) {
PathTO[]path = spreadPathTable.get(conceptUri);
if(path[path.length-1].getConceptUri().equals(conceptTO.getUri()) && !conceptUri.equals(conceptTO.getUri())){
Node sonNode = spreadedNode;
for (int i = path.length-1; i >=0 ; i--) {
pathConceptTO = ontologyDAO.getConceptTO(path[i].getConceptUri());
Node pathNode = new PathNode(
formatActivation(pathConceptTO.getName(),
concepts.get(pathConceptTO.getUri())),path[i].getConceptUri());
// for(String relation:path[i].getRelationsUri()){
// if(relation == null) relation = "#INITIAL";
// edges.add(new TextEdge(pathNode,sonNode,""+formatRelation(relation)));
// }
edges.add(new LineEdge(pathNode,sonNode));
nodes.add(pathNode);
sonNode = pathNode;
}
pathConceptTO = ontologyDAO.getConceptTO(conceptUri);
Node activateNode =
new ActivationNode(
formatActivation(pathConceptTO.getName(),
concepts.get(pathConceptTO.getUri())),
pathConceptTO.getUri());
for(String relation:path[path.length-1].getRelationsUri()){
if(relation != null)
edges.add(new TextEdge(activatedRoot,activateNode,formatRelation(relation)));
}
nodes.add(activateNode);