Example usage for org.apache.commons.rdf.simple Types XSD_DOUBLE

List of usage examples for org.apache.commons.rdf.simple Types XSD_DOUBLE

Introduction

In this page you can find the example usage for org.apache.commons.rdf.simple Types XSD_DOUBLE.

Prototype

Types XSD_DOUBLE

To view the source code for org.apache.commons.rdf.simple Types XSD_DOUBLE.

Click Source Link

Document

<tt>http://www.w3.org/2001/XMLSchema#double</tt>

Usage

From source file:example.UserGuideTest.java

@Test
public void literal() throws Exception {
    Literal literal = factory.createLiteral("Hello world!");
    System.out.println(literal.ntriplesString());

    String lexical = literal.getLexicalForm();
    System.out.println(lexical);/*w  w  w.  j ava  2s. com*/

    IRI datatype = literal.getDatatype();
    System.out.println(datatype.ntriplesString());

    IRI xsdDouble = factory.createIRI("http://www.w3.org/2001/XMLSchema#double");
    Literal literalDouble = factory.createLiteral("13.37", xsdDouble);
    System.out.println(literalDouble.ntriplesString());

    Literal literalDouble2 = factory.createLiteral("13.37", Types.XSD_DOUBLE);

    System.out.println(literal.getDatatype().equals(Types.XSD_STRING));

    Literal inSpanish = factory.createLiteral("Hola, Mundo!", "es");
    System.out.println(inSpanish.ntriplesString());
    System.out.println(inSpanish.getLexicalForm());
    System.out.println(inSpanish.getDatatype().ntriplesString());

    Optional<String> tag = inSpanish.getLanguageTag();
    if (tag.isPresent()) {
        System.out.println(tag.get());
    }

    System.out.println(literal.getLanguageTag().isPresent());
    System.out.println(literalDouble.getLanguageTag().isPresent());
}