You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2018/02/28 23:55:03 UTC

[9/9] commons-rdf git commit: Update example to new fluent API

Update example to new fluent API


Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/d850d8f4
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/d850d8f4
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/d850d8f4

Branch: refs/heads/fluent-parser-impl
Commit: d850d8f43fe985e6f8e4ecaaabe0454753f7bee6
Parents: 3789bad
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed Feb 28 23:54:33 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Wed Feb 28 23:54:33 2018 +0000

----------------------------------------------------------------------
 .../commons/rdf/jena/TestRDFParserBuilder.java     | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/d850d8f4/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java b/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
index b0c552f..2b71d88 100644
--- a/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
+++ b/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
@@ -29,14 +29,15 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.rdf.api.Graph;
 import org.apache.commons.rdf.api.RDFSyntax;
-import org.apache.commons.rdf.experimental.RDFParser.ParseResult;
-import org.apache.commons.rdf.jena.experimental.JenaRDFParser;
+import org.apache.commons.rdf.api.io.Parsed;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 public class TestRDFParserBuilder {
 
+	JenaRDF jenaRDF = new JenaRDF();
+	
     private Path turtleFile;
 
     @Before
@@ -54,9 +55,15 @@ public class TestRDFParserBuilder {
 
     @Test
     public void parseTurtle() throws Exception {
-        try (final Graph g = new JenaRDF().createGraph()) {
-            final Future<ParseResult> gFuture = new JenaRDFParser().contentType(RDFSyntax.TURTLE).source(turtleFile)
-                    .target(g).parse();
+        
+		try (final Graph g = jenaRDF.createGraph()) {
+			Future<Parsed<Graph, Path>> gFuture = jenaRDF.parserBuilder()
+					.syntax(RDFSyntax.TURTLE)
+					.target(g)
+					.source(turtleFile)
+					.async()
+					.parseAsync();					
+					
             gFuture.get(5, TimeUnit.SECONDS);
             assertEquals(3, g.size());
         }