diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/expected.json index 2faa8ce2..371da87f 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/expected.json @@ -1,5 +1,5 @@ { - "test" : [ "dog", "parrot", "human" ], + "test" : [ "dog", "parrot" ], "animals" : [ { "animal" : "dog", "classification" : { @@ -10,10 +10,5 @@ "classification" : { "type" : "bird" } - }, { - "animal" : "human", - "classification" : { - "type" : "human" - } } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/input.json index e6d1520c..8376431b 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/input.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex/input.json @@ -1,3 +1,3 @@ { - "test" : [ "dog", "parrot", "human" ] + "test" : [ "dog", "parrot" ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/expected.json new file mode 100644 index 00000000..2faa8ce2 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/expected.json @@ -0,0 +1,19 @@ +{ + "test" : [ "dog", "parrot", "human" ], + "animals" : [ { + "animal" : "dog", + "classification" : { + "type" : "mammal" + } + }, { + "animal" : "parrot", + "classification" : { + "type" : "bird" + } + }, { + "animal" : "human", + "classification" : { + "type" : "human" + } + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/input.json new file mode 100644 index 00000000..e6d1520c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/input.json @@ -0,0 +1,3 @@ +{ + "test" : [ "dog", "parrot", "human" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/mapfile.tsv b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/mapfile.tsv new file mode 100644 index 00000000..e7f9756a --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/mapfile.tsv @@ -0,0 +1,6 @@ +dog mammal +cat mammal +parrot bird +shark fish +dragon fictional animal +unicorn fictional animal diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.fix new file mode 100644 index 00000000..78e2854c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.fix @@ -0,0 +1,9 @@ +set_array("animals[]") +do list(path: "test[]", "var": "$f") + copy_field("$f", "animals[].$append.animal") + copy_field("$f", "animals[].$last.classification.type") +end + +do list(path: "animals[]") + lookup("classification.type", "./mapfile.tsv", "sep_char":"\t") +end diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/todo.txt new file mode 100644 index 00000000..f5546343 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjectsWithListBind_complex_withNotMatchingValue/todo.txt @@ -0,0 +1 @@ +See issue #149 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/expected.json index 2faa8ce2..371da87f 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/expected.json @@ -1,5 +1,5 @@ { - "test" : [ "dog", "parrot", "human" ], + "test" : [ "dog", "parrot" ], "animals" : [ { "animal" : "dog", "classification" : { @@ -10,10 +10,5 @@ "classification" : { "type" : "bird" } - }, { - "animal" : "human", - "classification" : { - "type" : "human" - } } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/input.json index e6d1520c..8376431b 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/input.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex/input.json @@ -1,3 +1,3 @@ { - "test" : [ "dog", "parrot", "human" ] + "test" : [ "dog", "parrot" ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/expected.json index 6368c788..8429b502 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/expected.json @@ -5,8 +5,6 @@ "animal" : "mammal" }, { "animal" : "bird" - }, { - "animal" : "human" } ] } }, "animals" : [ { "animal" : "dog", @@ -18,10 +16,5 @@ "classification" : { "type" : "bird" } - }, { - "animal" : "human", - "classification" : { - "type" : "human" - } } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/input.json index 7b5bdc21..096f3554 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/input.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2/input.json @@ -2,8 +2,7 @@ "real" : { "test" : [ { "animal" : "Jake" }, - { "animal" :"Blacky"}, - { "animal" : "Jens"} ] + { "animal" :"Blacky"} ] } } } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/expected.json new file mode 100644 index 00000000..6368c788 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/expected.json @@ -0,0 +1,27 @@ +{ + "metadata" : { + "real" : { + "test" : [ { + "animal" : "mammal" + }, { + "animal" : "bird" + }, { + "animal" : "human" + } ] } }, + "animals" : [ { + "animal" : "dog", + "classification" : { + "type" : "mammal" + } + }, { + "animal" : "parrot", + "classification" : { + "type" : "bird" + } + }, { + "animal" : "human", + "classification" : { + "type" : "human" + } + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/input.json new file mode 100644 index 00000000..7b5bdc21 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/input.json @@ -0,0 +1,9 @@ +{ "metadata" : { + "real" : + { + "test" : [ { "animal" : "Jake" }, + { "animal" :"Blacky"}, + { "animal" : "Jens"} ] + } +} +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile.tsv b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile.tsv new file mode 100644 index 00000000..e7f9756a --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile.tsv @@ -0,0 +1,6 @@ +dog mammal +cat mammal +parrot bird +shark fish +dragon fictional animal +unicorn fictional animal diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile_2.tsv b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile_2.tsv new file mode 100644 index 00000000..51b8493a --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/mapfile_2.tsv @@ -0,0 +1,2 @@ +Jake dog +Blacky parrot diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.fix new file mode 100644 index 00000000..7949cb28 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.fix @@ -0,0 +1,8 @@ +set_array("animals[]") +do list(path: "metadata.real.test[]", "var": "$f") + lookup("$f.animal", "./mapfile_2.tsv", "sep_char":"\t") + copy_field("$f.animal", "animals[].$append.animal") + copy_field("$f.animal", "animals[].$last.classification.type") +end + +lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/todo.txt new file mode 100644 index 00000000..f5546343 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_2_withNotMatchingValue/todo.txt @@ -0,0 +1 @@ +See issue #149 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/expected.json new file mode 100644 index 00000000..2faa8ce2 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/expected.json @@ -0,0 +1,19 @@ +{ + "test" : [ "dog", "parrot", "human" ], + "animals" : [ { + "animal" : "dog", + "classification" : { + "type" : "mammal" + } + }, { + "animal" : "parrot", + "classification" : { + "type" : "bird" + } + }, { + "animal" : "human", + "classification" : { + "type" : "human" + } + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/input.json new file mode 100644 index 00000000..e6d1520c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/input.json @@ -0,0 +1,3 @@ +{ + "test" : [ "dog", "parrot", "human" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/mapfile.tsv b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/mapfile.tsv new file mode 100644 index 00000000..e7f9756a --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/mapfile.tsv @@ -0,0 +1,6 @@ +dog mammal +cat mammal +parrot bird +shark fish +dragon fictional animal +unicorn fictional animal diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.fix new file mode 100644 index 00000000..2e2ccfab --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.fix @@ -0,0 +1,7 @@ +set_array("animals[]") +do list(path: "test[]", "var": "$f") + copy_field("$f", "animals[].$append.animal") + copy_field("$f", "animals[].$last.classification.type") +end + +lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/todo.txt new file mode 100644 index 00000000..f5546343 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromJson/toJson/lookupInSubfieldInArrayOfObjects_complex_withNotMatchingValue/todo.txt @@ -0,0 +1 @@ +See issue #149