Package org.apache.clerezza.rdf.core

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


    TripleCollection tc = MetaDataUtils.convertExifToXmp(metaData2);
   
    Iterator<Triple> it = tc.filter(null, new UriRef("http://ns.adobe.com/exif/1.0/UserComment"), null);
    it = tc.filter((NonLiteral) it.next().getObject(), null, null);
    while(it.hasNext()) {
      Triple triple = it.next();
      Assert.assertTrue(
          triple.getObject().toString().contains("Bla Bla Bla") ||
          triple.getObject().toString().contains(RDF.Alt.getURI()));
    }
   
    Assert.assertTrue(tc.filter(null,
        new UriRef("http://ns.adobe.com/tiff/1.0/Artist"),
        new PlainLiteralImpl("Hans Wurst")).hasNext());
View Full Code Here


  @Override
  public boolean contains(Object o) {
    if (!(o instanceof Triple)) {
      return false;
    }
    Triple t = (Triple) o;
    return filter(t.getSubject(), t.getPredicate(), t.getObject()).hasNext();
  }
View Full Code Here

    MGraph mGraph = getEmptyMGraph();
    TestGraphListener listener = new TestGraphListener();
    mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null),
        1000);

    Triple triple0 = new TripleImpl(uriRef2, uriRef2, literal1);
    Triple triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
    Triple triple2 = new TripleImpl(uriRef1, uriRef2, literal1);
    Triple triple3 = new TripleImpl(uriRef1, uriRef2, bnode1);
    mGraph.add(triple0);
    mGraph.add(triple1);
    mGraph.add(triple2);
    mGraph.add(triple3);
    Thread.sleep(1500);
View Full Code Here

    return super.add(e);
  }

  @Override
  public boolean remove(Object o) {
    Triple triple = (Triple) o;
    boolean success = performRemove(triple);
    if (success) {
      dispatchEvent(new RemoveEvent(this, triple));
    }
    return success;
View Full Code Here

  }

  @Test
  public void testCreateGraphWithInitialCollection() throws Exception {

    Triple t1 = createTestTriple();

    TcProvider provider = getInstance();

    Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));
View Full Code Here

  }

  @Test
  public void testGraphIsNotMutable() throws Exception {

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

    TcProvider provider = getInstance();
View Full Code Here

 
  @Test public void tripleEquality() {
    NonLiteral subject = new UriRef("http://example.org/");
    UriRef predicate = new UriRef("http://example.org/property");
    Resource object = new PlainLiteralImpl("property value");
    Triple triple1 = new TripleImpl(subject, predicate, object);
    Triple triple2 = new TripleImpl(subject, predicate, object);
    Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
    Assert.assertEquals(triple1, triple2)
  }
View Full Code Here

    stc.add(triple3);
    stc.add(triple4);
    stc.add(triple5);
    Iterator<Triple> iter = stc.iterator();
    while (iter.hasNext()) {
      Triple triple = iter.next();
      iter.remove();
    }
    Assert.assertEquals(0, stc.size());
  }
View Full Code Here

    stc.add(triple3);
    stc.add(triple4);
    stc.add(triple5);   
    Iterator<Triple> iter = stc.filter(uriRef1, null, null);
    while (iter.hasNext()) {
      Triple triple = iter.next();
      iter.remove();
    }
    Assert.assertEquals(3, stc.size());
  }
View Full Code Here

    stc.add(triple3);
    stc.add(triple4);
    stc.add(triple5);
    Iterator<Triple> iter = stc.filter(uriRef1, null, null);
    while (iter.hasNext()) {
      Triple triple = iter.next();
      stc.remove(triple);
    }
    Assert.assertEquals(3, stc.size());
  }
View Full Code Here

TOP

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

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.