Hi,
I implemented a edit distance filter using jena-arq, and tried to sparql query based on it. But it returns error (works on jena),
"
Exception in thread "main" com.hp.hpl.jena.sparql.ARQException: com.complexible.stardog.StardogException: com.complexible.stardog.plan.eval.ExecutionException: There was an error while creating a new query plan
"
Is that stardog doesn't support customized filter?
Here isthe code:
"
public class LevenshteinFilter extends FunctionBase2 {
public NodeValue exec(NodeValue value1, NodeValue value2) {
int i = StringUtils.getLevenshteinDistance(value1.asString(),
value2.asString());
return NodeValue.makeInteger(i);
}
}
...
Connection aConn = ConnectionConfiguration.to("myDB").server("snarl://localhost:5820/").credentials("admin", "admin").connect();
Model aModel = SDJenaFactory.createModel(aConn);
FunctionRegistry.get().put(functionUri, LevenshteinFilter.class);
+ "SELECT ?s1 ?s2 ?o1 ?o2 WHERE { ?s1 rdfs:label ?o1. ?s2 rdfs:label ?o2 ."
+ functionUri + ">(str(?o1),str(?o2)<3))} LIMIT 10";
QueryExecution qexec = QueryExecutionFactory.create(sparql, aModel);
ResultSet rs = qexec.execSelect();
while (rs.hasNext()) {
System.out.println(rs.next());
}
"
Thanks.