private boolean evalWhereIsLike(StoredObject so, Tree node, Tree colNode, Tree StringNode) {
Object rVal = onLiteral(StringNode);
if (!(rVal instanceof String))
throw new RuntimeException("LIKE operator requires String literal on right hand side.");
ColumnReference colRef = getColumnReference(colNode);
TypeDefinition td = colRef.getTypeDefinition();
PropertyDefinition<?> pd = td.getPropertyDefinitions().get(colRef.getPropertyId());
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();
}