You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/08/21 20:01:13 UTC
svn commit: r1805673 - in /uima/uimaj/trunk/uimaj-json/src:
main/java/org/apache/uima/json/
test/resources/CasSerialization/expected/json/
Author: schor
Date: Mon Aug 21 20:01:12 2017
New Revision: 1805673
URL: http://svn.apache.org/viewvc?rev=1805673&view=rev
Log:
[UIMA-5532] fixes for this, correcting some mistakes in expected results.
Modified:
uima/uimaj/trunk/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java
uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a1-not-a.txt
uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a2-not-a.txt
uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a3-not-a.txt
uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-all-embeddable-a.txt
Modified: uima/uimaj/trunk/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java?rev=1805673&r1=1805672&r2=1805673&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java (original)
+++ uima/uimaj/trunk/uimaj-json/src/main/java/org/apache/uima/json/JsonCasSerializer.java Mon Aug 21 20:01:12 2017
@@ -929,7 +929,7 @@ public class JsonCasSerializer {
// if we're not going to write the actual FS here,
// and are just going to write the ref,
// skip the start object
- if (cds.multiRefFSs == null || !cds.multiRefFSs.contains(addr)) {
+ if (!cds.isDynamicMultiRef || !cds.multiRefFSs.contains(addr)) {
jch.writeNlJustBeforeNext();
jg.writeStartObject(); // start of feat : value
}
@@ -1084,7 +1084,7 @@ public class JsonCasSerializer {
* @throws IOException
*/
private void writeFsOrRef(int addr) throws IOException {
- if (addr == 0 || null == cds.multiRefFSs || cds.multiRefFSs.contains(addr)) {
+ if (addr == 0 || !cds.isDynamicMultiRef || cds.multiRefFSs.contains(addr)) {
jg.writeNumber(cds.getXmiIdAsInt(addr));
} else {
isEmbeddedFromFsFeature = false;
@@ -1108,7 +1108,7 @@ public class JsonCasSerializer {
}
private void writeFsOrRef(int addr, int featCode) throws IOException {
- if (addr == 0 || null == cds.multiRefFSs || cds.multiRefFSs.contains(addr)) {
+ if (addr == 0 || !cds.isDynamicMultiRef || cds.multiRefFSs.contains(addr)) {
jg.writeFieldName(getShortFeatureName(featCode));
jg.writeNumber(cds.getXmiIdAsInt(addr));
} else {
@@ -1369,13 +1369,13 @@ public class JsonCasSerializer {
}
private boolean isDynamicOrStaticMultiRef(int featCode, int addr) {
- return (cds.multiRefFSs == null) ?
+ return (!cds.isDynamicMultiRef) ?
cds.isStaticMultiRef(featCode) :
cds.multiRefFSs.contains(addr);
}
private boolean isDynamicOrStaticMultiRef(int featCode, int addr, boolean isListAsFSs) {
- return (cds.multiRefFSs == null) ?
+ return (!cds.isDynamicMultiRef) ?
(isListAsFSs || cds.isStaticMultiRef(featCode)) :
cds.multiRefFSs.contains(addr);
}
Modified: uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a1-not-a.txt
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a1-not-a.txt?rev=1805673&r1=1805672&r2=1805673&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a1-not-a.txt (original)
+++ uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a1-not-a.txt Mon Aug 21 20:01:12 2017
@@ -2,9 +2,9 @@
"_views" : {
"_InitialView" : {
"RefTypes" : [
- {"sofa" : 8, "aArrayFS" : [15, 22, 29 ] }, 15 ] } },
+ {"sofa" : 8, "aArrayFS" : [15,
+ {"_type" : "RefTypes", "sofa" : 8 },
+ {"_type" : "RefTypes", "sofa" : 8 } ] }, 15 ] } },
"_referenced_fss" : {
"8" : {"_type" : "Sofa", "sofaNum" : 1, "sofaID" : "_InitialView" },
- "15" : {"_type" : "RefTypes", "sofa" : 8 },
- "22" : {"_type" : "RefTypes", "sofa" : 8 },
- "29" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
+ "15" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
Modified: uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a2-not-a.txt
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a2-not-a.txt?rev=1805673&r1=1805672&r2=1805673&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a2-not-a.txt (original)
+++ uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a2-not-a.txt Mon Aug 21 20:01:12 2017
@@ -2,9 +2,9 @@
"_views" : {
"_InitialView" : {
"RefTypes" : [
- {"sofa" : 8, "aArrayFS" : [15, 22, 29 ] }, 22 ] } },
+ {"sofa" : 8, "aArrayFS" : [
+ {"_type" : "RefTypes", "sofa" : 8 }, 22,
+ {"_type" : "RefTypes", "sofa" : 8 } ] }, 22 ] } },
"_referenced_fss" : {
"8" : {"_type" : "Sofa", "sofaNum" : 1, "sofaID" : "_InitialView" },
- "15" : {"_type" : "RefTypes", "sofa" : 8 },
- "22" : {"_type" : "RefTypes", "sofa" : 8 },
- "29" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
+ "22" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
Modified: uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a3-not-a.txt
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a3-not-a.txt?rev=1805673&r1=1805672&r2=1805673&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a3-not-a.txt (original)
+++ uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-a3-not-a.txt Mon Aug 21 20:01:12 2017
@@ -2,9 +2,9 @@
"_views" : {
"_InitialView" : {
"RefTypes" : [
- {"sofa" : 8, "aArrayFS" : [15, 22, 29 ] }, 29 ] } },
+ {"sofa" : 8, "aArrayFS" : [
+ {"_type" : "RefTypes", "sofa" : 8 },
+ {"_type" : "RefTypes", "sofa" : 8 }, 29 ] }, 29 ] } },
"_referenced_fss" : {
"8" : {"_type" : "Sofa", "sofaNum" : 1, "sofaID" : "_InitialView" },
- "15" : {"_type" : "RefTypes", "sofa" : 8 },
- "22" : {"_type" : "RefTypes", "sofa" : 8 },
"29" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
Modified: uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-all-embeddable-a.txt
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-all-embeddable-a.txt?rev=1805673&r1=1805672&r2=1805673&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-all-embeddable-a.txt (original)
+++ uima/uimaj/trunk/uimaj-json/src/test/resources/CasSerialization/expected/json/array-all-embeddable-a.txt Mon Aug 21 20:01:12 2017
@@ -2,9 +2,9 @@
"_views" : {
"_InitialView" : {
"RefTypes" : [
- {"sofa" : 8, "aArrayFS" : [15, 22, 29 ] } ] } },
+ {"sofa" : 8, "aArrayFS" : [
+ {"_type" : "RefTypes", "sofa" : 8 },
+ {"_type" : "RefTypes", "sofa" : 8 },
+ {"_type" : "RefTypes", "sofa" : 8 } ] } ] } },
"_referenced_fss" : {
- "8" : {"_type" : "Sofa", "sofaNum" : 1, "sofaID" : "_InitialView" },
- "15" : {"_type" : "RefTypes", "sofa" : 8 },
- "22" : {"_type" : "RefTypes", "sofa" : 8 },
- "29" : {"_type" : "RefTypes", "sofa" : 8 } } }
\ No newline at end of file
+ "8" : {"_type" : "Sofa", "sofaNum" : 1, "sofaID" : "_InitialView" } } }
\ No newline at end of file