Package com.clarkparsia.pellet.datatypes.exceptions

Examples of com.clarkparsia.pellet.datatypes.exceptions.InvalidLiteralException


      else
        return ATermUtils.makeTypedLiteral( canonicalForm, name );
    } catch( NumberFormatException e ) {
      log.severe( format( "Number format exception (%s) cause while parsing float %s", e
          .getMessage(), lexicalForm ) );
      throw new InvalidLiteralException( name, lexicalForm );
    }
  }
View Full Code Here


    final String lexicalForm = ATermUtils.getLiteralValue( literal );
    try {
      return DatatypeConverter.parseFloat( lexicalForm );
    } catch( NumberFormatException e ) {
      throw new InvalidLiteralException( name, lexicalForm );
    }
  }
View Full Code Here

      else
        return ATermUtils.makeTypedLiteral( canonicalForm, name );
    } catch( NumberFormatException e ) {
      log.severe( format( "Number format exception (%s) cause while parsing decimal %s", e
          .getMessage(), lexicalForm ) );
      throw new InvalidLiteralException( name, lexicalForm );
    }
  }
View Full Code Here

    final String lexicalForm = ATermUtils.getLiteralValue( literal );
    try {
      return OWLRealUtils.getCanonicalObject( DatatypeConverter.parseDecimal( lexicalForm ) );
    } catch( NumberFormatException e ) {
      throw new InvalidLiteralException( name, lexicalForm );
    }
  }
View Full Code Here

  public T getValue(ATermAppl literal) throws InvalidLiteralException {
    T value = range.getDatatype().getValue(literal);

    if (!range.contains(value))
      throw new InvalidLiteralException(name, literal.getArgument(ATermUtils.LIT_VAL_INDEX).toString());

    return value;
  }
View Full Code Here

    final String lexicalForm = getLexicalForm( literal );
    try {
      final XMLGregorianCalendar c = getDatatypeFactory().newXMLGregorianCalendar(
          lexicalForm );
      if( !schemaType.equals( c.getXMLSchemaType() ) )
        throw new InvalidLiteralException( getName(), lexicalForm );

      return c;
    } catch( IllegalArgumentException e ) {
      /*
       * newXMLGregorianCalendar will throw an IllegalArgumentException if
       * the lexical form is not one of the XML Schema datetime types
       */
      throw new InvalidLiteralException( getName(), lexicalForm );
    } catch( IllegalStateException e ) {
      /*
       * getXMLSchemaType will throw an IllegalStateException if the
       * combination of fields set in the calendar object doesn't match
       * one of the XML Schema datetime types
       */
      throw new InvalidLiteralException( getName(), lexicalForm );
    }
  }
View Full Code Here

  @Override
  public XMLGregorianCalendar getValue(ATermAppl literal) throws InvalidLiteralException {
    final XMLGregorianCalendar c = super.getValue( literal );
    if( c.getTimezone() == DatatypeConstants.FIELD_UNDEFINED )
      throw new InvalidLiteralException( getName(), ATermUtils.getLiteralValue( literal ) );
    return c;
  }
View Full Code Here

    if( lexicalForm.equals("true") || lexicalForm.equals("1"))
      return Boolean.TRUE;
    else if( lexicalForm.equals("false") || lexicalForm.equals("0"))
      return Boolean.FALSE;
    else
      throw new InvalidLiteralException( getName(), lexicalForm );
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.datatypes.exceptions.InvalidLiteralException

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.