Examples of OntoSpreadState


Examples of org.ontospread.state.OntoSpreadState

import junit.framework.TestCase;

public class OntoSpreadStackConstraintTest extends TestCase {

  public void testNotEmpty(){
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.getSortedList().add(new UriDepthPair("http://one.uri", 0));
    assertTrue(OntoSpreadStackConstraint.checkNotEmptyStack(ontoSpreadState));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  }
  public void testNullStack(){
    assertFalse(OntoSpreadStackConstraint.checkNotEmptyStack(null));
  }
  public void testEmpty(){
    OntoSpreadState ontoSpreadState = new OntoSpreadState();   
    assertFalse(OntoSpreadStackConstraint.checkNotEmptyStack(ontoSpreadState));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  public static void main(String []args) throws ConceptNotFoundException{   
    PropertyConfigurator.configure("/home/chema/pfc_develop/ontospread/trunk/apps/ontospread/src/main/resources/log4j.properties");
    logger.debug("Init ontospread");
    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, 1.0),ontoSpreadState);
    while(player.hasNext()){
      ontoSpreadState = player.next();
    }
    System.out.println(ToStringHelper.arrayToString(
        ontoSpreadState.getFinalSpreadedConcepts(),"\n"));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

public class SpreadDebugPlayerTest extends TestCase {

  public void testDebugPlayerNotPrePost() 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 SpreadDebugPlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    assertEquals(player.first().getSpreadTime(), player.first().getSpreadTime());
    assertEquals(player.last().getSpreadTime(), player.last().getSpreadTime());   
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  }
 
  public void testDebugPlayerApplyPre() 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 SpreadDebugPlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    assertEquals(player.first().getSpreadTime(), player.first().getSpreadTime());   
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

public class OntoSpreadPostAdjustmentTest extends TestCase {

  public void testPostAdjustment() throws ConceptNotFoundException{
    OntoSpreadPostAdjustment post = new OntoSpreadPostAdjustmentImpl();
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    Map<String, Double> concepts = ontoSpreadState.getConcepts();   
      Map<String, PathTO[]> spreadPathTable = ontoSpreadState.getSpreadPathTable();
      for(int i = 0; i<10;i++){
        concepts.put(String.valueOf(i), 1.0);
        spreadPathTable.put(String.valueOf(i), new PathTO[0]);
      }
    post.applyPostAdjustment(ontoSpreadState);
    SpreadedConceptTO[] finalSpreadedConcepts = ontoSpreadState.getFinalSpreadedConcepts();
    assertEquals(10, finalSpreadedConcepts.length);
    for(int i = 0; i<finalSpreadedConcepts.length;i++){
      assertEquals(1.0, finalSpreadedConcepts[i].getScore());
      assertEquals(0, finalSpreadedConcepts[i].getSpreadPath().length);
    }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    assertEquals(player.first().getSpreadTime(), player.first().getSpreadTime());   
  }
  public void testDebugPlayerApplyPost() 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 SpreadDebugPlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    //assertNotSame(ontoSpreadState.getSpreadTime(), player.last().getSpreadTime());
    assertEquals(player.last().getSpreadTime(),player.last().getSpreadTime());
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    assertEquals(player.last().getSpreadTime(),player.last().getSpreadTime());
  }
  public void testDebugPlayerNext() 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 SpreadDebugPlayer(OntoSpreadTestUtils.
        createDefaultOntoSpreadProcess(3, 3, 10.0),
        ontoSpreadState);
    OntoSpreadState ontoSpreadNext = player.next();
    OntoSpreadState ontoSpreadPrevious = player.previous();   
    //assertEquals(ontoSpreadNext.getSpreadTime(), ontoSpreadPrevious.getSpreadTime());
    assertTrue(true);
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  public void testPreAdjustment() throws ConceptNotFoundException{
    OntoSpreadPreAdjustment pre = new OntoSpreadPreAdjustmentImpl();
    OntoSpreadPreAdjustmentConfig ontoSpreadPreConfig = new OntoSpreadPreAdjustmentConfigImpl(10.0);
    pre.setOntoPreAdjustmentConfig(ontoSpreadPreConfig );
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ScoredConceptTO []initialConcepts = new ScoredConceptTO[10];
    double initialValue = 1.0;
    for(int i = 0; i<initialConcepts.length; i++){
      initialConcepts[i] = new ScoredConceptTO("http://uri",initialValue);
    }
    ontoSpreadState.setInitialConcepts(initialConcepts);
    pre.applyPreAdjustment(ontoSpreadState);
    initialConcepts = ontoSpreadState.getInitialConcepts();
    for(int i = 0; i< initialConcepts.length;i++){
      assertEquals(initialValue, initialConcepts[i].getScore());
    }
    assertEquals(ontoSpreadState.getCurrentScore(),ontoSpreadPreConfig.getInitialScore());
    List <UriDepthPair> sortedList = ontoSpreadState.getSortedList();
    assertEquals(initialConcepts.length, sortedList.size());
    for (UriDepthPair pair : sortedList) {
      assertEquals(1, pair.getDepth());
    }
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

public class SpreadSimplePlayerTest extends TestCase {

  public void testSimplePlayerNull() 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
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.