public Boolean walkLike(Tree opNode, Tree colNode, Tree stringNode) {
Object rVal = walkExpr(stringNode);
if (!(rVal instanceof String))
throw new RuntimeException("LIKE operator requires String literal on right hand side.");
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
PropertyType propType = pd.getPropertyType();
if (propType != PropertyType.STRING && propType != PropertyType.HTML && propType != PropertyType.ID
&& propType != PropertyType.URI)
throw new RuntimeException("Property type " + propType.value() + " is not allowed FOR LIKE");
if (pd.getCardinality() != Cardinality.SINGLE)
throw new RuntimeException("LIKE is not allowed for multi-value properties ");
String propVal = (String) so.getProperties().get(colRef.getPropertyId()).getFirstValue();
String pattern = translatePattern((String) rVal); // SQL to Java
// regex
// syntax
Pattern p = Pattern.compile(pattern);
return p.matcher(propVal).matches();