Package org.mindswap.pellet

Examples of org.mindswap.pellet.Literal


    index = i;
  }
 
  public Literal next() {
    findNext();
    Literal lit = abox.getLiteral(nodeList.get(index++));
   
    return lit;
  }
View Full Code Here


     
      if ( function.apply( newBinding.getABox(), arguments ) ) {
        VariableBinding newPartial = new VariableBinding( newBinding.getABox() );
        for ( int i = 0; i < arguments.length; i++ ) {
          AtomDObject arg = atom.getAllArguments().get( i );
          Literal result = arguments[ i ];
          Literal current = newBinding.get( arg );
         
          if ( current != null && !current.equals( result ) ) {
            // Oops, we overwrote an argument.
            if ( newBinding.get( arg ) != null )
              throw new InternalReasonerException( "General Function implementation overwrote one of its arguments!" );
            ABox.log.info( "Function results in multiple simultaneous values for variable" );
            return;
View Full Code Here

    for (ATermAppl xName : names) {
      for (ATermAppl yName : names) {
        for (ATermAppl zValue : values) {
          Individual xNode = kb.getABox().getIndividual(xName);
          Individual yNode = kb.getABox().getIndividual(yName);
          Literal zNode = kb.getABox().addLiteral(zValue);

          if (kb.hasPropertyValue(xName, dp2, zValue) && kb.hasPropertyValue(yName, dp2, zValue)) {
            binding = new VariableBinding(kb.getABox());
            binding.set(x, xNode);
            binding.set(y, yNode);
View Full Code Here

    ATermAppl expectedTerm =literal( expected );
    stringFunc( func, expectedTerm, args );
  }
 
  private void stringFunc( Function func, ATermAppl term, String... args ) {
    Literal expected = abox.addLiteral( term );
    stringFunc( func, expected, args );
  }
View Full Code Here

    }
    stringFunc( func, expected, litArgs );
  }
 
  private void stringFunc( Function func, Literal expected, Literal... args ) {
    Literal result = func.apply( abox, null, args );
    if ( expected == null  || result == null)
      assertEquals( "Unexpected function result.", expected, result );
    else
      assertTrue( "Unexcepted resturn value. Expected " + expected + " but saw " + result,
          ComparisonTesters.equal.test( new Literal[]{ expected, result } ) );
View Full Code Here

    return tester.test( litArgs );
  }

  @Test
  public void testBooleans() {
    Literal trueLit = abox.addLiteral( TermFactory.literal( true ) );
    Literal falseLit = abox.addLiteral( TermFactory.literal( false ) );

    generalFunc( BooleanOperators.booleanNot, trueLit, falseLit );
    generalFunc( BooleanOperators.booleanNot, falseLit, trueLit );

    assertFalse( BooleanOperators.booleanNot.apply( abox, new Literal[] { trueLit, trueLit } ) );
View Full Code Here

    assertFalse( BooleanOperators.booleanNot.apply( abox, new Literal[] { null, null } ) );
  }
 
  @Test
  public void testComparisons() {
    Literal l1, l2;

    l1 = abox.addLiteral( li_1 );
    l2 = abox.addLiteral( li0 );

    assertFalse( equal( l1, l2 ) );
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.Literal

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.