Examples of OntoSpreadState


Examples of org.ontospread.state.OntoSpreadState

  }
 
  public void testSimplePlayerApplyPre() throws ConceptNotFoundException{
    String []conceptUris = new String[]{
        "http://websemantica.fundacionctic.org/ontologias/bopa/piscina.owl#Piscina"};
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,1.0));
    SpreadPlayer player = new SpreadSimplePlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    try{
      player.first();
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    }
  }
  public void testSimplePlayerApplyPost() throws ConceptNotFoundException{
    String []conceptUris = new String[]{
        "http://websemantica.fundacionctic.org/ontologias/bopa/piscina.owl#Piscina"};
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,1.0));
    SpreadPlayer player = new SpreadSimplePlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    try{
      player.last();
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    //Restrictions
    OntoSpreadCompositeRestriction restrictions = new OntoSpreadCompositeRestriction();
    restrictions.getRestrictions().add(new OntoSpreadRestrictionMinConcepts(2));
    restrictions.getRestrictions().add(new OntoSpreadRestrictionMaxConcepts(10));
    //State   
    OntoSpreadState state = new OntoSpreadState();
   
    OntoSpreadStrategy strategy = new OntoSpreadSimpleStrategy(restrictions);   
    OntoSpreadStrategyVisitorPair pair = new OntoSpreadStrategyVisitorPair(strategy,new OntoSpreadBooleanRestrictionVisitor());
   
    Object continues = pair.applyStrategy(state) ;
    assertEquals(continues.getClass(),Boolean.class);
    assertTrue(((Boolean)continues).booleanValue());
    for(int i = 0; i<2;i++){
      state.getSpreadedConcepts().add(String.valueOf(i));
    }
    assertTrue(((Boolean)continues).booleanValue());
   
    for(int i = 2; i<10;i++){
      state.getSpreadedConcepts().add(String.valueOf(i));
    }
    continues = pair.applyStrategy(state) ;
    assertFalse(((Boolean)continues).booleanValue());
   
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    }
  }
  public void testSimplePlayerNext() throws ConceptNotFoundException{
    String []conceptUris = new String[]{
        "http://websemantica.fundacionctic.org/ontologias/bopa/piscina.owl#Piscina"};
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,10.0));
    SpreadPlayer player = new SpreadSimplePlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);   
    assertTrue(player.hasNext());
    OntoSpreadState ontoSpreadNext = player.next();
    assertTrue(player.hasNext());
    try{
      player.previous();
      fail();
    }catch (Exception e) {
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  public void testApplySelectConceptStrategy() {
    //Restrictions
    OntoSpreadCompositeRestriction restrictions = new OntoSpreadCompositeRestriction();
    restrictions.getRestrictions().add(new OntoSpreadRestrictionMinActivationValue(10.0));
    //State   
    OntoSpreadState state = new OntoSpreadState();
   
   
    ConceptTO conceptTO = new ConceptTO("http://uri.to.test");
   
    state.setConceptToSpread(conceptTO);

   
    OntoSpreadStrategy strategy = new OntoSpreadSelectConceptStrategy(restrictions);   
    OntoSpreadStrategyVisitorPair pair = new OntoSpreadStrategyVisitorPair(strategy,new OntoSpreadBooleanRestrictionVisitor());
   
    state.setCurrentScore(11.0);   
    Object select = pair.applyStrategy(state) ;
    assertEquals(select.getClass(),Boolean.class);
    assertTrue(((Boolean)select).booleanValue());
    state.setCurrentScore(9.0);
    select = pair.applyStrategy(state) ;
    assertFalse(((Boolean)select).booleanValue());
   
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    OntoSpreadRun runOntoSpread = new OntoSpreadRunImpl(
                      DAOUtils.createOntologyDAO(),
                      OntoSpreadTestUtils.createStopStrategy(min,max, minScore),
                      OntoSpreadTestUtils.createSelectStrategy(),
                      new OntoSpreadRelationWeightImpl());
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,1.0));
    List<UriDepthPair> sortedList = new LinkedList<UriDepthPair>();
    for(int i = 0; i<conceptUris.length;i++){
      sortedList.add(new UriDepthPair(conceptUris[i],1));
    }
    ontoSpreadState.setSortedList(sortedList);
    while(runOntoSpread.hasIteration(ontoSpreadState)){
      runOntoSpread.applyIteration(ontoSpreadState)
    }
    ontoSpreadState.setCurrentScore(minScore +1);
   
    //assertEquals(max, spreadedConcepts.size());
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    OntoSpreadRun runOntoSpread = new OntoSpreadRunImpl(
                      DAOUtils.createOntologyDAO(),
                      OntoSpreadTestUtils.createStopStrategy(min,max, 1.0),
                      OntoSpreadTestUtils.createSelectStrategy(),
                      new OntoSpreadRelationWeightImpl());
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,1.0));
    List<UriDepthPair> sortedList = new LinkedList<UriDepthPair>();
    for(int i = 0; i<conceptUris.length;i++){
      sortedList.add(new UriDepthPair(conceptUris[i],1));
    }
    ontoSpreadState.setCurrentScore(2.0);
    ontoSpreadState.setSortedList(sortedList);
    assertTrue(runOntoSpread.hasIteration(ontoSpreadState));
    assertEquals(0, ontoSpreadState.getSpreadedConcepts().size());
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    OntoSpreadRun runOntoSpread = new OntoSpreadRunImpl(
                      DAOUtils.createOntologyDAO(),
                      OntoSpreadTestUtils.createStopStrategy(min,max, 1.0),
                      OntoSpreadTestUtils.createSelectStrategy(),
                      new OntoSpreadRelationWeightImpl());
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setInitialConcepts(OntoSpreadTestUtils.createScoredConcepts(conceptUris,1.0));
    setupInitialConcepts(ontoSpreadState, 1.0);   
    List<UriDepthPair> sortedList = new LinkedList<UriDepthPair>();
    for(int i = 0; i<conceptUris.length;i++){
      sortedList.add(new UriDepthPair(conceptUris[i],1));
    }
    ontoSpreadState.setCurrentScore(2.0);
    ontoSpreadState.setSortedList(sortedList);
    while(runOntoSpread.hasIteration(ontoSpreadState)){
      runOntoSpread.applyIteration(ontoSpreadState)
    }
    //FIXME
    assertEquals(1, ontoSpreadState.getSpreadedConcepts().size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.