use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class LocalNameAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, 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);
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class ResourceAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption {
org.apache.stanbol.rules.manager.atoms.ResourceAtom tmp = (org.apache.stanbol.rules.manager.atoms.ResourceAtom) ruleAtom;
String quotedURI = tmp.toString();
return (T) new SPARQLFunction(quotedURI);
}
use of org.apache.stanbol.rules.adapters.sparql.SPARQLFunction in project stanbol by apache.
the class UObjectAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) {
org.apache.stanbol.rules.manager.atoms.UObjectAtom tmp = (org.apache.stanbol.rules.manager.atoms.UObjectAtom) ruleAtom;
int actualType = tmp.getActualType();
Object argument = tmp.getArgument();
String argumentSPARQL = null;
switch(actualType) {
case 0:
argumentSPARQL = "\"" + argument + "\"^^<http://www.w3.org/2001/XMLSchema#string>";
break;
case 1:
argumentSPARQL = argument.toString() + "^^<http://www.w3.org/2001/XMLSchema#int>";
break;
case 2:
argumentSPARQL = "?" + argument.toString().replace(Symbols.variablesPrefix, "");
break;
default:
break;
}
if (argumentSPARQL != null) {
return (T) new SPARQLFunction(argumentSPARQL);
} else {
return null;
}
}
Aggregations