/** * @deprecated Use {@link #literal(String, ATermAppl)} instead */ public static ATermAppl typedLiteral(String value, String dt) { return ATermUtils.makeTypedLiteral( value, dt ); }
/** * @deprecated Use {@link #literal(String, ATermAppl)} instead */ public static ATermAppl typedLiteral(String value, String dt) { return ATermUtils.makeTypedLiteral( value, dt ); }
/** * Create a typed literal with xsd:long datatype. * * @param value long value * @return an ATermAppl representing the long literal */ public static ATermAppl literal(long value) { return ATermUtils.makeTypedLiteral( String.valueOf( value ), Datatypes.LONG ); }
/** * Create a typed literal with xsd:float datatype. * * @param value float value * @return an ATermAppl representing the float literal */ public static ATermAppl literal(float value) { return ATermUtils.makeTypedLiteral( String.valueOf( value ), Datatypes.FLOAT ); }
/** * Create a typed literal with xsd:short datatype. * * @param value short value * @return an ATermAppl representing the short literal */ public static ATermAppl literal(short value) { return ATermUtils.makeTypedLiteral( String.valueOf( value ), Datatypes.SHORT ); }
public ATermAppl getValue( int n ) { // System.out.println("BaseDatatype " + this); return ATermUtils.makeTypedLiteral( n + "", name.getName()); } }
public ATermAppl getValue(ATermAppl literal) throws InvalidLiteralException { final String lexicalForm = getLexicalForm( literal ).trim(); try { return ATermUtils.makeTypedLiteral( new URI(lexicalForm).normalize().toString(), NAME ); } catch (URISyntaxException e) { throw new InvalidLiteralException(NAME, lexicalForm); } }
public ATermAppl getLiteral(Object value) { if( value instanceof Float ) return ATermUtils.makeTypedLiteral( DatatypeConverter.printFloat( (Float) value ), getName() ); else throw new IllegalArgumentException(); }
public ATermAppl getLiteral(Object value) { if( value instanceof Double ) return ATermUtils.makeTypedLiteral( DatatypeConverter.printDouble( (Double) value ), getName() ); else throw new IllegalArgumentException(); }
public ATermAppl getLiteral(Object value) { if( value instanceof Rational ) { final Rational r = (Rational) value; final String lexicalForm = r.toString(); return ATermUtils.makeTypedLiteral( lexicalForm, getName() ); } else throw new IllegalArgumentException(); }
public ATermAppl getLiteral(Object value) { if( value instanceof Double ) return ATermUtils.makeTypedLiteral( DatatypeConverter.printDouble( (Double) value ), getName() ); else throw new IllegalArgumentException(); }
private static boolean checkValue( String val, Datatype<?> dt ) { try { dt.getValue(ATermUtils.makeTypedLiteral(val, dt.getName())); return true; } catch (InvalidLiteralException e) { return false; } }
public ATermAppl getLiteral(Object value) { if( dataRange.contains( value ) ) return ATermUtils.makeTypedLiteral( OWLRealUtils.print( (Number) value ), getName() ); else throw new IllegalArgumentException(); }
public ATermAppl getLiteral(Object value) { if( dataRange.contains( value ) ) return ATermUtils.makeTypedLiteral( OWLRealUtils.print( (Number) value ), getName() ); else throw new IllegalArgumentException(); }
public Literal apply(ABox abox, Literal expected, Literal... args) { 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 ); }
public ATermAppl getCanonicalRepresentation(ATermAppl input) throws InvalidLiteralException { final Double f = getValue( input ); final String canonicalForm = DatatypeConverter.printDouble( f ); if( canonicalForm.equals( ATermUtils.getLiteralValue( input ) ) ) return input; else return ATermUtils.makeTypedLiteral( canonicalForm, getName() ); }
public ATermAppl getCanonicalRepresentation(ATermAppl input) throws InvalidLiteralException { final XMLGregorianCalendar c = getValue( input ); final String canonicalForm = c.toXMLFormat(); if( canonicalForm.equals( ATermUtils.getLiteralValue( input ) ) ) return input; else return ATermUtils.makeTypedLiteral( canonicalForm, getName() ); }
public ATermAppl getCanonicalRepresentation(ATermAppl input) throws InvalidLiteralException { final Float f = getValue( input ); final String canonicalForm = DatatypeConverter.printFloat( f ); if( canonicalForm.equals( ATermUtils.getLiteralValue( input ) ) ) return input; else return ATermUtils.makeTypedLiteral( canonicalForm, getName() ); }
public ATermAppl getLiteral(Object value) { if( IEEEFloatType.getInstance().isInstance( value ) ) return ATermUtils.makeTypedLiteral( DatatypeConverter.printFloat( IEEEFloatType .getInstance().cast( value ) ), name ); else throw new IllegalArgumentException(); }
static public ATermAppl makeLiteral(LiteralLabel jenaLiteral) { String lexicalValue = jenaLiteral.getLexicalForm(); String datatypeURI = jenaLiteral.getDatatypeURI(); ATermAppl literalValue = null; if( datatypeURI != null ) literalValue = ATermUtils.makeTypedLiteral( lexicalValue, datatypeURI ); else if( jenaLiteral.language() != null ) literalValue = ATermUtils.makePlainLiteral( lexicalValue, jenaLiteral.language() ); else literalValue = ATermUtils.makePlainLiteral( lexicalValue ); return literalValue; }