Examples of ClerezzaSparqlObject


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

        org.apache.stanbol.rules.manager.atoms.SubtractionAtom tmp = (org.apache.stanbol.rules.manager.atoms.SubtractionAtom) 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

        IObjectAtom argument1 = tmp.getArgument1();
        IObjectAtom datatypeProperty = tmp.getDatatypeProperty();
        RuleAtom argument2 = tmp.getArgument2();

        ClerezzaSparqlObject argument1CSO = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject datatypePropertyCSO = (ClerezzaSparqlObject) adapter.adaptTo(datatypeProperty,
            ConstructQuery.class);
        ClerezzaSparqlObject argument2CSO = (ClerezzaSparqlObject) adapter.adaptTo(argument2,
            ConstructQuery.class);

        Object arg1 = argument1CSO.getClerezzaObject();
        Object dt = datatypePropertyCSO.getClerezzaObject();
        Object arg2 = argument2CSO.getClerezzaObject();

        UriRefOrVariable subject;
        UriRefOrVariable predicate;
        ResourceOrVariable object;

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

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

        if (arg2 instanceof Variable) {
            object = new ResourceOrVariable((Variable) arg2);
        } else if (arg2 instanceof LiteralExpression) {
            object = new ResourceOrVariable(((LiteralExpression) arg2).getLiteral());
        } 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

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

        String variableName = tmp.getVariableName();
        Variable variable = new Variable(variableName);

        return (T) new ClerezzaSparqlObject(variable);
    }
View Full Code Here

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

            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        LiteralExpression literalExpression = new LiteralExpression(literal);

        return (T) new ClerezzaSparqlObject(literalExpression);

    }
View Full Code Here

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

        ResourceOrVariable object;

        IObjectAtom argument2UriResource = tmp.getArgument2();
        IObjectAtom argument1UriResource = tmp.getArgument1();

        ClerezzaSparqlObject subjectCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument2UriResource,
            ConstructQuery.class);
        ClerezzaSparqlObject predicateCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument1UriResource,
            ConstructQuery.class);

        subject = new UriRefOrVariable((UriRef) subjectCSO.getClerezzaObject());
        predicate = new UriRefOrVariable((UriRef) predicateCSO.getClerezzaObject());
        object = new ResourceOrVariable(new BNode());

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

    }
View Full Code Here

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

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

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

        ClerezzaSparqlObject clerezzaArgument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject clerezzaArgument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2,
            ConstructQuery.class);

        Expression lhe = (Expression) clerezzaArgument1.getClerezzaObject();
        Expression rhe = (Expression) clerezzaArgument2.getClerezzaObject();

        return (T) new ClerezzaSparqlObject(new BinaryOperation(">=", lhe, rhe));

    }
View Full Code Here

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

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

        ExpressionAtom stringFunctionAtom1 = tmp.getStringFunctionAtom1();
        ExpressionAtom stringFunctionAtom2 = tmp.getStringFunctionAtom1();

        ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(stringFunctionAtom1,
            ConstructQuery.class);
        ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(stringFunctionAtom2,
            ConstructQuery.class);

        Expression lhe = (Expression) argument1.getClerezzaObject();
        Expression rhe = (Expression) argument2.getClerezzaObject();

        BinaryOperation binaryOperation = new BinaryOperation("!=", lhe, rhe);

        return (T) new ClerezzaSparqlObject(binaryOperation);

    }
View Full Code Here

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

        org.apache.stanbol.rules.manager.atoms.DivisionAtom tmp = (org.apache.stanbol.rules.manager.atoms.DivisionAtom) 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.LessThanAtom tmp = (org.apache.stanbol.rules.manager.atoms.LessThanAtom) ruleAtom;

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

        ClerezzaSparqlObject clerezzaArgument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject clerezzaArgument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2,
            ConstructQuery.class);

        Expression lhe = (Expression) clerezzaArgument1.getClerezzaObject();
        Expression rhe = (Expression) clerezzaArgument2.getClerezzaObject();

        return (T) new ClerezzaSparqlObject(new BinaryOperation("<", lhe, rhe));

    }
View Full Code Here

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

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

        ExpressionAtom argument1 = tmp.getStringFunctionAtom1();
        ExpressionAtom argument2 = tmp.getStringFunctionAtom2();

        ClerezzaSparqlObject clerezzaArgument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject clerezzaArgument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2,
            ConstructQuery.class);

        Expression lhe = (Expression) clerezzaArgument1.getClerezzaObject();
        Expression rhe = (Expression) clerezzaArgument2.getClerezzaObject();

        return (T) new ClerezzaSparqlObject(new BinaryOperation("=", lhe, rhe));

    }
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.