You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by ha...@apache.org on 2018/10/29 17:00:43 UTC
[2/4] any23 git commit: ANY23-402 deprecate nonstandard JSONWriter
ANY23-402 deprecate nonstandard JSONWriter
Project: http://git-wip-us.apache.org/repos/asf/any23/repo
Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/ead895e4
Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/ead895e4
Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/ead895e4
Branch: refs/heads/master
Commit: ead895e49710b9278577e3c7f881ffc05fb5286f
Parents: 6bd246e
Author: Hans <fi...@gmail.com>
Authored: Mon Oct 29 11:07:51 2018 -0500
Committer: Hans <fi...@gmail.com>
Committed: Mon Oct 29 11:07:51 2018 -0500
----------------------------------------------------------------------
core/src/main/java/org/apache/any23/writer/JSONWriter.java | 4 +++-
.../main/java/org/apache/any23/writer/JSONWriterFactory.java | 3 +++
.../src/test/java/org/apache/any23/writer/JSONWriterTest.java | 7 ++++---
3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/any23/blob/ead895e4/core/src/main/java/org/apache/any23/writer/JSONWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/writer/JSONWriter.java b/core/src/main/java/org/apache/any23/writer/JSONWriter.java
index 58d869a..2df37b3 100644
--- a/core/src/main/java/org/apache/any23/writer/JSONWriter.java
+++ b/core/src/main/java/org/apache/any23/writer/JSONWriter.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
-import org.apache.any23.configuration.Settings;
import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Literal;
@@ -34,7 +33,10 @@ import org.eclipse.rdf4j.model.Value;
* Implementation of <i>JSON</i> {@link TripleWriter}.
*
* @author Michele Mostarda (mostarda@fbk.eu)
+ *
+ * @deprecated since 2.3. Use {@link JSONLDWriter} instead.
*/
+@Deprecated
public class JSONWriter extends TripleWriterHandler implements FormatWriter {
private JsonGenerator ps;
http://git-wip-us.apache.org/repos/asf/any23/blob/ead895e4/core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java b/core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java
index 8877a25..9e85e99 100644
--- a/core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java
+++ b/core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java
@@ -26,7 +26,10 @@ import java.util.Collections;
/**
* @author Peter Ansell p_ansell@yahoo.com
* @author Hans Brende (hansbrende@apache.org)
+ *
+ * @deprecated since 2.3. Use {@link JSONLDWriterFactory} instead.
*/
+@Deprecated
public class JSONWriterFactory implements TripleWriterFactory {
http://git-wip-us.apache.org/repos/asf/any23/blob/ead895e4/core/src/test/java/org/apache/any23/writer/JSONWriterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/any23/writer/JSONWriterTest.java b/core/src/test/java/org/apache/any23/writer/JSONWriterTest.java
index 0099d9f..8b305ef 100644
--- a/core/src/test/java/org/apache/any23/writer/JSONWriterTest.java
+++ b/core/src/test/java/org/apache/any23/writer/JSONWriterTest.java
@@ -25,7 +25,7 @@ import org.junit.Assert;
import org.junit.Test;
/**
- * Test case for {@link JSONWriter} and {@link JSONLDWriter} class.
+ * Test case for {@link JSONLDWriter} and deprecated JSONWriter classes.
*
* @author Michele Mostarda (mostarda@fbk.eu)
* @author Julio Caguano
@@ -33,6 +33,7 @@ import org.junit.Test;
public class JSONWriterTest {
@Test
+ @Deprecated
public void testJSONWriting() throws TripleHandlerException, IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeContentComplicated(new JSONWriter(baos));
@@ -150,7 +151,7 @@ public class JSONWriterTest {
SimpleValueFactory.getInstance().createIRI("http://graph/2"),
null
);
- if (writer instanceof JSONWriter) {
+ if (!(writer instanceof JSONLDWriter)) {
writer.receiveTriple(
SimpleValueFactory.getInstance().createIRI("http://sub/3"),
SimpleValueFactory.getInstance().createIRI("http://pred/3"),
@@ -158,7 +159,7 @@ public class JSONWriterTest {
null,
null
);
- } else if (writer instanceof JSONLDWriter) {
+ } else {
//creating a fake extraction context in order to write triples is terrible.
//see improved solution in "writeContentSimple"!
ExtractionContext extractionContext = new ExtractionContext("rdf-nq", SimpleValueFactory.getInstance().createIRI("http://any23.org/tmp/"));