use of org.apache.stanbol.rules.adapters.jena.JenaAdapter in project stanbol by apache.
the class NumericVariableAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption {
org.apache.stanbol.rules.manager.atoms.NumericVariableAtom tmp = (org.apache.stanbol.rules.manager.atoms.NumericVariableAtom) ruleAtom;
URI uri = tmp.getURI();
String variable = uri.toString();
variable = variable.replace(Symbols.variablesPrefix, "");
if (variable.startsWith("?")) {
variable = variable.substring(1);
}
Integer index = ((JenaAdapter) adapter).variableMap.get(variable);
if (index == null) {
index = ((JenaAdapter) adapter).variableMap.size();
((JenaAdapter) adapter).variableMap.put(variable, index);
}
Node_RuleVariable ruleVariable = new Node_RuleVariable("?" + variable, index.intValue());
return (T) new NodeClauseEntry(ruleVariable);
}
use of org.apache.stanbol.rules.adapters.jena.JenaAdapter in project stanbol by apache.
the class VariableAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption {
org.apache.stanbol.rules.manager.atoms.VariableAtom tmp = (org.apache.stanbol.rules.manager.atoms.VariableAtom) ruleAtom;
URI uri = tmp.getURI();
String variable = uri.toString();
variable = variable.replace(Symbols.variablesPrefix, "");
if (variable.startsWith("?")) {
variable = variable.substring(1);
}
Integer index = ((JenaAdapter) adapter).variableMap.get(variable);
if (index == null) {
index = ((JenaAdapter) adapter).variableMap.size();
((JenaAdapter) adapter).variableMap.put(variable, index);
}
Node_RuleVariable ruleVariable = new Node_RuleVariable("?" + variable, index.intValue());
return (T) new NodeClauseEntry(ruleVariable);
}
use of org.apache.stanbol.rules.adapters.jena.JenaAdapter in project stanbol by apache.
the class StringVariableAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption {
org.apache.stanbol.rules.manager.atoms.StringVariableAtom tmp = (org.apache.stanbol.rules.manager.atoms.StringVariableAtom) ruleAtom;
URI uri = tmp.getURI();
String variable = uri.toString();
variable = variable.replace(Symbols.variablesPrefix, "");
if (variable.startsWith("?")) {
variable = variable.substring(1);
}
Integer index = ((JenaAdapter) adapter).variableMap.get(variable);
if (index == null) {
index = ((JenaAdapter) adapter).variableMap.size();
((JenaAdapter) adapter).variableMap.put(variable, index);
}
Node_RuleVariable ruleVariable = new Node_RuleVariable("?" + variable, index.intValue());
return (T) new NodeClauseEntry(ruleVariable);
}
Aggregations