Search in sources :

Example 6 with StreamRDFCounting

use of org.apache.jena.riot.lang.StreamRDFCounting in project jena by apache.

the class TestStreamRDF method stream_count_01.

@Test
public void stream_count_01() {
    StreamRDFCounting stream = StreamRDFLib.count();
    stream.start();
    assertEquals(0, stream.count());
    stream.triple(triple1);
    assertEquals(1, stream.count());
    stream.triple(triple1);
    assertEquals(2, stream.count());
    stream.finish();
    assertEquals(2, stream.count());
    assertEquals(2, stream.countTriples());
    assertEquals(0, stream.countQuads());
}
Also used : StreamRDFCounting(org.apache.jena.riot.lang.StreamRDFCounting) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 7 with StreamRDFCounting

use of org.apache.jena.riot.lang.StreamRDFCounting in project jena by apache.

the class TestStreamRDF method stream_count_02.

@Test
public void stream_count_02() {
    StreamRDFCounting stream = StreamRDFLib.count();
    stream.start();
    stream.triple(triple1);
    stream.quad(quad1);
    assertEquals(2, stream.count());
    assertEquals(1, stream.countTriples());
    assertEquals(1, stream.countQuads());
    stream.finish();
}
Also used : StreamRDFCounting(org.apache.jena.riot.lang.StreamRDFCounting) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

StreamRDFCounting (org.apache.jena.riot.lang.StreamRDFCounting)7 InputStream (java.io.InputStream)3 GZIPInputStream (java.util.zip.GZIPInputStream)3 ContentType (org.apache.jena.atlas.web.ContentType)3 Lang (org.apache.jena.riot.Lang)3 IOException (java.io.IOException)2 FileItemIterator (org.apache.commons.fileupload.FileItemIterator)2 FileItemStream (org.apache.commons.fileupload.FileItemStream)2 ServletFileUpload (org.apache.commons.fileupload.servlet.ServletFileUpload)2 BaseTest (org.apache.jena.atlas.junit.BaseTest)2 RiotParseException (org.apache.jena.riot.RiotParseException)2 WebContent.matchContentType (org.apache.jena.riot.WebContent.matchContentType)2 Test (org.junit.Test)2 IRI (org.apache.jena.iri.IRI)1 StreamRDF (org.apache.jena.riot.system.StreamRDF)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1