Search in sources :

Example 1 with ActionMatchString

use of org.apache.jena.sdb.exprmatch.ActionMatchString in project jena by apache.

the class StringEqualsSqlGen method recognize.

//    private static ExprPattern equalsString3 = new ExprPattern("str(?a1) = ?a2",
//                                                               new Var[]{ Var.alloc("a1") , Var.alloc("a2") },
//                                                               new Action[]{ new ActionMatchVar() ,
//                                                                             new ActionMatchString()}) ;
////  As equalsString3 but reverse the arguments.
//    private static ExprPattern equalsString4 = new ExprPattern("?a1 = str(?a2)",
//                                                               new Var[]{ Var.alloc("a1") , Var.alloc("a2") },
//                                                               new Action[]{ new ActionMatchString() ,
//                                                                             new ActionMatchVar() }) ;
@Override
public SDBConstraint recognize(Expr expr) {
    MapResult rMap = null;
    if ((rMap = equalsString1.match(expr)) != null) {
        Var var = rMap.get("a1").getExprVar().asVar();
        String str = rMap.get("a2").getConstant().getString();
        return new StringEqualsSqlGen(expr, equalsString1, true);
    }
    return null;
}
Also used : Var(org.apache.jena.sparql.core.Var) ActionMatchVar(org.apache.jena.sdb.exprmatch.ActionMatchVar) ActionMatchString(org.apache.jena.sdb.exprmatch.ActionMatchString) MapResult(org.apache.jena.sdb.exprmatch.MapResult)

Aggregations

ActionMatchString (org.apache.jena.sdb.exprmatch.ActionMatchString)1 ActionMatchVar (org.apache.jena.sdb.exprmatch.ActionMatchVar)1 MapResult (org.apache.jena.sdb.exprmatch.MapResult)1 Var (org.apache.jena.sparql.core.Var)1