jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [05/41] jena git commit: JSONLD RDFFormat variants no more public
Date Mon, 03 Oct 2016 10:35:37 GMT
JSONLD RDFFormat variants no more public

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

Branch: refs/heads/master
Commit: a5f2e06db9583248f1a33f3c0ca85ee2b4039de0
Parents: 1e2bdc7
Author: Franc╠žois-Paul Servant <fps@semanlink.net>
Authored: Fri May 6 01:14:43 2016 +0200
Committer: Franc╠žois-Paul Servant <fps@semanlink.net>
Committed: Fri May 6 01:14:43 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/jena/riot/RDFFormat.java    | 16 +++----
 .../org/apache/jena/riot/out/JsonLDWriter.java  | 45 +++++++++-----------
 2 files changed, 29 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/a5f2e06d/jena-arq/src/main/java/org/apache/jena/riot/RDFFormat.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFFormat.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFFormat.java
index faec196..311b21b 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFFormat.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFFormat.java
@@ -84,14 +84,14 @@ public class RDFFormat {
     // we're more or less obliged to create all of these
     // (I'd have preferred to use a flag for pretty vs flat)
     
-    public static final RDFFormatVariant EXPAND_PRETTY      = new RDFFormatVariant("expand
pretty") ;
-    public static final RDFFormatVariant EXPAND_FLAT        = new RDFFormatVariant("expand
flat") ;
-    public static final RDFFormatVariant COMPACT_PRETTY     = new RDFFormatVariant("compact
pretty") ;
-    public static final RDFFormatVariant COMPACT_FLAT       = new RDFFormatVariant("compact
flat") ;
-    public static final RDFFormatVariant FLATTEN_PRETTY     = new RDFFormatVariant("flatten
pretty") ;
-    public static final RDFFormatVariant FLATTEN_FLAT       = new RDFFormatVariant("flatten
flat") ;
-    public static final RDFFormatVariant FRAME_PRETTY       = new RDFFormatVariant("frame
pretty") ;
-    public static final RDFFormatVariant FRAME_FLAT         = new RDFFormatVariant("frame
flat") ;
+    private static final RDFFormatVariant EXPAND_PRETTY      = new RDFFormatVariant("expand
pretty") ;
+    private static final RDFFormatVariant EXPAND_FLAT        = new RDFFormatVariant("expand
flat") ;
+    private static final RDFFormatVariant COMPACT_PRETTY     = new RDFFormatVariant("compact
pretty") ;
+    private static final RDFFormatVariant COMPACT_FLAT       = new RDFFormatVariant("compact
flat") ;
+    private static final RDFFormatVariant FLATTEN_PRETTY     = new RDFFormatVariant("flatten
pretty") ;
+    private static final RDFFormatVariant FLATTEN_FLAT       = new RDFFormatVariant("flatten
flat") ;
+    private static final RDFFormatVariant FRAME_PRETTY       = new RDFFormatVariant("frame
pretty") ;
+    private static final RDFFormatVariant FRAME_FLAT         = new RDFFormatVariant("frame
flat") ;
 
     public static final RDFFormat        JSONLD_EXPAND_PRETTY   = new RDFFormat(Lang.JSONLD,
EXPAND_PRETTY) ;
     public static final RDFFormat        JSONLD_EXPAND_FLAT     = new RDFFormat(Lang.JSONLD,
EXPAND_FLAT) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a5f2e06d/jena-arq/src/main/java/org/apache/jena/riot/out/JsonLDWriter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/out/JsonLDWriter.java b/jena-arq/src/main/java/org/apache/jena/riot/out/JsonLDWriter.java
index 840364e..c6e834d 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/out/JsonLDWriter.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/out/JsonLDWriter.java
@@ -18,21 +18,18 @@
 
 package org.apache.jena.riot.out ;
 
+import static org.apache.jena.rdf.model.impl.Util.isLangString;
+import static org.apache.jena.rdf.model.impl.Util.isSimpleString;
+
 import java.io.IOException ;
 import java.io.OutputStream ;
 import java.io.OutputStreamWriter ;
 import java.io.Writer ;
-import java.util.* ;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.function.Consumer;
 
-import com.fasterxml.jackson.core.JsonGenerationException ;
-import com.fasterxml.jackson.databind.JsonMappingException ;
-import com.github.jsonldjava.core.JsonLdError ;
-import com.github.jsonldjava.core.JsonLdOptions ;
-import com.github.jsonldjava.core.JsonLdProcessor ;
-import com.github.jsonldjava.utils.JsonUtils ;
-
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Chars ;
@@ -41,11 +38,8 @@ import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.iri.IRI ;
 import org.apache.jena.rdf.model.Model;
-
-import static org.apache.jena.rdf.model.impl.Util.* ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFFormat ;
-import org.apache.jena.riot.RDFFormatVariant;
 import org.apache.jena.riot.RiotException ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.PrefixMapFactory;
@@ -55,6 +49,13 @@ import org.apache.jena.sparql.util.Context ;
 import org.apache.jena.sparql.util.Symbol;
 import org.apache.jena.vocabulary.RDF ;
 
+import com.fasterxml.jackson.core.JsonGenerationException ;
+import com.fasterxml.jackson.databind.JsonMappingException ;
+import com.github.jsonldjava.core.JsonLdError ;
+import com.github.jsonldjava.core.JsonLdOptions ;
+import com.github.jsonldjava.core.JsonLdProcessor ;
+import com.github.jsonldjava.utils.JsonUtils ;
+
 /**
  * Writer that prints out JSON-LD.
  * 
@@ -108,22 +109,18 @@ public class JsonLDWriter extends WriterDatasetRIOTBase
     }
 
     private JSONLD_FORMAT getOutputFormat() {
-	  		RDFFormatVariant v = format.getVariant() ;
-	  		if ((RDFFormat.COMPACT_PRETTY.equals(v)) || (RDFFormat.COMPACT_FLAT.equals(v))) return
JSONLD_FORMAT.COMPACT;
-	  		if ((RDFFormat.EXPAND_PRETTY.equals(v)) || (RDFFormat.EXPAND_FLAT.equals(v))) return
JSONLD_FORMAT.EXPAND;
-	  		if ((RDFFormat.FLATTEN_PRETTY.equals(v)) || (RDFFormat.FLATTEN_FLAT.equals(v))) return
JSONLD_FORMAT.FLATTEN;
-	  		if ((RDFFormat.FRAME_PRETTY.equals(v)) || (RDFFormat.FRAME_FLAT.equals(v))) return JSONLD_FORMAT.FRAME;
-	  		return JSONLD_FORMAT.COMPACT ;
+	  		if ((RDFFormat.JSONLD_COMPACT_PRETTY.equals(format)) || (RDFFormat.JSONLD_COMPACT_FLAT.equals(format)))
return JSONLD_FORMAT.COMPACT;
+	  		if ((RDFFormat.JSONLD_EXPAND_PRETTY.equals(format)) || (RDFFormat.JSONLD_EXPAND_FLAT.equals(format)))
return JSONLD_FORMAT.EXPAND;
+	  		if ((RDFFormat.JSONLD_FLATTEN_PRETTY.equals(format)) || (RDFFormat.JSONLD_FLATTEN_FLAT.equals(format)))
return JSONLD_FORMAT.FLATTEN;
+	  		if ((RDFFormat.JSONLD_FRAME_PRETTY.equals(format)) || (RDFFormat.JSONLD_FRAME_FLAT.equals(format)))
return JSONLD_FORMAT.FRAME;
+	  		throw new RuntimeException("Unexpected output format");
     }
     
     private boolean isPretty() {
-        // return RDFFormat.PRETTY.equals(format.getVariant()) ;
-    		RDFFormatVariant v = format.getVariant() ;
-    		// return ((v == null) || (v.toString().indexOf("pretty") > -1)) ;
-    		return (((RDFFormat.COMPACT_PRETTY.equals(v))
-    				|| (RDFFormat.FLATTEN_PRETTY.equals(v))
-    				|| (RDFFormat.EXPAND_PRETTY.equals(v)))
-    				|| (RDFFormat.FRAME_PRETTY.equals(v))) ;
+    		return (((RDFFormat.JSONLD_COMPACT_PRETTY.equals(format))
+    				|| (RDFFormat.JSONLD_FLATTEN_PRETTY.equals(format))
+    				|| (RDFFormat.JSONLD_EXPAND_PRETTY.equals(format)))
+    				|| (RDFFormat.JSONLD_FRAME_PRETTY.equals(format))) ;
     }
     
     private JsonLdOptions getJsonLdOptions(String baseURI, Context jenaContext) {


Mime
View raw message