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

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


  @Test
  public void testCreateGraph() {
    TcProvider simpleTcmProvider = getInstance();
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));

    Graph createdGraph = simpleTcmProvider.createGraph(uriRefA, mGraph);

    Iterator<Triple> iteratorInput = mGraph.iterator();
    Iterator<Triple> iteratorCreated = createdGraph.iterator();
View Full Code Here


  @Test
  public void testGetGraph() {
    TcProvider simpleTcmProvider = getInstance();
    // add Graphs
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
    simpleTcmProvider.createGraph(uriRefA, mGraph);
    mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
    simpleTcmProvider.createGraph(uriRefA1, mGraph);
    mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
    simpleTcmProvider.createGraph(uriRefB, mGraph);
    mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
    simpleTcmProvider.createGraph(uriRefB1, mGraph);

    Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
    Iterator<Triple> iterator = bGraph.iterator();
    assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
    assertFalse(iterator.hasNext());
  }
View Full Code Here

  @Test
  public void testGetMGraph() {
    TcProvider simpleTcmProvider = getInstance();
    // add MGraphs
    MGraph mGraph = simpleTcmProvider.createMGraph(uriRefA);
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
    mGraph = simpleTcmProvider.createMGraph(uriRefA1);
    mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
    mGraph = simpleTcmProvider.createMGraph(uriRefB);
    mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
    mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
    mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
    assertEquals(1, mGraph.size());
    mGraph = simpleTcmProvider.createMGraph(uriRefB1);
    mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));

    MGraph bGraph = simpleTcmProvider.getMGraph(uriRefB);
    Iterator<Triple> iterator = bGraph.iterator();
    assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
    assertFalse(iterator.hasNext());
  }
View Full Code Here

  @Test
  public void testGetTriples() {
    TcProvider simpleTcmProvider = getInstance();
    // add Graphs
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
    simpleTcmProvider.createGraph(uriRefA, mGraph);
    mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
    simpleTcmProvider.createGraph(uriRefB, mGraph);
    // add MGraphs
    mGraph = simpleTcmProvider.createMGraph(uriRefA1);
    mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
    mGraph = simpleTcmProvider.createMGraph(uriRefB1);
    mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));

    // get a Graph
    TripleCollection tripleCollection = simpleTcmProvider.getTriples(uriRefA);
    // get a MGraph
    TripleCollection tripleCollection2 = simpleTcmProvider.getTriples(uriRefB1);

    Iterator<Triple> iterator = tripleCollection.iterator();
    assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
    assertFalse(iterator.hasNext());

    iterator = tripleCollection2.iterator();
    assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
    assertFalse(iterator.hasNext());
  }
View Full Code Here

  @Test
  public void testDeleteEntity() {
    TcProvider simpleTcmProvider = getInstance();
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
    Graph graph = mGraph.getGraph();
    simpleTcmProvider.createGraph(uriRefA, graph);
    simpleTcmProvider.createGraph(uriRefC, graph);

    simpleTcmProvider.deleteTripleCollection(uriRefA);
View Full Code Here

  private Triple createTestTriple() {
    NonLiteral subject = new BNode() {};
    UriRef predicate = new UriRef("http://test.com/");
    NonLiteral object = new UriRef("http://test.com/myObject");
    return new TripleImpl(subject, predicate, object);
  }
View Full Code Here

   
    int port = createTestWebServer().getPort();

    UriRef uri = new UriRef("http://localhost:" + port + "/test");
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);

    URL serverURL = new URL(uri.getUnicodeString());
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
    connection.setDoOutput(true);
View Full Code Here

   
    int port = createTestWebServer().getPort();   
    UriRef uri = new UriRef("http://localhost:" + port + "/test");
   
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);
   
    URL serverURL = new URL(uri.getUnicodeString());
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
   
View Full Code Here

   
    int port = createTestWebServer().getPort();
    UriRef uri = new UriRef("http://localhost:" + port + "/test");
   
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);

    URL serverURL = new URL(uri.getUnicodeString() + "-description");
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
   
View Full Code Here

            agent = agents.next().getSubject();
          } finally {
            readLock.unlock();
          }
          MGraph temporary = new SimpleMGraph();
          temporary.add(new TripleImpl(agent, PERMISSION.password,
              new PlainLiteralImpl(newPassword)));
          MGraph result = new UnionMGraph(temporary, systemGraph);
          GraphNode mailGraph = new GraphNode(new BNode(), result);
          mailGraph.addProperty(RDF.type, USERMANAGER.PasswordResetMail);
          mailGraph.addProperty(USERMANAGER.recipient, agent);
View Full Code Here

TOP

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

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.