Package org.ontospread.to

Examples of org.ontospread.to.ConceptTO


    //FIXME: Refactor, using relations and draw instances and concepts, equals
    Node root = new PrintNode( ApplicationResources.getString("info.node.root"));
    Node initialRoot = new PrintNode( ApplicationResources.getString("initial.node.root"));
    Map<String, Double> concepts = ontoSpreadState.getConcepts();
    for (ScoredConceptTO initialConcept : ontoSpreadState.getInitialConcepts()) {
      ConceptTO conceptTO = ontologyDAO.getConceptTO(initialConcept.getConceptUri());
      Node node = new InitialNode(formatActivation(conceptTO.getName(),concepts.get(conceptTO.getUri())),conceptTO.getUri());
      edges.add(new LineEdge(initialRoot,node));
      nodes.add(node);
    }

    Node spreadedRoot = new PrintNode( ApplicationResources.getString("initial.node.spreaded"));
    for (String currentSpread : ontoSpreadState.getSpreadedConcepts()) {
      ConceptTO conceptTO = ontologyDAO.getConceptTO(currentSpread);
      Node currentNode = new SpreadNode(formatActivation(conceptTO.getName(),concepts.get(conceptTO.getUri())),conceptTO.getUri());
      edges.add(new LineEdge(spreadedRoot,currentNode));
      nodes.add(currentNode);
    }

    Node activatedRoot = new PrintNode(ApplicationResources.getString("initial.node.activated") );
    for (UriDepthPair activated : ontoSpreadState.getSortedList()) {
      ConceptTO conceptTO = ontologyDAO.getConceptTO(activated.getUri())
      Node currentNode = new ActivateNode(formatActivation(conceptTO.getName(),concepts.get(conceptTO.getUri())),conceptTO.getUri());
      edges.add(new ArrowEdge(activatedRoot,currentNode));
      nodes.add(currentNode);
    }
    //Creating skeleton of graph
    edges.add(new LineEdge(root,initialRoot));
View Full Code Here


    graph.addElements(nodes, edges);
    return graph;
  }

  public static DefaultGraph createGraphForSpreading(OntologyDAO ontologyDAO, OntoSpreadState ontoSpreadState, String conceptUri) throws Exception{
    ConceptTO conceptTO = ontologyDAO.getConceptTO(conceptUri);
    return createGraphForSpreading(ontologyDAO, ontoSpreadState, conceptTO);
  }
View Full Code Here

    ConceptTO conceptTO = ontologyDAO.getConceptTO(conceptUri);
    return createGraphForSpreading(ontologyDAO, ontoSpreadState, conceptTO);
  }
 
  public static DefaultGraph createGraphForPath(OntologyDAO ontologyDAO, OntoSpreadState ontoSpreadState, String conceptUri) throws Exception{
    ConceptTO conceptTO = ontologyDAO.getConceptTO(conceptUri);
    return createGraphForPath(ontologyDAO, ontoSpreadState, conceptTO);
  }
View Full Code Here

    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 ActivateNode(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);
View Full Code Here

    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);
View Full Code Here

  @Override
  public ConceptTO getConceptTO(String conceptUri)
      throws ConceptNotFoundException {
    Concept c = getConcept(conceptUri, null);
    ConceptTO conceptTO = new ConceptTO();
    conceptTO.setUri(c.getConceptDescription().getUri());
    conceptTO.setDescription(c.getConceptDescription().getDescription());
    conceptTO.setName(c.getConceptDescription().getName());
    return conceptTO;
  }
View Full Code Here

  }
   
  private void showPathNode(Node currentNode, String currentUri, String[] path, OntologyDAO ontologyDAO,  Map<String, Double> concepts ,  ArrayList <Node> nodes, ArrayList <Edge> edges) throws ConceptNotFoundException {
    for (String concept : path) {      
      if(!concept.equals(currentUri)){
        ConceptTO conceptPath = ontologyDAO.getConceptTO(concept);
        Node nodePath = new PathNode(conceptPath.getName()+" "+concepts.get(conceptPath.getUri()),conceptPath.getUri());             
        edges.add(new LineEdge(currentNode,nodePath));
        nodes.add(nodePath);
      }
    }
  }
View Full Code Here

    }
  }
 
  public void testGetConceptTO() throws Exception {
    try{
      ConceptTO conceptTO = dao.getConceptTO(conceptUri);     
    }catch(Exception e){
      fail(e.getMessage());
    }
  }
View Full Code Here

  @Override
  public ConceptTO getConceptTO(String conceptUri)
      throws ConceptNotFoundException {
    Concept c = getConcept(conceptUri, null);
    ConceptTO conceptTO = new ConceptTO();
    conceptTO.setUri(c.getConceptDescription().getUri());
    conceptTO.setDescription(c.getConceptDescription().getDescription());
    conceptTO.setName(c.getConceptDescription().getName());
    return conceptTO;
  }
View Full Code Here

      entry.setHits(prizeTable.get(pathTO));
      entry.setPathTO(pathToAdd);
      ontoSpreadXMLState.getPrizeTable().getEntryPrizeTableTOs().add(entry);
    }
   
    ConceptTO conceptToSpread = ontoSpreadState.getConceptToSpread();
    ontoSpreadXMLState.setConceptTOSpread(conceptToSpread.getUri());
    ontoSpreadXMLState.setHasIteration(ontoSpreadState.isHasIteration());
    ontoSpreadXMLState.setCurrentScore(ontoSpreadState.getCurrentScore());
    return ontoSpreadXMLState;
  }
View Full Code Here

TOP

Related Classes of org.ontospread.to.ConceptTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.