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:37 UTC

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

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) ;