Package org.apache.clerezza.rdf.core.impl

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl


  @Test
  public void secondButLastElementAccessTest() {
    TripleCollection tc = new SimpleMGraph();
    List<Resource> list = new RdfList(new UriRef("http://example.org/mytest2"), tc);
    list.add(new PlainLiteralImpl("hello"));
    list.add(new PlainLiteralImpl("world"));
    list.remove(1);
    assertEquals(1, list.size());
  }
View Full Code Here


  @Test
  public void cleanGraphAfterRemoval() {
    TripleCollection tc = new SimpleMGraph();
    List<Resource> list = new RdfList(new UriRef("http://example.org/mytest"), tc);
    list.add(new PlainLiteralImpl("hello"));
    list.add(new PlainLiteralImpl("world"));
    list.remove(1);
    Assert.assertEquals(2, tc.size());

  }
View Full Code Here

    Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size()==2);

    Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
        new Variable("a"), new Variable("x"),
        new PlainLiteralImpl("tiger"))));

    Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
        new Variable("a"), new Variable("x"),
        new PlainLiteralImpl("lion", new Language("en")))));
  }
View Full Code Here

      DocumentationItem docItemObj = docItemObjsIter.next();
      BNode containedDoc = new BNode();
      mGraph.add(new TripleImpl(orderedContent, DISCOBITS.contains,
          containedDoc));
      mGraph.add(new TripleImpl(containedDoc, DISCOBITS.pos,
          new PlainLiteralImpl(pos.toString())));
      mGraph.add(new TripleImpl(containedDoc, DISCOBITS.holds,
          docItemObj.documentationItem));
      pos++;
    }
    return orderedContent;
View Full Code Here

    Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size()==1);

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(new Variable(variable),
        new UriRef(predicate), new PlainLiteralImpl(object))));
  }
View Full Code Here

  private BNode createTitledContent(BNode orderedContent, MGraph mGraph) {
    BNode titledContent = new BNode();
    mGraph.add(new TripleImpl(titledContent, RDF.type, DISCOBITS.TitledContent));
    BNode title = new BNode();
    mGraph.add(new TripleImpl(title, DISCOBITS.pos, new PlainLiteralImpl("0")));
    BNode titleXml = new BNode();
    mGraph.add(new TripleImpl(titleXml, RDF.type, DISCOBITS.XHTMLInfoDiscoBit));
    mGraph.add(new TripleImpl(titleXml, DISCOBITS.infoBit,
        LiteralFactory.getInstance().createTypedLiteral("Documentation")));
    mGraph.add(new TripleImpl(title, DISCOBITS.holds, titleXml));
    mGraph.add(new TripleImpl(title, RDF.type, DISCOBITS.Entry));
    mGraph.add(new TripleImpl(titledContent, DISCOBITS.contains, title));   
    BNode content = new BNode();
    mGraph.add(new TripleImpl(content, DISCOBITS.pos, new PlainLiteralImpl("1")));
    mGraph.add(new TripleImpl(content, DISCOBITS.holds, orderedContent));
    mGraph.add(new TripleImpl(content, RDF.type, DISCOBITS.Entry));
    mGraph.add(new TripleImpl(titledContent, DISCOBITS.contains, content));   
    return titledContent;
  }
View Full Code Here

    TcManager.getInstance().createMGraph(new UriRef("http://example.org/read/graph"));
  }
  @Test(expected=ReadOnlyException.class)
  public void testAddTripleToMGraph() {
    MGraph mGraph = TcManager.getInstance().getMGraph(new UriRef("http://example.org/read/graph"));
    Triple triple = new TripleImpl(new UriRef("http://example.org/definition/isNonLiteral"), new UriRef("http://example.org/definition/isTest"), new PlainLiteralImpl("test"));
    mGraph.add(triple);
  }
View Full Code Here

    }

    @Override
    public void run() {
      while (!stopRequested) {
        Literal randomLiteral = new PlainLiteralImpl(Util.createRandomString(22));
        Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), randomLiteral);
        mGraph.add(triple);
        addedTripleCount++;
        if ((addedTripleCount % 100) == 0) {
          testTriples.add(triple);
View Full Code Here

  @Override
  public void addLiteral(String subject, String predicate, String lex, String lang, String datatype) {
    Literal obj;
    if (datatype == null) {
      if (lang == null) {
        obj = new PlainLiteralImpl(lex);
      } else {
        obj = new PlainLiteralImpl(lex, new Language(lang));
      }
    } else {
      obj = new TypedLiteralImpl(lex, new UriRef(datatype));
    }
    mgraph.add(new TripleImpl(transform(subject), new UriRef(predicate), obj));
View Full Code Here

  @Test
  public void serializeGraph() {
    final String uriString = "http://example.org/foo#bar";
    UriRef uri = new UriRef(uriString);
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uri, uri, new PlainLiteralImpl("bla bla")));
    com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
    Model model = ModelFactory.createModelForGraph(graph);
    StringWriter writer = new StringWriter();
    model.write(writer);
    Assert.assertTrue(writer.toString().contains("about=\""+uriString));
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

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.