Examples of OntoSpreadState


Examples of org.ontospread.state.OntoSpreadState

public class OntoSpreadRestrictionMinActivationValueTest extends TestCase {


  public void testEval() {
    OntoSpreadRestriction valueRestriction = new OntoSpreadRestrictionMinActivationValue(10.0);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setCurrentScore(11.0);
    assertTrue(valueRestriction.eval(ontoSpreadState));
    ontoSpreadState.setCurrentScore(9.0);   
    assertFalse(valueRestriction.eval(ontoSpreadState));   
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

//      throw new OntoSpreadModelException(e,"Getting iteration "+current);
//    } 
    ByteArrayInputStream inputStream = new ByteArrayInputStream(iterations.get(current).toByteArray());
    try {
      ObjectInputStream input = new ObjectInputStream(inputStream);
      OntoSpreadState ontoSpreadState = (OntoSpreadState) input.readObject();
      input.close();
      inputStream.close();
      return ontoSpreadState;
    } catch (IOException e) {
      throw new OntoSpreadModelException(e,"Getting iteration "+current);
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  }
 
  public OntoSpreadState first() throws ConceptNotFoundException {
    current = 0;
    logger.debug("Getting first "+current);
    OntoSpreadState ontoSpreadState = (iterations.size()==0?null:getOntoSpreadState(current));
    return ontoSpreadState;
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  }

  public OntoSpreadState next() throws ConceptNotFoundException {
    if(hasNext()){
      if(current+1>=iterations.size()){
        OntoSpreadState ontoSpreadState =
          getOntoSpreadProcess().iterate(getOntoSpreadState(current));     
        addOntoSpreadState(ontoSpreadState);
      }
      current++;
      if(!hasNext()){       
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

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

Examples of org.ontospread.state.OntoSpreadState

    ontoSpreadState.setConceptToSpread(conceptToSpread );
    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

Examples of org.ontospread.state.OntoSpreadState

public class OntoSpreadRestrictionNotMaxTimeTest extends TestCase {

  public void testMaxTime(){
    OntoSpreadRestriction restriction = new OntoSpreadRestrictionNotMaxTime(2000);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setSpreadTime(0);
    assertTrue(restriction.eval(ontoSpreadState));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    assertTrue(restriction.eval(ontoSpreadState));
  }
 
  public void testMaxTime1(){
    OntoSpreadRestriction restriction = new OntoSpreadRestrictionNotMaxTime(2000);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setSpreadTime(1999);
    assertTrue(restriction.eval(ontoSpreadState));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

    assertTrue(restriction.eval(ontoSpreadState));
  }
 
  public void testMaxTime2(){
    OntoSpreadRestriction restriction = new OntoSpreadRestrictionNotMaxTime(2000);
    OntoSpreadState ontoSpreadState = new OntoSpreadState();
    ontoSpreadState.setSpreadTime(2001);
    assertFalse(restriction.eval(ontoSpreadState));
  }
View Full Code Here

Examples of org.ontospread.state.OntoSpreadState

  public void testVisitOntoSpreadCompositeRestriction() {
    OntoSpreadCompositeRestriction restrictions = new OntoSpreadCompositeRestriction();
    restrictions.getRestrictions().add(new OntoSpreadRestrictionMinConcepts(2));
    restrictions.getRestrictions().add(new OntoSpreadRestrictionMaxConcepts(10));   
    OntoSpreadState state = new OntoSpreadState();
    OntoSpreadBooleanRestrictionVisitor visitor = new OntoSpreadBooleanRestrictionVisitor();
    visitor.setOntoSpreadState(state);
    Object stop = visitor.visit(restrictions);
    assertEquals(stop.getClass(),Boolean.class);
    assertTrue(((Boolean)stop).booleanValue());
    for(int i = 0; i<1;i++){
      state.getSpreadedConcepts().add(String.valueOf(i));
    }
    stop = visitor.visit(restrictions);
    assertTrue(((Boolean)stop).booleanValue());
    for(int i = 2; i<10;i++){
      state.getSpreadedConcepts().add(String.valueOf(i));
    }
    stop = visitor.visit(restrictions);
    assertFalse(((Boolean)stop).booleanValue());
   
  }
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.