Package org.openrdf.model

Examples of org.openrdf.model.Literal


  public void testDecimalRoundTrip()
    throws Exception
  {
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new NumericLiteralImpl(3, XMLSchema.DECIMAL);

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here


  public void testTimeZoneRoundTrip()
    throws Exception
  {
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new LiteralImpl("2006-08-23+00:00", XMLSchema.DATE);
    testValueRoundTrip(subj, pred, obj);

    con.removeStatements(null, null, null);
    obj = new LiteralImpl("2006-08-23", XMLSchema.DATE);
    testValueRoundTrip(subj, pred, obj);
View Full Code Here

    for (int i = 0; i < 512; i++) {
      sb.append(Character.toChars('A' + (i % 26)));
    }
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new LiteralImpl("guernica" + sb.toString());

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

    for (int i = 0; i < 1024000; i++) {
      sb.append(Character.toChars('A' + (i % 26)));
    }
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new LiteralImpl("guernica" + sb.toString());

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

    for (int i = 0; i < 512; i++) {
      sb.append(Character.toChars('A' + (i % 26)));
    }
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new LiteralImpl("guernica" + sb.toString(), "es");

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

    }
  }

  protected long hashLiteralType(MessageDigest digest, Value value) {
    if (value instanceof Literal) {
      Literal lit = (Literal)value;
      if (lit.getDatatype() != null) {
        return hash(digest, lit.getDatatype().stringValue());
      }
      if (lit.getLanguage() != null) {
        return hash(digest, lit.getLanguage());
      }
    }
    return 0;
  }
View Full Code Here

      try {
        while (iter.hasNext()) {
          Namespace ns = iter.next();

          Literal prefix = new LiteralImpl(ns.getPrefix());
          Literal namespace = new LiteralImpl(ns.getName());

          BindingSet bindingSet = new ListBindingSet(columnNames, prefix, namespace);
          namespaces.add(bindingSet);
        }
      }
View Full Code Here

    MutableTupleResult result = new MutableTupleResult(bindingNames);

    ValueFactory vf = ValueFactoryImpl.getInstance();

    for (String connectionID : getRepository().getConnectionIDs()) {
      Literal idLit = vf.createLiteral(connectionID);
      result.append(new ListBindingSet(bindingNames, idLit));
    }

    return result;
  }
View Full Code Here

        if (st.getObject() instanceof Resource) {
            logger.trace("statement with resource value");
            statementWithResourceValue(subjectString, st.getPredicate()
                    .stringValue(), objectString);
        } else {
            final Literal literalObject = (Literal) st.getObject();
            String literalDatatype = null;
            final String literalLanguage = literalObject.getLanguage();
            // TODO: When updating to Sesame-2.8 with RDF-1.1 support, the
            // following if condition will always be true
            if (literalObject.getDatatype() != null) {
                literalDatatype = literalObject.getDatatype().stringValue();
            }
            logger.trace("statement with literal value");
            statementWithLiteralValue(subjectString, st.getPredicate()
                    .stringValue(), objectString, literalLanguage,
                    literalDatatype);
View Full Code Here

    @Test
    public void testExplicitDatatypeDeclaration() throws RepositoryException {
        assertExtract("/html/rdfa/xmlliteral-datatype-test.html");
        logger.debug(dumpModelToTurtle());

        Literal literal = RDFUtils.literal(
                "<SPAN datatype=\"rdf:XMLLiteral\" property=\"foaf:name\">Albert <STRONG>Einstein</STRONG></SPAN>",
                RDF.XMLLITERAL
        );
        assertContains(
                RDFUtils.uri("http://dbpedia.org/resource/Albert_Einstein"),
View Full Code Here

TOP

Related Classes of org.openrdf.model.Literal

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.