Skip to content

Commit fe63bad

Browse files
committed
Fix order of expected output fields, keep original transformation. (#241)
1 parent 2834fb8 commit fe63bad

File tree

2 files changed

+38
-37
lines changed
  • metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromXml/toJson/lookupInDeeplyNestedArrayOfObjects

2 files changed

+38
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
{
22
"subject" : [ {
3+
"type" : [ "ComplexSubject" ],
34
"componentList" : [ {
4-
"gndIdentifier" : "(DE-588)4131620-4",
5-
"id" : "(DE-588)4131620-4",
5+
"type" : [ "SubjectHeading" ],
66
"label" : "Schulhof",
77
"source" : {
8-
"id" : "https://d-nb.info/gnd/7749153-1",
9-
"label" : "Gemeinsame Normdatei (GND)"
8+
"label" : "Gemeinsame Normdatei (GND)",
9+
"id" : "https://d-nb.info/gnd/7749153-1"
1010
},
11-
"type" : [ "SubjectHeading" ]
11+
"id" : "(DE-588)4131620-4",
12+
"gndIdentifier" : "(DE-588)4131620-4"
1213
}, {
13-
"gndIdentifier" : "(DE-588)4116546-9",
14-
"id" : "(DE-588)4116546-9",
14+
"type" : [ "SubjectHeading" ],
1515
"label" : "Sozialraum",
1616
"source" : {
17-
"id" : "https://d-nb.info/gnd/7749153-1",
18-
"label" : "Gemeinsame Normdatei (GND)"
17+
"label" : "Gemeinsame Normdatei (GND)",
18+
"id" : "https://d-nb.info/gnd/7749153-1"
1919
},
20-
"type" : [ "SubjectHeading" ]
20+
"id" : "(DE-588)4116546-9",
21+
"gndIdentifier" : "(DE-588)4116546-9"
2122
}, {
22-
"gndIdentifier" : "(DE-588)4680202-2",
23-
"id" : "(DE-588)4680202-2",
23+
"type" : [ "SubjectHeading" ],
2424
"label" : "Informelles Lernen",
2525
"source" : {
26-
"id" : "https://d-nb.info/gnd/7749153-1",
27-
"label" : "Gemeinsame Normdatei (GND)"
26+
"label" : "Gemeinsame Normdatei (GND)",
27+
"id" : "https://d-nb.info/gnd/7749153-1"
2828
},
29-
"type" : [ "SubjectHeading" ]
29+
"id" : "(DE-588)4680202-2",
30+
"gndIdentifier" : "(DE-588)4680202-2"
3031
}, {
31-
"gndIdentifier" : "(DE-588)4155947-2",
32-
"id" : "(DE-588)4155947-2",
32+
"type" : [ "SubjectHeading" ],
3333
"label" : "Ganztagsschule",
3434
"source" : {
35-
"id" : "https://d-nb.info/gnd/7749153-1",
36-
"label" : "Gemeinsame Normdatei (GND)"
35+
"label" : "Gemeinsame Normdatei (GND)",
36+
"id" : "https://d-nb.info/gnd/7749153-1"
3737
},
38-
"type" : [ "SubjectHeading" ]
38+
"id" : "(DE-588)4155947-2",
39+
"gndIdentifier" : "(DE-588)4155947-2"
3940
}, {
40-
"gndIdentifier" : "(DE-588)4130615-6",
41-
"id" : "(DE-588)4130615-6",
41+
"type" : [ "SubjectHeading" ],
4242
"label" : "Sportpädagogik",
4343
"source" : {
44-
"id" : "https://d-nb.info/gnd/7749153-1",
45-
"label" : "Gemeinsame Normdatei (GND)"
44+
"label" : "Gemeinsame Normdatei (GND)",
45+
"id" : "https://d-nb.info/gnd/7749153-1"
4646
},
47-
"type" : [ "SubjectHeading" ]
48-
} ],
49-
"type" : [ "ComplexSubject" ]
47+
"id" : "(DE-588)4130615-6",
48+
"gndIdentifier" : "(DE-588)4130615-6"
49+
} ]
5050
} ]
5151
}

metafix/src/test/resources/org/metafacture/metafix/integration/lookup/fromXml/toJson/lookupInDeeplyNestedArrayOfObjects/test.fix

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ put_map("rswk-indicator", s: "SubjectHeading")
33
set_array("subject[]")
44

55
if exists("6890?")
6-
set_array("subject[].$append.componentList[]")
6+
set_array("subject[].$append.type[]", "ComplexSubject")
7+
set_array("subject[].$last.label")
8+
set_array("subject[].$last.componentList[]")
79
do list(path: "6890?", "var": "$i")
10+
set_array("subject[].$last.componentList[].$append.type[]")
11+
do list(path: "$i.D", "var": "$k")
12+
copy_field("$k", "subject[].$last.componentList[].$last.type[].$append")
13+
end
14+
copy_field("$i.a", "subject[].$last.componentList[].$last.label")
815
do list(path: "$i.0", "var": "$j")
916
if any_match("$j", "^\\(DE-588\\)(.*)$")
10-
copy_field("$j", "subject[].$last.componentList[].$append.gndIdentifier")
11-
copy_field("$j", "subject[].$last.componentList[].$last.id")
12-
copy_field("$i.a", "subject[].$last.componentList[].$last.label")
13-
add_field("subject[].$last.componentList[].$last.source.id", "https://d-nb.info/gnd/7749153-1")
1417
add_field("subject[].$last.componentList[].$last.source.label", "Gemeinsame Normdatei (GND)")
18+
add_field("subject[].$last.componentList[].$last.source.id", "https://d-nb.info/gnd/7749153-1")
19+
copy_field("$j", "subject[].$last.componentList[].$last.id")
1520
replace_all("subject[].$last.componentList[].$last..id", "^\\(DE-588\\)(.*)$", "http://d-nb.info/gnd/$1")
21+
copy_field("$j", "subject[].$last.componentList[].$last.gndIdentifier")
1622
replace_all("subject[].$last.componentList[].$last..gndIdentifier", "^\\(DE-588\\)(.*)$", "$1")
1723
end
1824
end
19-
set_array("subject[].$last.componentList[].$last.type[]")
20-
do list(path: "$i.D", "var": "$k")
21-
copy_field("$k", "subject[].$last.componentList[].$last.type[].$append")
22-
end
23-
set_array("subject[].$last.type[]", "ComplexSubject")
2425
end
2526
end
2627

0 commit comments

Comments
 (0)