Examples of TypedLiteralImpl


Examples of spark.spi.rdf.TypedLiteralImpl

    invalid("Wed Jul 27 18:25:16 EDT 2011", XsdTypes.DATE_TIME);
  }
 
  public void testString() {
    String s = "foo bar";
    TypedLiteralImpl l = new TypedLiteralImpl(s, XsdTypes.STRING);
    assertEquals(s, Conversions.toData(new PlainLiteralImpl(s)));
    roundTrip(s, l);
  }
View Full Code Here

Examples of spark.spi.rdf.TypedLiteralImpl

    assertEquals(val, Conversions.toData(lit));
    assertEquals(lit, Conversions.toLiteral(val));
  }
 
  private static void invalid(String lexical, URI datatype) {
    TypedLiteralImpl l = new TypedLiteralImpl(lexical, datatype);
    try {
      Conversions.toData(l);
      fail("Should have thrown exception converting literal " + l);
    } catch (Exception e) {
      logger.debug("Conversion exception, message: {}", e.getMessage());
View Full Code Here

Examples of spark.spi.rdf.TypedLiteralImpl

        String dt = reader.getAttributeValue(null, DATATYPE);
        URI datatype = (dt == null) ? null : new URI(dt);
        String lang = reader.getAttributeValue(XML_NS, LANG);
        if (reader.next() != CHARACTERS) throw new SparqlException("Unexpected data in Literal binding");
        String lex = reader.getText();
        return (datatype != null) ? new TypedLiteralImpl(lex, datatype) : new PlainLiteralImpl(lex, lang);
      default:
        throw new SparqlException("Unexpected binding value: " + reader.getLocalName());
      }
    } catch (URISyntaxException e) {
      e.printStackTrace();
View Full Code Here

Examples of spark.spi.rdf.TypedLiteralImpl

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

Examples of spark.spi.rdf.TypedLiteralImpl

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

Examples of spark.spi.rdf.TypedLiteralImpl

   * Convert from integer to xsd:int typed literal
   * @param i Integer value
   * @return Converted literal
   */
  public static TypedLiteral toLiteral(int i) {
    return new TypedLiteralImpl(Integer.toString(i), INT.typeUri);
  }
View Full Code Here

Examples of spark.spi.rdf.TypedLiteralImpl

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

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

Examples of spark.spi.rdf.TypedLiteralImpl

   * 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

Examples of spark.spi.rdf.TypedLiteralImpl

   * 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
TOP
Copyright © 2018 www.massapi.com. 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.