Java Code Examples for org.apache.jena.riot.system.StreamRDF#triple()

The following examples show how to use org.apache.jena.riot.system.StreamRDF#triple() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenerateFormPlan.java    From sparql-generate with Apache License 2.0 5 votes vote down vote up
private synchronized void outputIfConcrete(
        final StringBuilder sb,
        final StreamRDF outputStream,
        final Triple t) {
    if (t.isConcrete()) {
        if (LOG.isTraceEnabled()) {
            Triple t2 = LogUtils.compress(t);
            sb.append("\n  ").append(t2);
        }
        outputStream.triple(t);
    }
}
 
Example 2
Source File: StreamRDFDedupTest.java    From tarql with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test public void shouldPassThroughTriples() {
	StreamRDF dedup = new StreamRDFDedup(new MockStreamRDF());
	dedup.start();
	dedup.triple(triple("<a> <a> <a>"));
	dedup.triple(triple("<b> <b> <b>"));
	dedup.triple(triple("<c> <c> <c>"));
	dedup.finish();
	assertEquals(triples("<a> <a> <a>", "<b> <b> <b>", "<c> <c> <c>"), received);
}
 
Example 3
Source File: StreamRDFDedupTest.java    From tarql with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test public void shouldRemoveDuplicateInWindow() {
	StreamRDF dedup = new StreamRDFDedup(new MockStreamRDF());
	dedup.start();
	dedup.triple(triple("<a> <a> <a>"));
	dedup.triple(triple("<a> <a> <a>"));
	dedup.finish();
	assertEquals(triples("<a> <a> <a>"), received);
}
 
Example 4
Source File: StreamRDFDedupTest.java    From tarql with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test public void shouldNotRemoveDuplicateOutsideWindow() {
	StreamRDF dedup = new StreamRDFDedup(new MockStreamRDF(), 2);
	dedup.start();
	dedup.triple(triple("<a> <a> <a>"));
	dedup.triple(triple("<b> <b> <b>"));
	dedup.triple(triple("<a> <a> <a>"));
	dedup.triple(triple("<c> <c> <c>"));
	dedup.triple(triple("<a> <a> <a>"));
	dedup.finish();
	assertEquals(triples("<a> <a> <a>", "<b> <b> <b>", "<c> <c> <c>", "<a> <a> <a>"), received);
}
 
Example 5
Source File: ExRIOT_5.java    From xcurator with Apache License 2.0 4 votes vote down vote up
private void read(Item item, String baseURI, ContentType ct, StreamRDF output, Context context) {
    Graph graph = BuilderGraph.buildGraph(item) ;
    Iterator<Triple> iter = graph.find(null, null, null) ;
    for ( ; iter.hasNext() ; )
        output.triple(iter.next()) ;
}