Package spark.spi.rdf

Examples of spark.spi.rdf.TypedLiteralImpl


   * Convert from boolean to xsd:boolean typed literal
   * @param b Boolean value
   * @return Converted literal
   */
  public static TypedLiteral toLiteral(boolean b) {
    return new TypedLiteralImpl(Boolean.toString(b), BOOLEAN.typeUri);
  }
View Full Code Here


   * Convert from float to xsd:float typed literal
   * @param f Float value
   * @return Converted literal
   */
  public static TypedLiteral toLiteral(float f) {
    return new TypedLiteralImpl(Float.toString(f), FLOAT.typeUri);
  }
View Full Code Here

   * Convert from double to xsd:double typed literal
   * @param d Double value
   * @return Converted literal
   */
  public static TypedLiteral toLiteral(double d) {
    return new TypedLiteralImpl(Double.toString(d), DOUBLE.typeUri);
  }
View Full Code Here

    if (c != null) return c.literal(value);
    // The object has an unrecognized type that doesn't translate directly to XSD.
    // Omitting the datatype would imply a type of xsd:string, so use xsd:anySimpleType instead.
    // The use of xsd:anySimpleType prevents round-tripping; in the future we could possibly
    // serialize this as a byte array and use xsd:hexBinary or xsd:base64Binary.
    return new TypedLiteralImpl(value.toString(), XsdTypes.ANY_SIMPLE_TYPE);
  }
View Full Code Here

      uriConversions.put(dt, this);
      classConversions.put(c, this);
    }
    /** @return an RDF literal with the appropriate datatype URI and lexical form computed from the given object. */
    final TypedLiteral literal(Object data) {
      return new TypedLiteralImpl(lexical(clazz.cast(data)), typeUri);
    }
View Full Code Here

      TestCursor.assertCursor(s, NONE);
      assertEquals(new PlainLiteralImpl("xyz"), s.getBinding(var));
     
      assertTrue(s.next());
      TestCursor.assertCursor(s, NONE);
      assertEquals(new TypedLiteralImpl("100", XsdTypes.INT), s.getBinding(var));
      assertEquals(100, s.getInt(var));
     
      assertTrue(s.next());
      TestCursor.assertCursor(s, LAST);
      assertEquals(new PlainLiteralImpl("chat", "fr"), s.getBinding(var));
View Full Code Here

TOP

Related Classes of spark.spi.rdf.TypedLiteralImpl

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.