Examples of ClerezzaSparqlObject


Examples of org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject

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

        StringFunctionAtom argument = tmp.getStringFunctionAtom();

        ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument,
            ConstructQuery.class);

        List<Expression> argumentExpressions = new ArrayList<Expression>();
        argumentExpressions.add((Expression) argument1.getClerezzaObject());

        BuiltInCall builtInCall = new BuiltInCall("BOUND", argumentExpressions);

        UnaryOperation unaryOperation = new UnaryOperation("!", builtInCall);

        return (T) new ClerezzaSparqlObject(unaryOperation);

    }
View Full Code Here

Examples of org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject

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

        NumericFunctionAtom numericFunctionAtom1 = tmp.getNumericFunctionAtom1();
        NumericFunctionAtom numericFunctionAtom2 = tmp.getNumericFunctionAtom2();

        ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom1,
            ConstructQuery.class);
        ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom2,
            ConstructQuery.class);

        Expression lhsOperand = (Expression) argument1.getClerezzaObject();
        Expression rhsOperand = (Expression) argument2.getClerezzaObject();

        BinaryOperation binaryOperation = new BinaryOperation("*", lhsOperand, rhsOperand);

        return (T) new ClerezzaSparqlObject(binaryOperation);

    }
View Full Code Here

Examples of org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject

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

        IObjectAtom argument1 = tmp.getArgument1();
        IObjectAtom classResource = tmp.getClassResource();

        ClerezzaSparqlObject argumentCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject classCSO = (ClerezzaSparqlObject) adapter.adaptTo(classResource,
            ConstructQuery.class);

        UriRefOrVariable subject;
        UriRefOrVariable predicate = new UriRefOrVariable(RDF.type);
        ResourceOrVariable object;

        Object arg = argumentCSO.getClerezzaObject();
        Object cl = classCSO.getClerezzaObject();

        if (arg instanceof Variable) {
            subject = new UriRefOrVariable((Variable) arg);
        } else if (arg instanceof UriRef) {
            subject = new UriRefOrVariable((UriRef) arg);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (cl instanceof Variable) {
            object = new ResourceOrVariable((Variable) cl);
        } else if (cl instanceof UriRef) {
            object = new ResourceOrVariable((UriRef) cl);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        return (T) new ClerezzaSparqlObject(new SimpleTriplePattern(subject, predicate, object));

    }
View Full Code Here

Examples of org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject

        StringFunctionAtom argument = tmp.getStringFunctionAtom();
        NumericFunctionAtom start = tmp.getStart();
        NumericFunctionAtom length = tmp.getLength();

        ClerezzaSparqlObject clerezzaArgument = (ClerezzaSparqlObject) adapter.adaptTo(argument,
            ConstructQuery.class);
        ClerezzaSparqlObject clerezzaStart = (ClerezzaSparqlObject) adapter.adaptTo(start,
            ConstructQuery.class);
        ClerezzaSparqlObject clerezzaLength = (ClerezzaSparqlObject) adapter.adaptTo(length,
            ConstructQuery.class);

        List<Expression> argumentExpressions = new ArrayList<Expression>();
        argumentExpressions.add((Expression) clerezzaArgument.getClerezzaObject());
        argumentExpressions.add((Expression) clerezzaStart.getClerezzaObject());
        argumentExpressions.add((Expression) clerezzaLength.getClerezzaObject());

        FunctionCall functionCall = new FunctionCall(new UriRef(
                "<http://www.w3.org/2005/xpath-functions#substring>"), argumentExpressions);

        return (T) new ClerezzaSparqlObject(functionCall);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.