com.thinkaurelius.titan.core.attribute.Contain Java Examples
The following examples show how to use
com.thinkaurelius.titan.core.attribute.Contain.
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: MizoRDD.java From mizo with Apache License 2.0 | 6 votes |
/** * Given a path for Titan config file, connects and gets the internal Titan types, * converting them to MizoTitanRelationTypes mapped by type-ids * @param titanConfigPath Path to Titan's config path * @return Mapping between relation type-ids to InternalRelationType instances */ protected static HashMap<Long, MizoTitanRelationType> loadRelationTypes(String titanConfigPath) { TitanGraph g = TitanFactory.open(titanConfigPath); StandardTitanTx tx = (StandardTitanTx)g.buildTransaction().readOnly().start(); HashMap<Long, MizoTitanRelationType> relations = Maps.newHashMap(); tx.query() .has(BaseKey.SchemaCategory, Contain.IN, Lists.newArrayList(TitanSchemaCategory.values())) .vertices() .forEach(v -> { if (v instanceof InternalRelationType) relations.put(v.longId(), new MizoTitanRelationType((InternalRelationType)v)); }); tx.close(); try { ((StandardTitanGraph)g).getBackend().close(); } catch (BackendException e) { e.printStackTrace(); } return relations; }
Example #2
Source File: TitanPredicate.java From titan1withtp3.1 with Apache License 2.0 | 6 votes |
/** * Convert Tinkerpop's comparison operators to Titan's * * @param p Any predicate * @return A TitanPredicate equivalent to the given predicate * @throws IllegalArgumentException if the given Predicate is unknown */ public static final TitanPredicate convertInternal(BiPredicate p) { if (p instanceof TitanPredicate) { return (TitanPredicate)p; } else if (p instanceof Compare) { Compare comp = (Compare)p; switch(comp) { case eq: return Cmp.EQUAL; case neq: return Cmp.NOT_EQUAL; case gt: return Cmp.GREATER_THAN; case gte: return Cmp.GREATER_THAN_EQUAL; case lt: return Cmp.LESS_THAN; case lte: return Cmp.LESS_THAN_EQUAL; default: throw new IllegalArgumentException("Unexpected comparator: " + comp); } } else if (p instanceof Contains) { Contains con = (Contains)p; switch (con) { case within: return Contain.IN; case without: return Contain.NOT_IN; default: throw new IllegalArgumentException("Unexpected container: " + con); } } else return null; }
Example #3
Source File: StandardIndexInformation.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
@Override public boolean supports(KeyInformation information, TitanPredicate titanPredicate) { return titanPredicate == Cmp.EQUAL || titanPredicate == Contain.IN; }
Example #4
Source File: NativeTitan1GraphQuery.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Override public void in(String propertyName, Collection<? extends Object> values) { query.has(propertyName, Contain.IN, values); }
Example #5
Source File: NativeTitan0GraphQuery.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Override public void in(String propertyName, Collection<?> values) { query.has(propertyName, Contain.IN, values); }