use of org.apache.clerezza.rdf.core.sparql.query.UriRefExpression in project stanbol by apache.
the class IsBlankAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.IsBlankAtom tmp = (org.apache.stanbol.rules.manager.atoms.IsBlankAtom) ruleAtom;
IObjectAtom uriResource = tmp.getUriResource();
ClerezzaSparqlObject argumentCSO = (ClerezzaSparqlObject) adapter.adaptTo(uriResource, ConstructQuery.class);
;
Object arg = argumentCSO.getClerezzaObject();
Expression argumentExpression;
if (arg instanceof Variable) {
argumentExpression = (Variable) arg;
} else if (arg instanceof IRI) {
argumentExpression = new UriRefExpression((IRI) arg);
} else {
throw new RuleAtomCallExeption(getClass());
}
List<Expression> expressions = new ArrayList<Expression>();
expressions.add(argumentExpression);
return (T) new ClerezzaSparqlObject(new BuiltInCall("isBLANK", expressions));
}
Aggregations