|
21 | 21 | import org.metafacture.metafix.Metafix;
|
22 | 22 | import org.metafacture.metafix.Record;
|
23 | 23 | import org.metafacture.metafix.Value;
|
24 |
| -import org.metafacture.metafix.maps.RdfMap; |
25 |
| -import org.metafacture.metamorph.api.Maps; |
26 | 24 |
|
27 |
| -import java.io.File; |
28 |
| -import java.util.Arrays; |
29 | 25 | import java.util.HashSet;
|
30 | 26 | import java.util.List;
|
31 | 27 | import java.util.Map;
|
@@ -111,32 +107,4 @@ default Stream<Value> flatten(final Stream<Value> stream) {
|
111 | 107 | ));
|
112 | 108 | }
|
113 | 109 |
|
114 |
| - default void lookup(final Metafix metafix, final Record record, final List<String> params, final Map<String, String> options, final FixFunction mapFunction) { |
115 |
| - final Map<String, String> map = getMap(metafix, record, params, options, mapFunction); |
116 |
| - record.transform(params.get(0), oldValue -> { |
117 |
| - final String newValue = map.getOrDefault(oldValue, map.get(Maps.DEFAULT_MAP_KEY)); |
118 |
| - return newValue != null ? newValue : getBoolean(options, "delete") ? null : oldValue; |
119 |
| - }); |
120 |
| - } |
121 |
| - |
122 |
| - static Map<String, String> getMap(final Metafix metafix, final Record record, final List<String> params, final Map<String, String> options, final FixFunction mapFunction) { |
123 |
| - final Map<String, String> map; |
124 |
| - if (params.size() <= 1) { |
125 |
| - map = options; |
126 |
| - } |
127 |
| - else { |
128 |
| - final String mapName = mapFunction.toString().equals("put_rdfmap") ? (params.size() > 1 ? params.get(1) : params.get(0)) + options.get(RdfMap.TARGET) + options.getOrDefault(RdfMap.TARGET_LANGUAGE, "") : params.get(1); |
129 |
| - if (!metafix.getMapNames().contains(mapName)) { |
130 |
| - if (mapName.contains(".") || mapName.contains(File.separator)) { |
131 |
| - mapFunction.apply(metafix, record, Arrays.asList(mapName), options); |
132 |
| - } |
133 |
| - else { |
134 |
| - // Probably an unknown internal map? Log a warning? |
135 |
| - } |
136 |
| - } |
137 |
| - map = metafix.getMap(mapName); |
138 |
| - } |
139 |
| - return map; |
140 |
| - } |
141 |
| - |
142 | 110 | }
|
0 commit comments