Examples of TcProvider


Examples of org.apache.clerezza.rdf.core.access.TcProvider

  }

  @Test
  public void testCreateMGraphNoDuplicateNames() throws Exception {

    TcProvider provider = getInstance();
    MGraph graph = provider.createMGraph(graphUriRef);
    assertNotNull(graph);
    boolean expThrown = false;
    try {
      MGraph other = provider.createMGraph(otherGraphUriRef);
    } catch(EntityAlreadyExistsException eaee) {
      expThrown = true;
    }
    assertTrue(expThrown);
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

  @Test
  public void testCreateGraphWithInitialCollection() throws Exception {

    Triple t1 = createTestTriple();

    TcProvider provider = getInstance();

    Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));

    assertEquals(1, graph.size());
    assertTrue(graph.contains(t1));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

    Triple t1 = createTestTriple();
    Set<Triple> t = new TreeSet<Triple>();
    t.add(t1);

    TcProvider provider = getInstance();

    Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));

    boolean expThrown = false;

    try {
      graph.add(t1);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

  @Test
  public void testGraphDeletion() throws Exception {

    TripleCollection triples = createTestTripleCollection(createTestTriple());

    TcProvider provider = getInstance();
    UriRef name1 = new UriRef("http://myGraph1");
    Graph graph = provider.createGraph(name1, triples);

    UriRef name2 = new UriRef("http://myGraph2");
    Graph secondGraph = provider.createGraph(name2, triples);

    //if we delete graph with name1, the second graph should still be there
    provider.deleteTripleCollection(name1);

    provider = getInstance();
    Graph firstGraph = provider.getGraph(name2);
    assertNotNull(firstGraph);

    //check second name is not there
    boolean expThrown = false;

    try {
      Graph g = provider.getGraph(name1);
    } catch(NoSuchEntityException nses) {
      expThrown = true;
    }

    assertTrue(expThrown);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

  }


  @Test
  public void testGetTriplesGraph() throws Exception {
    TcProvider provider = getInstance();
    Graph graph = provider.createGraph(graphUriRef,
        createTestTripleCollection(createTestTriple()));
    TripleCollection tc = provider.getTriples(graphUriRef);
    assertNotNull(tc);
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

    assertNotNull(tc);
  }

  @Test
  public void testGetTriplesMGraph() throws Exception {
    TcProvider provider = getInstance();

    MGraph graph = provider.createMGraph(graphUriRef);

    TripleCollection tc = provider.getTriples(graphUriRef);
    assertNotNull(tc);
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

  protected final UriRef graphUriRef = generateUri("myGraph");
  protected final UriRef otherGraphUriRef = new UriRef(graphUriRef.getUnicodeString());

  @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();
    assertEquals(iteratorInput.next(), iteratorCreated.next());
    assertFalse(iteratorCreated.hasNext());

    try {
      simpleTcmProvider.createGraph(uriRefA, mGraph);
      assertTrue(false);
    } catch (EntityAlreadyExistsException e) {
      assertTrue(true);
    }
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

    }
  }

  @Test
  public void testCreateMGraph() {
    TcProvider simpleTcmProvider = getInstance();
    MGraph mGraph = simpleTcmProvider.createMGraph(uriRefA);
    assertTrue(mGraph.isEmpty());

    try {
      simpleTcmProvider.createMGraph(uriRefA);
      assertTrue(false);
    } catch (EntityAlreadyExistsException e) {
      assertTrue(true);
    }
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.access.TcProvider

    }
  }

  @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

Examples of org.apache.clerezza.rdf.core.access.TcProvider

    assertFalse(iterator.hasNext());
  }

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