Package org.openrdf.model

Examples of org.openrdf.model.Literal.stringValue()


                if (triple.getObject() instanceof Literal) {
                    Literal l = (Literal) triple.getObject();

                    if (lang == null || lang.equals(l.getLanguage())) {
                        values.add(l.stringValue());
                    }
                }
            }
        } finally {
            candidates.close();
View Full Code Here


    public static Map<String, String> serializeNodeAsJson(Value node) {
        Map<String,String> nodeRep = new HashMap<String, String>();
        if(node instanceof Literal) {
            Literal literal = (Literal)node;
            nodeRep.put(TYPE,LITERAL);
            nodeRep.put(VALUE, literal.stringValue());
            if(literal.getDatatype() != null) {
                nodeRep.put(DATATYPE,literal.getDatatype().stringValue());
            }
            if(literal.getLanguage() != null) {
                nodeRep.put(LANG,literal.getLanguage());
View Full Code Here

            if (triple.getObject() instanceof Literal) {
                Literal l = (Literal) triple.getObject();

                if (lang == null || lang.equals(l.getLanguage())) {
                    values.add(l.stringValue());
                }
            }
        }
        candidates.close();
View Full Code Here

    }
    else if (n instanceof Literal) {
      Literal lit = (Literal) n;
      if (lit.getLanguage() != null) {
        ps.setInt(col, 5);
        ps.setString(col+1, lit.stringValue());
        ps.setString(col+2, lit.getLanguage());
      }
      else if (lit.getDatatype() != null) {
        ps.setInt(col, 4);
        ps.setString(col+1, lit.stringValue());
View Full Code Here

        ps.setString(col+1, lit.stringValue());
        ps.setString(col+2, lit.getLanguage());
      }
      else if (lit.getDatatype() != null) {
        ps.setInt(col, 4);
        ps.setString(col+1, lit.stringValue());
        ps.setString(col+2, lit.getDatatype().toString());
       }
       else {
        ps.setInt(col, 3);
        ps.setString(col+1, n.stringValue());
View Full Code Here

  {
    if (n instanceof Resource)
      return stringForResource((Resource) n);
    else if (n instanceof Literal) {
      Literal lit = (Literal) n;
      String o = "'" + escapeString(lit.stringValue()) + "'";
      if (lit.getLanguage() != null)
        return o + "@" + lit.getLanguage();
      else if (lit.getDatatype() != null)
        return o + "^^<" + lit.getDatatype() + ">";
      return o;
View Full Code Here

      final Literal directReference = model.filter(item, DC.RELATION, null).objectLiteral();
      Literal name = model.filter(item, DC.TITLE, null).objectLiteral();
      assertNotNull(directReference);
      assertTrue(refs.add(directReference.stringValue()));
      assertNotNull(name);
      logger.debug(name.stringValue());
    }

  }
}
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.