Package org.apache.stanbol.rules.base.api

Examples of org.apache.stanbol.rules.base.api.SPARQLObject


        org.apache.stanbol.rules.manager.atoms.DifferentAtom tmp = (org.apache.stanbol.rules.manager.atoms.DifferentAtom) ruleAtom;
        ExpressionAtom expressionAtom1 = tmp.getStringFunctionAtom1();
        ExpressionAtom expressionAtom2 = tmp.getStringFunctionAtom2();

        SPARQLObject sparqlArgument1 = adapter.adaptTo(expressionAtom1, SPARQLObject.class);
        SPARQLObject sparqlArgument2 = adapter.adaptTo(expressionAtom2, SPARQLObject.class);

        String argument1 = sparqlArgument1.getObject();
        String argument2 = sparqlArgument2.getObject();

        argument1 = argument1.toString().replace(Symbols.variablesPrefix, "");
        argument2 = argument2.toString().replace(Symbols.variablesPrefix, "");

        StringBuilder sb = new StringBuilder();
View Full Code Here


        StringFunctionAtom argument = ((org.apache.stanbol.rules.manager.atoms.UpperCaseAtom) ruleAtom)
                .getStringFunctionAtom();

        try {
            SPARQLObject sparqlArgument = adapter.adaptTo(argument, SPARQLObject.class);

            String sparql = "<http://www.w3.org/2005/xpath-functions#upper-case> ("
                            + sparqlArgument.getObject() + ")";

            return (T) new SPARQLFunction(sparql);

        } catch (UnsupportedTypeForExportException e) {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.EndsWithAtom tmp = (org.apache.stanbol.rules.manager.atoms.EndsWithAtom) ruleAtom;

        StringFunctionAtom argument = tmp.getArgument();
        StringFunctionAtom term = tmp.getTerm();

        SPARQLObject sparqlArgument = adapter.adaptTo(argument, SPARQLObject.class);
        SPARQLObject sparqlTerm = adapter.adaptTo(term, SPARQLObject.class);

        String argumentSparql = sparqlArgument.getObject();
        String termSparql = sparqlTerm.getObject();

        return (T) new SPARQLComparison("<http://www.w3.org/2005/xpath-functions#ends-with> ("
                                        + argumentSparql + ", " + termSparql + ")");
    }
View Full Code Here

        NumericFunctionAtom argument1 = tmp.getNumericFunctionAtom1();
        NumericFunctionAtom argument2 = tmp.getNumericFunctionAtom2();

        try {

            SPARQLObject sparqlArgument1 = adapter.adaptTo(argument1, SPARQLObject.class);
            SPARQLObject sparqlArgument2 = adapter.adaptTo(argument2, SPARQLObject.class);

            String sparqlFunction1 = sparqlArgument1.getObject();
            String sparqlFunction2 = sparqlArgument2.getObject();

            StringBuilder sb = new StringBuilder();
            sb.append("(");
            sb.append(sparqlFunction1);
            sb.append(" + ");
View Full Code Here

                                         UnsupportedTypeForExportException {
        org.apache.stanbol.rules.manager.atoms.LengthAtom tmp = (org.apache.stanbol.rules.manager.atoms.LengthAtom) ruleAtom;

        StringFunctionAtom argument = tmp.getStringFunctionAtom();

        SPARQLObject sparqlArgument = adapter.adaptTo(argument, SPARQLObject.class);

        String arg = sparqlArgument.getObject();

        String sparql = "<http://www.w3.org/2005/xpath-functions#string-length> (" + arg + ")";

        return (T) new SPARQLFunction(sparql);
    }
View Full Code Here

                                         UnsupportedTypeForExportException {

        IObjectAtom argument = ((org.apache.stanbol.rules.manager.atoms.LocalNameAtom) ruleAtom)
                .getUriResource();

        SPARQLObject sparqlObject = adapter.adaptTo(argument, SPARQLObject.class);

        String sparql = "<http://jena.hpl.hp.com/ARQ/function#localname>(" + sparqlObject.getObject() + ")";
        return (T) new SPARQLFunction(sparql);
    }
View Full Code Here

                                         UnsupportedTypeForExportException {

        StringFunctionAtom argument = ((org.apache.stanbol.rules.manager.atoms.LowerCaseAtom) ruleAtom)
                .getStringFunctionAtom();

        SPARQLObject sparqlArgument = adapter.adaptTo(argument, SPARQLObject.class);

        String sparql = "<http://www.w3.org/2005/xpath-functions#lower-case> (" + sparqlArgument.getObject()
                        + ")";

        return (T) new SPARQLFunction(sparql);

    }
View Full Code Here

                                         UnsupportedTypeForExportException {

        org.apache.stanbol.rules.manager.atoms.IsBlankAtom tmp = (org.apache.stanbol.rules.manager.atoms.IsBlankAtom) ruleAtom;
        IObjectAtom argument = tmp.getUriResource();

        SPARQLObject sparqlObject = adapter.adaptTo(argument, SPARQLObject.class);

        String sparql = "isBlank(" + sparqlObject.getObject() + ")";

        return (T) new SPARQLComparison(sparql);
    }
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.GreaterThanAtom tmp = (org.apache.stanbol.rules.manager.atoms.GreaterThanAtom) ruleAtom;

        ExpressionAtom argument1 = tmp.getArgument1();
        ExpressionAtom argument2 = tmp.getArgument2();

        SPARQLObject sparqlArgument1 = adapter.adaptTo(argument1, SPARQLObject.class);
        SPARQLObject sparqlArgument2 = adapter.adaptTo(argument2, SPARQLObject.class);

        String arg1 = sparqlArgument1.getObject();
        String arg2 = sparqlArgument2.getObject();

        StringBuilder sb = new StringBuilder();
        sb.append("(");
        sb.append(arg1);
        sb.append(" > ");
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.LetAtom tmp = (org.apache.stanbol.rules.manager.atoms.LetAtom) ruleAtom;
        String variableArgument = tmp.getVariable().toString().replace(Symbols.variablesPrefix, "");

        StringFunctionAtom argument = tmp.getParameterFunctionAtom();

        SPARQLObject sparqlArgument = adapter.adaptTo(argument, SPARQLObject.class);

        String arg = sparqlArgument.getObject();

        String let = "LET (?" + variableArgument + " := " + arg + ")";
        SPARQLObject sparqlObject = new SPARQLFunction(let);
        return (T) sparqlObject;

    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.SPARQLObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.