All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.ugent.rml.extractor.ConstantExtractor Maven / Gradle / Ivy

Go to download

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources.

There is a newer version: 7.2.0
Show newest version
package be.ugent.rml.extractor;

import be.ugent.rml.functions.SingleRecordFunctionExecutor;
import be.ugent.rml.records.Record;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ConstantExtractor implements Extractor, SingleRecordFunctionExecutor {

    private String constant;

    public ConstantExtractor(String constant) {
        this.constant = constant;
    }

    @Override
    public List extract(Record record) {
        ArrayList result = new ArrayList<>();
        result.add(constant);

        return result;
    }

    @Override
    public Object execute(Record record) throws IOException {
        return extract(record);
    }

    /**
     * to String method
     *
     * @return string
     */
    @Override
    public String toString() {
        return "\"" + constant + '\"';
    }
}