Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.Graph


    graph = provider.getMGraph(graphUriRef);
    assertNotNull(graph);
    //check that there is no such graph, but only the mgraph
    boolean expThrown = false;
    try {
      Graph g = provider.getGraph(graphUriRef);
    } catch(NoSuchEntityException e) {
      expThrown = true;
    }

    assertTrue(expThrown);
View Full Code Here


  @Test
  public void testCreateGraphExtended() throws Exception {

    TcProvider provider = getInstance();
    Graph graph = provider.createGraph(graphUriRef, null);

    assertNotNull(graph);

    //get a new provider and check that graph is there
    provider = getInstance();
View Full Code Here

  @Test
  public void testCreateGraphNoDuplicateNames() throws Exception {

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

    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

    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);
    } catch(UnsupportedOperationException uoe) {
      expThrown = true;
    }

    assertTrue(expThrown);
    expThrown = false;

    try {
      graph.remove(t1);
    } catch(UnsupportedOperationException uoe) {
      expThrown = true;
    }

    assertTrue(expThrown);
    expThrown = false;

    try {
      graph.addAll(t);
    } catch(UnsupportedOperationException uoe) {
      expThrown = true;
    }

    assertTrue(expThrown);

    expThrown = false;

    try {
      graph.clear();
    } catch(UnsupportedOperationException uoe) {
      expThrown = true;
    }

    assertTrue(expThrown);

    expThrown = false;

    try {
      graph.removeAll(t);
    } catch(UnsupportedOperationException uoe) {
      expThrown = true;
    }

    assertTrue(expThrown);
View Full Code Here

  @Override
  public Graph createGraph(UriRef name, TripleCollection triples) {
    for (WeightedTcProvider provider : providerList) {
      try {
        Graph result = provider.createGraph(name, triples);

        // unregisters a possible Graph or MGraph service under this name
        // provided by a WeightedTcProvider with a lower weight.
        tcDisappears(name);
        mGraphCache.put(name, new MGraphHolder(provider, null));
View Full Code Here

    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

   * @return a set containing all language uris. This uris can be used to
   * add the language to Clerezza over the addLanguage()-method in this class.
   */
  public Set<UriRef> getAllLanguages() {
    Set<UriRef> result = new HashSet<UriRef>();
    Graph lingvojGraph = getLingvojGraph();
    Iterator<Triple> languages = lingvojGraph.filter(null, RDFS.isDefinedBy,
        null);
    while (languages.hasNext()) {
      UriRef languageUri = (UriRef) languages.next().getSubject();
      result.add(languageUri);
    }
View Full Code Here


  @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

   * graph, then null is returned. The returned uri can be used to
   * add the language to Clerezza over the addLanguage()-method in this class.
   * @return a language uris
   */
  public UriRef getLanguage(String languageName, Language inLanguage) {
    Graph lingvojGraph = getLingvojGraph();
    Iterator<Triple> languages = lingvojGraph.filter(null, RDFS.isDefinedBy, null);
    while (languages.hasNext()) {
      GraphNode languageNode = new GraphNode((UriRef) languages.next().getSubject(), lingvojGraph);
      Iterator<Resource> labels = languageNode.getObjects(RDFS.label);
      while (labels.hasNext()) {
        PlainLiteral label = (PlainLiteral) labels.next();
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.Graph

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.