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

it.unibz.inf.ontop.model.term.functionsymbol.impl.SubStr3SPARQLFunctionSymbolImpl Maven / Gradle / Ivy

package it.unibz.inf.ontop.model.term.functionsymbol.impl;

import com.google.common.collect.ImmutableList;
import it.unibz.inf.ontop.model.term.ImmutableTerm;
import it.unibz.inf.ontop.model.term.TermFactory;
import it.unibz.inf.ontop.model.type.RDFDatatype;
import it.unibz.inf.ontop.model.vocabulary.XPathFunction;


public class SubStr3SPARQLFunctionSymbolImpl extends AbstractSubStrSPARQLFunctionSymbol {

    protected SubStr3SPARQLFunctionSymbolImpl(RDFDatatype xsdStringDatatype, RDFDatatype xsdIntegerDatatype) {
        super("SP_SUBSTR3", XPathFunction.SUBSTRING, xsdStringDatatype,
                ImmutableList.of(xsdStringDatatype, xsdIntegerDatatype, xsdIntegerDatatype));
    }

    @Override
    protected ImmutableTerm computeLexicalTerm(ImmutableList subLexicalTerms, ImmutableList typeTerms, TermFactory termFactory, ImmutableTerm returnedTypeTerm) {
        RDFDatatype xsdInteger = termFactory.getTypeFactory().getXsdIntegerDatatype();
        return termFactory.getDBSubString3(subLexicalTerms.get(0),
                termFactory.getConversionFromRDFLexical2DB(subLexicalTerms.get(1), xsdInteger),
                termFactory.getConversionFromRDFLexical2DB(subLexicalTerms.get(2), xsdInteger));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy