|
31 | 31 | import java.util.HashMap;
|
32 | 32 | import java.util.List;
|
33 | 33 | import java.util.Map;
|
34 |
| -import java.util.Optional; |
35 | 34 | import java.util.Random;
|
36 | 35 | import java.util.concurrent.atomic.LongAdder;
|
37 | 36 | import java.util.function.Consumer;
|
@@ -97,24 +96,17 @@ public void apply(final Metafix metafix, final Record record, final List<String>
|
97 | 96 | put_rdfmap {
|
98 | 97 | @Override
|
99 | 98 | public void apply(final Metafix metafix, final Record record, final List<String> params, final Map<String, String> options) {
|
100 |
| - final String rdfMapName = params.size() == 1 ? params.get(0) + options.get(RdfMap.TARGET) + options.getOrDefault(RdfMap.TARGET_LANGUAGE, "") : params.get(1); |
101 |
| - final String replaceTargets = options.get(RdfMap.TARGET) + options.getOrDefault(RdfMap.TARGET_LANGUAGE, ""); |
102 |
| - final String resourceName = Optional.ofNullable(params.get(0)) |
103 |
| - .map(str -> str.replaceAll(replaceTargets + "$", "")) |
104 |
| - .orElse(params.get(0)); |
| 99 | + final String fileName = params.get(0); |
105 | 100 | final RdfMap rdfMap = new RdfMap();
|
106 |
| - if (resourceName.startsWith("http")) { |
107 |
| - rdfMap.setResource(resourceName); |
108 |
| - } |
109 |
| - else { |
110 |
| - rdfMap.setResource(metafix.resolvePath(resourceName)); |
111 |
| - } |
| 101 | + |
| 102 | + rdfMap.setResource(fileName.startsWith("http") ? fileName : metafix.resolvePath(fileName)); |
| 103 | + |
112 | 104 | withOption(options, RdfMap.TARGET, rdfMap::setTarget);
|
113 | 105 | withOption(options, RdfMap.TARGET_LANGUAGE, rdfMap::setTargetLanguage);
|
114 | 106 | withOption(options, RdfMap.SELECT, rdfMap::setSelect);
|
115 | 107 | withOption(options, Maps.DEFAULT_MAP_KEY, rdfMap::setDefault);
|
116 | 108 |
|
117 |
| - metafix.putMap(rdfMapName, rdfMap); |
| 109 | + metafix.putMap(params.size() > 1 ? params.get(1) : fileName, rdfMap); |
118 | 110 | }
|
119 | 111 | },
|
120 | 112 | put_var {
|
|
0 commit comments