be.ugent.rml.functions.StaticMultipleRecordsFunctionExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rmlmapper Show documentation
Show all versions of rmlmapper Show documentation
The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources.
The newest version!
package be.ugent.rml.functions;
import be.ugent.idlab.knows.dataio.record.Record;
import be.ugent.idlab.knows.functions.agent.Agent;
import be.ugent.idlab.knows.functions.agent.Arguments;
import java.util.Map;
public class StaticMultipleRecordsFunctionExecutor implements MultipleRecordsFunctionExecutor {
private final Map parameters;
private final Agent functionAgent;
private final String functionId;
public StaticMultipleRecordsFunctionExecutor(final Map parameters, Agent functionAgent, String functionId) {
this.parameters = parameters;
this.functionAgent = functionAgent;
this.functionId = functionId;
}
@Override
public Object execute(Map records) throws Exception {
final Arguments functionArguments = new Arguments();
for (Map.Entry entry : this.parameters.entrySet()) {
SingleRecordFunctionExecutor executor = (SingleRecordFunctionExecutor) entry.getValue()[1];
String recordType = (String) entry.getValue()[0];
Object o = executor.execute(records.get(recordType));
// TODO check whether key is actually optional!
functionArguments.add(entry.getKey(), o);
}
return functionAgent.execute(functionId, functionArguments);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy