@Override public ATermAppl getCanonicalRepresentation(final ATermAppl input) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(input); try { final BigDecimal d = DatatypeConverter.parseDecimal(lexicalForm); /* * TODO: Determine if this is, in fact a functional mapping */ final String canonicalForm = DatatypeConverter.printDecimal(d); if (canonicalForm.equals(lexicalForm)) return input; else return ATermUtils.makeTypedLiteral(canonicalForm, getName()); } catch (final NumberFormatException e) { _logger.severe(format("Number format exception (%s) cause while parsing decimal %s", e.getMessage(), lexicalForm)); throw new InvalidLiteralException(getName(), lexicalForm); } }
@Override public ATermAppl getCanonicalRepresentation(final ATermAppl input) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(input); try { final BigDecimal d = DatatypeConverter.parseDecimal(lexicalForm); /* * TODO: Determine if this is, in fact a functional mapping */ final String canonicalForm = DatatypeConverter.printDecimal(d); if (canonicalForm.equals(lexicalForm)) return input; else return ATermUtils.makeTypedLiteral(canonicalForm, getName()); } catch (final NumberFormatException e) { _logger.severe(format("Number format exception (%s) cause while parsing decimal %s", e.getMessage(), lexicalForm)); throw new InvalidLiteralException(getName(), lexicalForm); } }
@Override public Number getValue(final ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(literal); try { return OWLRealUtils.getCanonicalObject(DatatypeConverter.parseDecimal(lexicalForm)); } catch (final NumberFormatException e) { throw new InvalidLiteralException(getName(), lexicalForm, e); } }
@Override public Number getValue(final ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm(literal); try { return OWLRealUtils.getCanonicalObject(DatatypeConverter.parseDecimal(lexicalForm)); } catch (final NumberFormatException e) { throw new InvalidLiteralException(getName(), lexicalForm, e); } }