be.ugent.rml.termgenerator.BlankNodeGenerator 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.termgenerator;
import be.ugent.idlab.knows.dataio.record.Record;
import be.ugent.rml.Executor;
import be.ugent.rml.functions.FunctionUtils;
import be.ugent.rml.functions.SingleRecordFunctionExecutor;
import be.ugent.rml.term.BlankNode;
import be.ugent.rml.term.Term;
import java.util.ArrayList;
import java.util.List;
public class BlankNodeGenerator extends TermGenerator {
public BlankNodeGenerator() {
this(null);
}
public BlankNodeGenerator(SingleRecordFunctionExecutor functionExecutor) {
super(functionExecutor);
}
@Override
public List generate(Record record) throws Exception {
ArrayList nodes = new ArrayList<>();
if (this.functionExecutor != null) {
List objectStrings = FunctionUtils.functionObjectToList(functionExecutor.execute(record));
objectStrings.forEach(object -> {
nodes.add(new BlankNode(object));
});
} else {
nodes.add(new BlankNode("" + Executor.getNewBlankNodeID()));
}
return nodes;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy