Package org.mindswap.pellet

Examples of org.mindswap.pellet.Literal


      if ( args.length != 1 )
        return null;
     
      String val = ATermUtils.getLiteralValue( args[0].getTerm() );
      String length = Integer.toString( val.length() );
      Literal result = abox.addLiteral( ATermUtils.makeTypedLiteral( length, Namespaces.XSD + "integer" ) );
     
      return expectedIfEquals( expected, result );
    }
View Full Code Here


        if ( atom.getAllArguments().size() < 3 ) {
          tokens = null;
          return;
        }
       
        Literal matchLit = newBinding.get( atom.getAllArguments().get( 0 ) );
        if ( matchLit != null ) {
          match = ATermUtils.getLiteralValue( matchLit.getTerm() );
        }
       
        String splittingString = ATermUtils.getLiteralValue(
            newBinding.get( atom.getAllArguments().get(1) ).getTerm() );
       
View Full Code Here

      //@Override
      public void setCurrentBinding(VariableBinding currentBinding) {
        if ( VariableUtils.isVariable( head ) ) {
          ATermAppl resultTerm = ATermUtils.makePlainLiteral( match );
          Literal resultLit = currentBinding.getABox().addLiteral( resultTerm );
          currentBinding.set( head, resultLit );
        }
      }
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

      return;
    }

    node.addType(c, ds);
    if (node.isLiteral()) {
      final Literal l = (Literal) node;
      final NodeMerge mtc = l.getMergeToConstant();
      if (mtc != null) {
        l.clearMergeToConstant();
        Literal mergeTo = abox.getLiteral(mtc.getTarget());
        mergeTo(l, mergeTo, mtc.getDepends());
        node = mergeTo;
      }
    }
View Full Code Here

   * @throws InvalidConstrainingFacetException
   */
  @Test
  public void oneVSatisfiableDecimalRanges() throws InvalidConstrainingFacetException, InvalidLiteralException,
                  UnrecognizedDatatypeException {
    final Literal x = new Literal(term("x"), null, abox, DependencySet.INDEPENDENT);
    for (ATermAppl a : getSatisfiableDecimalRanges()) {
      x.addType(a, DependencySet.INDEPENDENT);
    }

    assertTrue(reasoner.isSatisfiable(singleton(x), Collections.<Literal, Set<Literal>> emptyMap()));
  }
View Full Code Here

   * @throws InvalidConstrainingFacetException
   */
  @Test
  public void oneVSatisfiableEnumerations() throws InvalidConstrainingFacetException, InvalidLiteralException,
                  UnrecognizedDatatypeException {
    final Literal x = new Literal(term("x"), null, abox, DependencySet.INDEPENDENT);
    for (ATermAppl a : getSatisfiableDecimalEnumerations()) {
      x.addType(a, DependencySet.INDEPENDENT);
    }

    assertTrue(reasoner.isSatisfiable(singleton(x), Collections.<Literal, Set<Literal>> emptyMap()));
  }
View Full Code Here

   * @throws InvalidConstrainingFacetException
   */
  @Test
  public void oneVUnsatisfiableDecimalRanges() throws InvalidConstrainingFacetException, InvalidLiteralException,
                  UnrecognizedDatatypeException {
    final Literal x = new Literal(term("x"), null, abox, DependencySet.INDEPENDENT);
    for (ATermAppl a : getUnsatisfiableDecimalRanges()) {
      x.addType(a, DependencySet.INDEPENDENT);
    }

    assertFalse(reasoner.isSatisfiable(singleton(x), Collections.<Literal, Set<Literal>> emptyMap()));
  }
View Full Code Here

   * @throws InvalidConstrainingFacetException
   */
  @Test
  public void oneVUnsatisfiableEnumerations() throws InvalidConstrainingFacetException, InvalidLiteralException,
                  UnrecognizedDatatypeException {
    final Literal x = new Literal(term("x"), null, abox, DependencySet.INDEPENDENT);
    for (ATermAppl a : getUnsatisfiableDecimalEnumerations()) {
      x.addType(a, DependencySet.INDEPENDENT);
    }

    assertFalse(reasoner.isSatisfiable(singleton(x), Collections.<Literal, Set<Literal>> emptyMap()));
  }
View Full Code Here

    if ( datatypeURI == null )
      resultTerm = ATermUtils.makePlainLiteral( result );
    else
      resultTerm = ATermUtils.makeTypedLiteral( result, datatypeURI );
   
    Literal resultLit = abox.addLiteral( resultTerm );

    return expectedIfEquals( expected, resultLit );
  }
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.