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

at.newmedialab.ldpath.model.transformers.ShortTransformer Maven / Gradle / Ivy

Go to download

Core Implementation of LD Path a simple path-based query language similar to XPath or SPARQL Property Paths that is particularly well-suited for querying and retrieving resources from the Linked Data Cloud by following RDF links between resources and servers.

There is a newer version: 0.9.7
Show newest version
package at.newmedialab.ldpath.model.transformers;

import at.newmedialab.ldpath.api.backend.RDFBackend;
import at.newmedialab.ldpath.api.transformers.NodeTransformer;

public class ShortTransformer implements NodeTransformer {

    @Override
    public Short transform(RDFBackend backend, Node node) throws IllegalArgumentException {
        if(backend.isLiteral(node)) {
            return backend.decimalValue(node).shortValueExact();
        } else {
            throw new IllegalArgumentException("cannot transform node of type "+
                node.getClass().getCanonicalName()+" to short");
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy