use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class VariableAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) {
org.apache.stanbol.rules.manager.atoms.VariableAtom tmp = (org.apache.stanbol.rules.manager.atoms.VariableAtom) ruleAtom;
String variableName = tmp.getVariableName();
return (T) new SPARQLFunction("?" + variableName);
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class DivisionAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException {
org.apache.stanbol.rules.manager.atoms.DivisionAtom tmp = (org.apache.stanbol.rules.manager.atoms.DivisionAtom) ruleAtom;
NumericFunctionAtom argument1 = tmp.getNumericFunctionAtom1();
NumericFunctionAtom argument2 = tmp.getNumericFunctionAtom2();
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("/");
sb.append(sparqlFunction2);
sb.append(")");
return (T) new SPARQLFunction(sb.toString());
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class LengthAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, 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);
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class NamespaceAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.NamespaceAtom tmp = (org.apache.stanbol.rules.manager.atoms.NamespaceAtom) ruleAtom;
IObjectAtom argument = tmp.getUriResource();
SPARQLObject sparqlObject = adapter.adaptTo(argument, SPARQLObject.class);
String sparql = "<http://jena.hpl.hp.com/ARQ/function#namespace>(" + sparqlObject.getObject() + ")";
return (T) new SPARQLFunction(sparql);
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class NumberAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) {
org.apache.stanbol.rules.manager.atoms.NumberAtom tmp = (org.apache.stanbol.rules.manager.atoms.NumberAtom) ruleAtom;
String number = tmp.getNumber();
return (T) new SPARQLFunction(number);
}
Aggregations