Search in sources :

Example 11 with Variable

use of org.apache.clerezza.rdf.core.sparql.query.Variable in project stanbol by apache.

the class NumericVariableAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.NumericVariableAtom tmp = (org.apache.stanbol.rules.manager.atoms.NumericVariableAtom) ruleAtom;
    String variableName = tmp.getVariableName();
    Variable variable = new Variable(variableName);
    return (T) new ClerezzaSparqlObject(variable);
}
Also used : Variable(org.apache.clerezza.rdf.core.sparql.query.Variable) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)

Example 12 with Variable

use of org.apache.clerezza.rdf.core.sparql.query.Variable in project stanbol by apache.

the class ResultSetToXml method createResultElement.

private void createResultElement(SolutionMapping solutionMap, Element results, Document doc) {
    Set<Variable> keys = solutionMap.keySet();
    Element result = doc.createElement("result");
    results.appendChild(result);
    for (Variable key : keys) {
        Element bindingElement = doc.createElement("binding");
        bindingElement.setAttribute("name", key.getName());
        bindingElement.appendChild(createValueElement(solutionMap.get(key), doc));
        result.appendChild(bindingElement);
    }
}
Also used : Variable(org.apache.clerezza.rdf.core.sparql.query.Variable) Element(org.w3c.dom.Element)

Aggregations

Variable (org.apache.clerezza.rdf.core.sparql.query.Variable)12 ClerezzaSparqlObject (org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)10 RuleAtomCallExeption (org.apache.stanbol.rules.base.api.RuleAtomCallExeption)5 IRI (org.apache.clerezza.commons.rdf.IRI)4 ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)4 Expression (org.apache.clerezza.rdf.core.sparql.query.Expression)4 IObjectAtom (org.apache.stanbol.rules.manager.atoms.IObjectAtom)4 LiteralExpression (org.apache.clerezza.rdf.core.sparql.query.LiteralExpression)3 ResourceOrVariable (org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable)3 UriRefOrVariable (org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable)3 SimpleTriplePattern (org.apache.clerezza.rdf.core.sparql.query.impl.SimpleTriplePattern)3 ArrayList (java.util.ArrayList)2 BuiltInCall (org.apache.clerezza.rdf.core.sparql.query.BuiltInCall)2 Element (org.w3c.dom.Element)2 PlainLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl)1 UriRefExpression (org.apache.clerezza.rdf.core.sparql.query.UriRefExpression)1 RuleAtom (org.apache.stanbol.rules.base.api.RuleAtom)1 URIResource (org.apache.stanbol.rules.base.api.URIResource)1 StringFunctionAtom (org.apache.stanbol.rules.manager.atoms.StringFunctionAtom)1 VariableAtom (org.apache.stanbol.rules.manager.atoms.VariableAtom)1