You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/10/18 21:37:36 UTC

[1/2] jena git commit: Remove workaround for jsonld-java issue 144.

Repository: jena
Updated Branches:
  refs/heads/master cbb1d4ee8 -> 2019a4d57


Remove workaround for jsonld-java issue 144.

jsonld-java v 0.7.0 has a fix for their issue 144.  Jena does not
need to have it's own parser control for JSON.

Hwoveer, it modifies the behaviour  of documents that have trailing
content.  Now (jsonld-java v0.7.0) these produce no output whereas
Jena used to parse the first valid JSON object, producing triples/quads,
then throw an exception.  jsonld-java v0.7.0 takesa different approach
which is to throw an exception because the JSON parsing now detects the
parse error before any JSON is processed.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/3607c1c9
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/3607c1c9
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/3607c1c9

Branch: refs/heads/master
Commit: 3607c1c9a0760db3a7b92f4bd9a6d2be66fe7d50
Parents: cbb1d4e
Author: Andy Seaborne <an...@apache.org>
Authored: Sun Oct 18 20:36:41 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sun Oct 18 20:36:41 2015 +0100

----------------------------------------------------------------------
 .../org/apache/jena/riot/lang/JsonLDReader.java | 219 +++++++++----------
 .../AbstractNodeTupleInputFormatTests.java      |  21 +-
 .../io/input/jsonld/JsonLDQuadInputTest.java    |  19 +-
 .../io/input/jsonld/JsonLDTripleInputTest.java  |  23 +-
 4 files changed, 163 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3607c1c9/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java b/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
index 0f44248..c9dd1fa 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
@@ -25,11 +25,11 @@ import java.util.List ;
 import java.util.Map ;
 import java.util.Map.Entry;
 import java.util.Objects;
-import java.util.function.Consumer ;
 
-import com.fasterxml.jackson.core.* ;
-import com.fasterxml.jackson.databind.ObjectMapper ;
+import com.fasterxml.jackson.core.JsonLocation ;
+import com.fasterxml.jackson.core.JsonProcessingException ;
 import com.github.jsonldjava.core.* ;
+import com.github.jsonldjava.utils.JsonUtils ;
 
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.lib.InternalErrorException ;
@@ -45,7 +45,6 @@ import org.apache.jena.riot.RiotException ;
 import org.apache.jena.riot.system.* ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.util.Context ;
-import org.apache.jena.util.FileUtils ;
 
 public class JsonLDReader implements ReaderRIOT
 {
@@ -58,67 +57,11 @@ public class JsonLDReader implements ReaderRIOT
     @Override public ParserProfile getParserProfile()                   { return parserProfile ; }
     @Override public void setParserProfile(ParserProfile parserProfile) { this.parserProfile = parserProfile ; }
     
-//    @Override
-//    public void read(Reader reader, String baseURI, ContentType ct, StreamRDF output, Context context) {
-//        try {
-//            Object jsonObject = JsonUtils.fromReader(reader) ;
-//            read$(jsonObject, baseURI, ct, output, context) ;
-//        }
-//        catch (JsonProcessingException ex) {    
-//            // includes JsonParseException
-//            // The Jackson JSON parser, or addition JSON-level check, throws up something.
-//            JsonLocation loc = ex.getLocation() ;
-//            errorHandler.error(ex.getOriginalMessage(), loc.getLineNr(), loc.getColumnNr()); 
-//            throw new RiotException(ex.getOriginalMessage()) ;
-//        }
-//        catch (IOException e) {
-//            errorHandler.error(e.getMessage(), -1, -1); 
-//            IO.exception(e) ;
-//        }
-//    }
-//
-//    @Override
-//    public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) {
-//        try {
-//            Object jsonObject = JsonUtils.fromInputStream(in) ;
-//            read$(jsonObject, baseURI, ct, output, context) ;
-//        }
-//        catch (JsonProcessingException ex) {    
-//            // includes JsonParseException
-//            // The Jackson JSON parser, or addition JSON-level check, throws up something.
-//            JsonLocation loc = ex.getLocation() ;
-//            errorHandler.error(ex.getOriginalMessage(), loc.getLineNr(), loc.getColumnNr()); 
-//            throw new RiotException(ex.getOriginalMessage()) ;
-//        }
-//        catch (IOException e) {
-//            errorHandler.error(e.getMessage(), -1, -1); 
-//            IO.exception(e) ;
-//        }
-//    }
-    
-    // This addresses jsonld-java issue #144 prior to jsonld-java release 0.6.0 in
-    // Jena code so that we get triples/quads out then there is a parse error.
-    // Even if it is fixed in jsonld-java, it would mean that no triples would
-    // be produced - all the JSON parsing is done before JSON-LD processing.
-    // Here we process the first JSON object, which causes triples to be
-    // generated then decide whether to throw a parse error. This is more in the
-    // style of other syntaxes and stream parsing.
-    //
-    // This fix is in jsonld-java itself release 0.6.0 and later.
-    // But.
-    // The fix in jsonld-java is the "readProcess" code JsonUtils.fromReader
-    // without the Consumer. It parses all the JSON, checks for trailing junk,
-    // then returns an object that is converted to RDF objects.  All bad JSON
-    // causes no triples or quads.
-    //
-    // The code here extracts the JSON object, generates RDF, then checks for
-    // trailing junk so produces triples/quads then an exception.
-    
     @Override
     public void read(Reader reader, String baseURI, ContentType ct, StreamRDF output, Context context) {
         try {
-            readProcess(reader, 
-                       (jsonObject)->read$(jsonObject, baseURI, ct, output, context)) ;
+            Object jsonObject = JsonUtils.fromReader(reader) ;
+            read$(jsonObject, baseURI, ct, output, context) ;
         }
         catch (JsonProcessingException ex) {    
             // includes JsonParseException
@@ -135,58 +78,114 @@ public class JsonLDReader implements ReaderRIOT
 
     @Override
     public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) {
-        Reader r = FileUtils.asBufferedUTF8(in) ;
-        read(r, baseURI, ct, output, context) ;
-    }
-
-    // From JsonUtils.fromReader in the jsonld-java codebase.
-    // Note that jsonld-java always uses a reader.
-    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-    private static final JsonFactory JSON_FACTORY = new JsonFactory(JSON_MAPPER);
-    
-    /** Read a JSON object from the reader, acall the prcoessing function, then
-     * check for trailing content. For Jena, this means tripes/quads are generated
-     * from a valid JSON object, then there is a  parse error for trailing junk.   
-     * @param reader
-     * @param function
-     * @throws IOException
-     */
-    private static void readProcess(Reader reader, Consumer<Object> function) throws IOException {
-        final JsonParser jp = JSON_FACTORY.createParser(reader);
-        Object rval ;
-        final JsonToken initialToken = jp.nextToken();
-
-        if (initialToken == JsonToken.START_ARRAY) {
-            rval = jp.readValueAs(List.class);
-        } else if (initialToken == JsonToken.START_OBJECT) {
-            rval = jp.readValueAs(Map.class);
-        } else if (initialToken == JsonToken.VALUE_STRING) {
-            rval = jp.readValueAs(String.class);
-        } else if (initialToken == JsonToken.VALUE_FALSE || initialToken == JsonToken.VALUE_TRUE) {
-            rval = jp.readValueAs(Boolean.class);
-        } else if (initialToken == JsonToken.VALUE_NUMBER_FLOAT
-                || initialToken == JsonToken.VALUE_NUMBER_INT) {
-            rval = jp.readValueAs(Number.class);
-        } else if (initialToken == JsonToken.VALUE_NULL) {
-            rval = null;
-        } else {
-            throw new JsonParseException("document doesn't start with a valid json element : "
-                    + initialToken, jp.getCurrentLocation());
+        try {
+            Object jsonObject = JsonUtils.fromInputStream(in) ;
+            read$(jsonObject, baseURI, ct, output, context) ;
         }
-        
-        function.accept(rval);
-        
-        JsonToken t ;
-        try { t = jp.nextToken(); }
-        catch (JsonParseException ex) {
-            throw new JsonParseException("Document contains more content after json-ld element - (possible mismatched {}?)",
-                                         jp.getCurrentLocation());
+        catch (JsonProcessingException ex) {    
+            // includes JsonParseException
+            // The Jackson JSON parser, or addition JSON-level check, throws up something.
+            JsonLocation loc = ex.getLocation() ;
+            errorHandler.error(ex.getOriginalMessage(), loc.getLineNr(), loc.getColumnNr()); 
+            throw new RiotException(ex.getOriginalMessage()) ;
+        }
+        catch (IOException e) {
+            errorHandler.error(e.getMessage(), -1, -1); 
+            IO.exception(e) ;
         }
-        if ( t != null )
-            throw new JsonParseException("Document contains possible json content after the json-ld element - (possible mismatched {}?)",
-                                             jp.getCurrentLocation());
     }
     
+//    // This addresses jsonld-java issue #144 prior to jsonld-java release 0.6.0 in
+//    // Jena code so that we get triples/quads out then there is a parse error.
+//    // Even if it is fixed in jsonld-java, it would mean that no triples would
+//    // be produced - all the JSON parsing is done before JSON-LD processing.
+//    // Here we process the first JSON object, which causes triples to be
+//    // generated then decide whether to throw a parse error. This is more in the
+//    // style of other syntaxes and stream parsing.
+//    //
+//    // This fix is in jsonld-java itself release 0.6.0 and later.
+//    // But.
+//    // The fix in jsonld-java is the "readProcess" code JsonUtils.fromReader
+//    // without the Consumer. It parses all the JSON, checks for trailing junk,
+//    // then returns an object that is converted to RDF objects.  All bad JSON
+//    // causes no triples or quads.
+//    //
+//    // The code here extracts the JSON object, generates RDF, then checks for
+//    // trailing junk so produces triples/quads then an exception.
+//    
+//    @Override
+//    public void read(Reader reader, String baseURI, ContentType ct, StreamRDF output, Context context) {
+//        try {
+//            readProcess(reader, 
+//                       (jsonObject)->read$(jsonObject, baseURI, ct, output, context)) ;
+//        }
+//        catch (JsonProcessingException ex) {    
+//            // includes JsonParseException
+//            // The Jackson JSON parser, or addition JSON-level check, throws up something.
+//            JsonLocation loc = ex.getLocation() ;
+//            errorHandler.error(ex.getOriginalMessage(), loc.getLineNr(), loc.getColumnNr()); 
+//            throw new RiotException(ex.getOriginalMessage()) ;
+//        }
+//        catch (IOException e) {
+//            errorHandler.error(e.getMessage(), -1, -1); 
+//            IO.exception(e) ;
+//        }
+//    }
+//
+//    @Override
+//    public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) {
+//        Reader r = FileUtils.asBufferedUTF8(in) ;
+//        read(r, baseURI, ct, output, context) ;
+//    }
+//
+//    // From JsonUtils.fromReader in the jsonld-java codebase.
+//    // Note that jsonld-java always uses a reader.
+//    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+//    private static final JsonFactory JSON_FACTORY = new JsonFactory(JSON_MAPPER);
+//    
+//    /** Read a JSON object from the reader, acall the prcoessing function, then
+//     * check for trailing content. For Jena, this means tripes/quads are generated
+//     * from a valid JSON object, then there is a  parse error for trailing junk.   
+//     * @param reader
+//     * @param function
+//     * @throws IOException
+//     */
+//    private static void readProcess(Reader reader, Consumer<Object> function) throws IOException {
+//        final JsonParser jp = JSON_FACTORY.createParser(reader);
+//        Object rval ;
+//        final JsonToken initialToken = jp.nextToken();
+//
+//        if (initialToken == JsonToken.START_ARRAY) {
+//            rval = jp.readValueAs(List.class);
+//        } else if (initialToken == JsonToken.START_OBJECT) {
+//            rval = jp.readValueAs(Map.class);
+//        } else if (initialToken == JsonToken.VALUE_STRING) {
+//            rval = jp.readValueAs(String.class);
+//        } else if (initialToken == JsonToken.VALUE_FALSE || initialToken == JsonToken.VALUE_TRUE) {
+//            rval = jp.readValueAs(Boolean.class);
+//        } else if (initialToken == JsonToken.VALUE_NUMBER_FLOAT
+//                || initialToken == JsonToken.VALUE_NUMBER_INT) {
+//            rval = jp.readValueAs(Number.class);
+//        } else if (initialToken == JsonToken.VALUE_NULL) {
+//            rval = null;
+//        } else {
+//            throw new JsonParseException("document doesn't start with a valid json element : "
+//                    + initialToken, jp.getCurrentLocation());
+//        }
+//        
+//        function.accept(rval);
+//        
+//        JsonToken t ;
+//        try { t = jp.nextToken(); }
+//        catch (JsonParseException ex) {
+//            throw new JsonParseException("Document contains more content after json-ld element - (possible mismatched {}?)",
+//                                         jp.getCurrentLocation());
+//        }
+//        if ( t != null )
+//            throw new JsonParseException("Document contains possible json content after the json-ld element - (possible mismatched {}?)",
+//                                             jp.getCurrentLocation());
+//    }
+    
     private void read$(Object jsonObject, String baseURI, ContentType ct, final StreamRDF output, Context context) {
         if ( parserProfile == null )
             parserProfile = RiotLib.profile(RDFLanguages.JSONLD, baseURI, errorHandler) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/3607c1c9/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractNodeTupleInputFormatTests.java
----------------------------------------------------------------------
diff --git a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractNodeTupleInputFormatTests.java b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractNodeTupleInputFormatTests.java
index 66a4f03..bf44c10 100644
--- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractNodeTupleInputFormatTests.java
+++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/AbstractNodeTupleInputFormatTests.java
@@ -399,7 +399,14 @@ public abstract class AbstractNodeTupleInputFormatTests<TValue, T extends Abstra
      */
     @Test
     public final void single_input_05() throws IOException, InterruptedException {
-        testSingleInput(mixed, 1, MIXED_SIZE / 2);
+        // JSON-LD overrides this because in JSON-LD parsing a bad document gives no triples. 
+        int x = single_input_05_expected() ;
+        testSingleInput(mixed, 1, x);
+    }
+
+    /** Results exected for test single_input_05 */ 
+    protected int single_input_05_expected() {
+        return MIXED_SIZE / 2 ;
     }
 
     /**
@@ -494,8 +501,16 @@ public abstract class AbstractNodeTupleInputFormatTests<TValue, T extends Abstra
      */
     @Test
     public final void multiple_inputs_02() throws IOException, InterruptedException {
-        testMultipleInputs(new File[] { folder.getRoot() }, this.canSplitInputs() ? 4 : 5, EMPTY_SIZE + SMALL_SIZE
-                + LARGE_SIZE + (MIXED_SIZE / 2));
+        int expectedTriples = multiple_inputs_02_expected() ; 
+        testMultipleInputs(new File[] { folder.getRoot() }, this.canSplitInputs() ? 4 : 5, expectedTriples);
+    }
+
+    /** Results exected for test multiple_inputs_02.
+     * JSON_LD has different characteristics on bad documents.
+     * See {@link #single_input_05}.
+     */ 
+    protected int multiple_inputs_02_expected() {
+        return EMPTY_SIZE + SMALL_SIZE + LARGE_SIZE + (MIXED_SIZE / 2) ;
     }
 
     protected final void testSplitInputs(Configuration config, File[] inputs, int expectedSplits, int expectedTuples)

http://git-wip-us.apache.org/repos/asf/jena/blob/3607c1c9/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDQuadInputTest.java
----------------------------------------------------------------------
diff --git a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDQuadInputTest.java b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDQuadInputTest.java
index 92aac53..5345984 100644
--- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDQuadInputTest.java
+++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDQuadInputTest.java
@@ -45,6 +45,21 @@ public class JsonLDQuadInputTest extends AbstractWholeFileQuadInputFormatTests {
     @Override
     protected InputFormat<LongWritable, QuadWritable> getInputFormat() {
         return new JsonLDQuadInputFormat();
-    }
-
+    }
+    
+    /** JSON_LD does not produce any quads from a bad document (no partial streaming).
+     * @see #single_input_05()
+    */
+    @Override
+    protected int single_input_05_expected() {
+        return 0 ;
+    }
+    
+    /** JSON_LD does not produce any quads from a bad document (no partial streaming).
+     * @see #multiple_inputs_02()
+     */
+    @Override
+    protected int multiple_inputs_02_expected() {
+        return EMPTY_SIZE + SMALL_SIZE + LARGE_SIZE ;
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/3607c1c9/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDTripleInputTest.java
----------------------------------------------------------------------
diff --git a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDTripleInputTest.java b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDTripleInputTest.java
index 63b6738..ed20e07 100644
--- a/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDTripleInputTest.java
+++ b/jena-elephas/jena-elephas-io/src/test/java/org/apache/jena/hadoop/rdf/io/input/jsonld/JsonLDTripleInputTest.java
@@ -18,8 +18,8 @@
 
 package org.apache.jena.hadoop.rdf.io.input.jsonld;
 
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.mapreduce.InputFormat;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.mapreduce.InputFormat;
 import org.apache.jena.hadoop.rdf.io.input.AbstractWholeFileTripleInputFormatTests;
 import org.apache.jena.hadoop.rdf.types.TripleWritable;
 import org.apache.jena.riot.Lang;
@@ -45,6 +45,21 @@ public class JsonLDTripleInputTest extends AbstractWholeFileTripleInputFormatTes
     @Override
     protected InputFormat<LongWritable, TripleWritable> getInputFormat() {
         return new JsonLDTripleInputFormat();
-    }
-
+    }
+    
+    /** JSON_LD does not produce any triples from a bad document (no partial streaming).
+     * @see #single_input_05()
+    */
+    @Override
+    protected int single_input_05_expected() {
+        return 0 ;
+    }
+    
+    /** JSON_LD does not produce any triples from a bad document (no partial streaming).
+     * @see #multiple_inputs_02()
+     */
+    @Override
+    protected int multiple_inputs_02_expected() {
+        return EMPTY_SIZE + SMALL_SIZE + LARGE_SIZE ;
+    }
 }


[2/2] jena git commit: Removed commented alternative code.

Posted by an...@apache.org.
Removed commented alternative code.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/2019a4d5
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/2019a4d5
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/2019a4d5

Branch: refs/heads/master
Commit: 2019a4d57f1a239aa27575f0726fbe110436cea8
Parents: 3607c1c
Author: Andy Seaborne <an...@apache.org>
Authored: Sun Oct 18 20:37:17 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sun Oct 18 20:37:17 2015 +0100

----------------------------------------------------------------------
 .../org/apache/jena/riot/lang/JsonLDReader.java | 91 --------------------
 1 file changed, 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/2019a4d5/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java b/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
index c9dd1fa..429c63d 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/lang/JsonLDReader.java
@@ -95,97 +95,6 @@ public class JsonLDReader implements ReaderRIOT
         }
     }
     
-//    // This addresses jsonld-java issue #144 prior to jsonld-java release 0.6.0 in
-//    // Jena code so that we get triples/quads out then there is a parse error.
-//    // Even if it is fixed in jsonld-java, it would mean that no triples would
-//    // be produced - all the JSON parsing is done before JSON-LD processing.
-//    // Here we process the first JSON object, which causes triples to be
-//    // generated then decide whether to throw a parse error. This is more in the
-//    // style of other syntaxes and stream parsing.
-//    //
-//    // This fix is in jsonld-java itself release 0.6.0 and later.
-//    // But.
-//    // The fix in jsonld-java is the "readProcess" code JsonUtils.fromReader
-//    // without the Consumer. It parses all the JSON, checks for trailing junk,
-//    // then returns an object that is converted to RDF objects.  All bad JSON
-//    // causes no triples or quads.
-//    //
-//    // The code here extracts the JSON object, generates RDF, then checks for
-//    // trailing junk so produces triples/quads then an exception.
-//    
-//    @Override
-//    public void read(Reader reader, String baseURI, ContentType ct, StreamRDF output, Context context) {
-//        try {
-//            readProcess(reader, 
-//                       (jsonObject)->read$(jsonObject, baseURI, ct, output, context)) ;
-//        }
-//        catch (JsonProcessingException ex) {    
-//            // includes JsonParseException
-//            // The Jackson JSON parser, or addition JSON-level check, throws up something.
-//            JsonLocation loc = ex.getLocation() ;
-//            errorHandler.error(ex.getOriginalMessage(), loc.getLineNr(), loc.getColumnNr()); 
-//            throw new RiotException(ex.getOriginalMessage()) ;
-//        }
-//        catch (IOException e) {
-//            errorHandler.error(e.getMessage(), -1, -1); 
-//            IO.exception(e) ;
-//        }
-//    }
-//
-//    @Override
-//    public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) {
-//        Reader r = FileUtils.asBufferedUTF8(in) ;
-//        read(r, baseURI, ct, output, context) ;
-//    }
-//
-//    // From JsonUtils.fromReader in the jsonld-java codebase.
-//    // Note that jsonld-java always uses a reader.
-//    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-//    private static final JsonFactory JSON_FACTORY = new JsonFactory(JSON_MAPPER);
-//    
-//    /** Read a JSON object from the reader, acall the prcoessing function, then
-//     * check for trailing content. For Jena, this means tripes/quads are generated
-//     * from a valid JSON object, then there is a  parse error for trailing junk.   
-//     * @param reader
-//     * @param function
-//     * @throws IOException
-//     */
-//    private static void readProcess(Reader reader, Consumer<Object> function) throws IOException {
-//        final JsonParser jp = JSON_FACTORY.createParser(reader);
-//        Object rval ;
-//        final JsonToken initialToken = jp.nextToken();
-//
-//        if (initialToken == JsonToken.START_ARRAY) {
-//            rval = jp.readValueAs(List.class);
-//        } else if (initialToken == JsonToken.START_OBJECT) {
-//            rval = jp.readValueAs(Map.class);
-//        } else if (initialToken == JsonToken.VALUE_STRING) {
-//            rval = jp.readValueAs(String.class);
-//        } else if (initialToken == JsonToken.VALUE_FALSE || initialToken == JsonToken.VALUE_TRUE) {
-//            rval = jp.readValueAs(Boolean.class);
-//        } else if (initialToken == JsonToken.VALUE_NUMBER_FLOAT
-//                || initialToken == JsonToken.VALUE_NUMBER_INT) {
-//            rval = jp.readValueAs(Number.class);
-//        } else if (initialToken == JsonToken.VALUE_NULL) {
-//            rval = null;
-//        } else {
-//            throw new JsonParseException("document doesn't start with a valid json element : "
-//                    + initialToken, jp.getCurrentLocation());
-//        }
-//        
-//        function.accept(rval);
-//        
-//        JsonToken t ;
-//        try { t = jp.nextToken(); }
-//        catch (JsonParseException ex) {
-//            throw new JsonParseException("Document contains more content after json-ld element - (possible mismatched {}?)",
-//                                         jp.getCurrentLocation());
-//        }
-//        if ( t != null )
-//            throw new JsonParseException("Document contains possible json content after the json-ld element - (possible mismatched {}?)",
-//                                             jp.getCurrentLocation());
-//    }
-    
     private void read$(Object jsonObject, String baseURI, ContentType ct, final StreamRDF output, Context context) {
         if ( parserProfile == null )
             parserProfile = RiotLib.profile(RDFLanguages.JSONLD, baseURI, errorHandler) ;