Package org.ontospread.to

Examples of org.ontospread.to.ConceptTO


          path[j++] = new PathTO(pathTo.getUri(),
              pathTo.getRelations().getRelations().toArray(new String[pathTo.getRelations().getRelations().size()]));
       
      }     
      double score = spreadedXML.getScore();
      result[i++] = new SpreadedConceptTO(new ConceptTO(spreadedXML.getConceptUri()),path,score );
     
    }
    ontoSpreadState.setFinalSpreadedConcepts(result);
   
    List<UriDepthPair> sortedList = new LinkedList<UriDepthPair>();
    for (UriDepthPairType uriXMLPair : ontoSpreadXMLState.getUriDepthPair().getUriDepthPairs()) {
      sortedList.add(new UriDepthPair(uriXMLPair.getConceptUri(),uriXMLPair.getDepth()));
    }
    ontoSpreadState.setSortedList(sortedList);

    Map<String, Double> concepts = new HashMap<String, Double>();
    for (EntryConceptsType entryXML : ontoSpreadXMLState.getConcepts().getEntryConceptTOs()) {
      concepts.put(entryXML.getUri(), entryXML.getValue());
    }
    ontoSpreadState.setConcepts(concepts );
   
    HashMap<PathTO, Integer> prizeTable = ontoSpreadState.getConceptsToPrize().getPrizeTable();   
    for (EntryPrizeTableTOType entry : ontoSpreadXMLState.getPrizeTable().getEntryPrizeTableTOs()) {
      int value = entry.getHits();
      PathTO pathTO = new PathTO(entry.getPathTO().getUri(),entry.getPathTO().getRelations().getRelations().toArray(new String[entry.getPathTO().getRelations().getRelations().size()]));
      prizeTable.put(pathTO , value);
    }
    ontoSpreadState.setConceptToSpread(new ConceptTO(ontoSpreadXMLState.getConceptTOSpread()));
    ontoSpreadState.setHasIteration(ontoSpreadXMLState.isHasIteration());
    ontoSpreadState.setCurrentScore(ontoSpreadXMLState.getCurrentScore());
   
    return ontoSpreadState;
  }
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

        for (PathTOType pathTo : pathTOs.getPathTOs()) {
          path[j++] = new PathTO(pathTo.getUri(),pathTo.getRelations().getRelations().toArray(new String[pathTo.getRelations().getRelations().size()]));
       
      }     
      double score = spreadedXML.getScore();
      result[i++] = new SpreadedConceptTO(new ConceptTO(spreadedXML.getConceptUri()),path,score );
     
    }
    ontoSpreadState.setFinalSpreadedConcepts(result);
   
    List<UriDepthPair> sortedList = new LinkedList<UriDepthPair>();
    for (UriDepthPairType uriXMLPair : ontoSpreadXMLState.getUriDepthPair().getUriDepthPairs()) {
      sortedList.add(new UriDepthPair(uriXMLPair.getConceptUri(),uriXMLPair.getDepth()));
    }
    ontoSpreadState.setSortedList(sortedList);

    Map<String, Double> concepts = new HashMap<String, Double>();
    for (EntryConceptsType entryXML : ontoSpreadXMLState.getConcepts().getEntryConceptTOs()) {
      concepts.put(entryXML.getUri(), entryXML.getValue());
    }
    ontoSpreadState.setConcepts(concepts );
   
    HashMap<PathTO, Integer> prizeTable = ontoSpreadState.getConceptsToPrize().getPrizeTable();   
    for (EntryPrizeTableTOType entry : ontoSpreadXMLState.getPrizeTable().getEntryPrizeTableTOs()) {
      int value = entry.getHits();
      PathTO pathTO = new PathTO(entry.getPathTO().getUri(),entry.getPathTO().getRelations().getRelations().toArray(new String[entry.getPathTO().getRelations().getRelations().size()]));
      prizeTable.put(pathTO , value);
    }
    ontoSpreadState.setConceptToSpread(new ConceptTO(ontoSpreadXMLState.getConceptTOSpread()));
    ontoSpreadState.setHasIteration( ontoSpreadXMLState.isHasIteration());
    ontoSpreadState.setCurrentScore(ontoSpreadXMLState.getCurrentScore());
   
    return ontoSpreadState;
  }
View Full Code Here

    public RDFDescriptionVisitor(){
        previousConfig();
    }

    public void previousConfig() {
        this.conceptTO = new ConceptTO();
        this.conceptTO.setDescription("");      
        this.altLabels = new LinkedList<String>();
    }
View Full Code Here

public class OntoSpreadRestrictionContextTest extends TestCase {

  public void testTrueEval(){
    OntoSpreadRestriction contextRestriction = new OntoSpreadRestrictionContext("http://context",10);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ConceptTO conceptToSpread = new ConceptTO("http://context#Concept");
    ontoSpreadState.setConceptToSpread(conceptToSpread );
    assertTrue(contextRestriction.eval(ontoSpreadState));
  }
View Full Code Here

    assertTrue(contextRestriction.eval(ontoSpreadState));
  }
  public void testFalseEval(){
    OntoSpreadRestriction contextRestriction = new OntoSpreadRestrictionContext("http://context",10);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ConceptTO conceptToSpread = new ConceptTO("http://contex1t#Concept");
    ontoSpreadState.setConceptToSpread(conceptToSpread );
    assertFalse(contextRestriction.eval(ontoSpreadState));
  }
View Full Code Here

     */
    public static ConceptTO createConceptTO(Resource resource) {
        String uri = resource.getURI();
        String publicName = getPublicName(resource);
        String description = getDescription(resource);
        return new ConceptTO(uri, publicName, description);
    }
View Full Code Here

      Map<String, Double> concepts = ontoSpreadState.getConcepts();
    List <SpreadedConceptTO>resultList = new ArrayList<SpreadedConceptTO>(concepts.size());
        Map<String, PathTO[]> spreadPathTable = ontoSpreadState.getSpreadPathTable();
        //This part composes the result, the return value
      for (String uri : concepts.keySet()) {
        ConceptTO concept = getConceptTO(uri);
          PathTO[] spreadPathTOs = OntoSpreadCommonUtils.getSpreadPath(spreadPathTable,uri);
//              ConceptTO[] spreadPath = new ConceptTO[spreadPathUris.length];
//              for ( int j = 0 ; j < spreadPath.length ; j++ ) {
//                  spreadPath[j] = getConceptTO(spreadPathUris[j].getConceptUri());
//              }
View Full Code Here

    }
        return (SpreadedConceptTO[]) resultList.toArray(new SpreadedConceptTO[resultList.size()]);
    }

  private ConceptTO getConceptTO(String uri) {
    return new ConceptTO(uri);//FIXME: from ontologyDAO
  }
View Full Code Here

    }
    ontoSpreadState.setSpreadedConcepts(spreadedConcepts);
    List <SpreadedConceptTO>finalSpreadedConcepts = new LinkedList<SpreadedConceptTO>();
    for(int i = 0; i<spreaded.length;i++){
      finalSpreadedConcepts.add(
          new SpreadedConceptTO(new ConceptTO(spreaded[i]),new PathTO[]{},i));
    }
    ontoSpreadState.setFinalSpreadedConcepts((SpreadedConceptTO[])
        finalSpreadedConcepts.toArray(new SpreadedConceptTO[finalSpreadedConcepts.size()]));
    Map <String,PathTO[]>spreadPathTable = new HashMap<String,PathTO[]>();
    for(int i = 0;i<spreaded.length;i++){
      PathTO []value = new PathTO[3];
      for(int j=0; j<value.length;j++){
        value[j]=new PathTO(spreaded[i]+"."+j, new String[0]);
      }
      spreadPathTable.put(spreaded[i], value);
    }
    ontoSpreadState.setSpreadPathTable(spreadPathTable);
    ontoSpreadState.setConceptToSpread(new ConceptTO("http://uri.concept.spread"));
    return ontoSpreadState;
  }
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.