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

org.aksw.jenax.arq.aggregation.FunctionNodeToObject Maven / Gradle / Ivy

The newest version!
package org.aksw.jenax.arq.aggregation;

import java.util.function.Function;

import org.apache.jena.graph.Node;

public class FunctionNodeToObject
    implements Function
{
    @Override
    public Object apply(Node node) {
        Object result;

        if(node == null) {
            result = null;
        }
        else if(node.isURI()) {
            result = node.getURI();
        }
        else if(node.isLiteral()) {
            result = node.getLiteralValue();
        }
        else if(node.isBlank()){
            result = node.getBlankNodeLabel();
        }
        else {
            throw new RuntimeException("Unhandled case");
        }

        return result;
    }

    public static final FunctionNodeToObject fn = new FunctionNodeToObject();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy