Java Code Examples for com.thinkaurelius.titan.core.attribute.Text#CONTAINS_REGEX

The following examples show how to use com.thinkaurelius.titan.core.attribute.Text#CONTAINS_REGEX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeTitan1GraphQuery.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
private Text getGremlinPredicate(MatchingOperator op) {
    switch (op) {
        case CONTAINS:
            return Text.CONTAINS;
        case PREFIX:
            return Text.PREFIX;
        case SUFFIX:
            return Text.CONTAINS_REGEX;
        case REGEX:
            return Text.REGEX;
        default:
            throw new RuntimeException("Unsupported matching operator:" + op);
    }
}
 
Example 2
Source File: NativeTitan0GraphQuery.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
private Text getGremlinPredicate(MatchingOperator op) {
    switch (op) {
        case CONTAINS:
            return Text.CONTAINS;
        case PREFIX:
            return Text.PREFIX;
        case SUFFIX:
            return Text.CONTAINS_REGEX;
        case REGEX:
            return Text.REGEX;
        default:
            throw new RuntimeException("Unsupported matching operator:" + op);
    }
}
 
Example 3
Source File: Solr5Index.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
@Override
public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
    Class<?> dataType = information.getDataType();
    Mapping mapping = getMapping(information);
    if (mapping!= DEFAULT && !AttributeUtil.isString(dataType)) return false;

    if (Number.class.isAssignableFrom(dataType)) {
        return titanPredicate instanceof Cmp;
    } else if (dataType == Geoshape.class) {
        return titanPredicate == Geo.WITHIN;
    } else if (AttributeUtil.isString(dataType)) {
        switch(mapping) {
            case DEFAULT:
            case TEXT:
                return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX || titanPredicate == Text.CONTAINS_REGEX;
            case STRING:
                return titanPredicate == EQUAL || titanPredicate== NOT_EQUAL || titanPredicate==Text.REGEX || titanPredicate==Text.PREFIX;
            //                case TEXTSTRING:
            //                    return (titanPredicate instanceof Text) || titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL;
        }
    } else if (dataType == Date.class) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Boolean.class) {
        return titanPredicate == EQUAL || titanPredicate == NOT_EQUAL;
    } else if (dataType == UUID.class) {
        return titanPredicate == EQUAL || titanPredicate== NOT_EQUAL;
    }
    return false;
}