Package org.openrdf.model.impl

Examples of org.openrdf.model.impl.LiteralImpl


    public void testListTriples() {
        URI subject1 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI subject2 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI predicate1 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI predicate2 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        Literal object1 = new LiteralImpl("http://localhost/"+ RandomStringUtils.random(40));
        Literal object2 = new LiteralImpl("http://localhost/"+ RandomStringUtils.random(40));

        Statement stmt1 = new StatementImpl(subject1,predicate1,object1);
        Statement stmt2 = new StatementImpl(subject1,predicate1,object2);
        Statement stmt3 = new StatementImpl(subject1,predicate2,object1);
        Statement stmt4 = new StatementImpl(subject1,predicate2,object2);
View Full Code Here


    public void testRemoveTriples() {
        URI subject1 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI subject2 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI predicate1 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        URI predicate2 = new URIImpl("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
        Literal object1 = new LiteralImpl("http://localhost/"+ RandomStringUtils.random(40));
        Literal object2 = new LiteralImpl("http://localhost/"+ RandomStringUtils.random(40));

        Statement stmt1 = new StatementImpl(subject1,predicate1,object1);
        Statement stmt2 = new StatementImpl(subject1,predicate1,object2);
        Statement stmt3 = new StatementImpl(subject1,predicate2,object1);
        Statement stmt4 = new StatementImpl(subject1,predicate2,object2);
View Full Code Here

                            for(Object o : row.getValue()) {
                                if(o instanceof Value) {
                                    rowList.add(JSONUtils.serializeNodeAsJson((Value) o));
                                } else {
                                    // we convert always to a literal
                                    rowList.add(JSONUtils.serializeNodeAsJson(new LiteralImpl(o.toString())));
                                }
                            }
                            result.put(row.getKey(),rowList);
                        }
                        return Response.ok().entity(result).build();
View Full Code Here

                                for(Object o : row.getValue()) {
                                    if(o instanceof Value) {
                                        rowList.add(JSONUtils.serializeNodeAsJson((Value) o));
                                    } else {
                                        // we convert always to a literal
                                        rowList.add(JSONUtils.serializeNodeAsJson(new LiteralImpl(o.toString())));
                                    }
                                }
                                result.put(row.getKey(),rowList);
                            }
View Full Code Here

                    if(type != null) {
                        for(String allowedType : allowedTypes) {
                            if(type.matches(allowedType)) {
                                byte[] data = contentService.getContentData(r,type);
                                String content = new String(data);
                                result.add(new LiteralImpl(content));
                                break;
                            }
                        }
                    }
                }
View Full Code Here

                "literal ("+getLiteralType(value)+")";
    }

    @Override
    public Literal createLiteral(String content) {
        return new LiteralImpl(content);
    }
View Full Code Here

    public Literal createLiteral(String content, Locale language, URI type) {
        log.debug("creating literal with content \"{}\", language {}, datatype {}",new Object[]{content,language,type});
        if(language == null && type == null) {
            return createLiteral(content);
        } else if(type == null) {
            return new LiteralImpl(content,language.getLanguage());
        } else  {
            return new LiteralImpl(content, createURI(type.toString()));
        }
    }
View Full Code Here

   */
  public void add(String subject, String predicate, String object) {
    add(Graphs.newGraph(new StatementImpl(
        new URIImpl(subject.toString()),
        new URIImpl(predicate.toString()),
        new LiteralImpl(object.toString()))));
  }
View Full Code Here

  public static Value asResource(java.net.URI uri) {
    return new URIImpl(((java.net.URI)uri).toString());
  }
 
  public static Value asLiteral(java.net.URI uri) {
    return new LiteralImpl(((java.net.URI)uri).toString());
  }
View Full Code Here

  public static Value asLiteral(Integer i) {
    return new NumericLiteralImpl(i);
  }
 
  public static Value asLiteral(String s) {
    return new LiteralImpl(s);
  }
View Full Code Here

TOP

Related Classes of org.openrdf.model.impl.LiteralImpl

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.