@Override public <T extends RelationType> Iterable<T> getRelationTypes(Class<T> clazz) { Preconditions.checkNotNull(clazz); Iterable<? extends TitanVertex> types = null; if (PropertyKey.class.equals(clazz)) { types = QueryUtil.getVertices(transaction, BaseKey.SchemaCategory, TitanSchemaCategory.PROPERTYKEY); } else if (EdgeLabel.class.equals(clazz)) { types = QueryUtil.getVertices(transaction, BaseKey.SchemaCategory, TitanSchemaCategory.EDGELABEL); } else if (RelationType.class.equals(clazz)) { types = Iterables.concat(getRelationTypes(EdgeLabel.class), getRelationTypes(PropertyKey.class)); } else throw new IllegalArgumentException("Unknown type class: " + clazz); return Iterables.filter(Iterables.filter(types, clazz), new Predicate<T>() { @Override public boolean apply(@Nullable T t) { //Filter out all relation type indexes return ((InternalRelationType) t).getBaseType() == null; } }); }
@Override public <T extends RelationType> Iterable<T> getRelationTypes(Class<T> clazz) { Preconditions.checkNotNull(clazz); Iterable<? extends TitanVertex> types = null; if (PropertyKey.class.equals(clazz)) { types = transaction.getVertices(BaseKey.SchemaCategory, TitanSchemaCategory.PROPERTYKEY); } else if (EdgeLabel.class.equals(clazz)) { types = transaction.getVertices(BaseKey.SchemaCategory, TitanSchemaCategory.EDGELABEL); } else if (RelationType.class.equals(clazz)) { types = Iterables.concat(getRelationTypes(EdgeLabel.class), getRelationTypes(PropertyKey.class)); } else throw new IllegalArgumentException("Unknown type class: " + clazz); return Iterables.filter(Iterables.filter(types, clazz),new Predicate<T>() { @Override public boolean apply(@Nullable T t) { //Filter out all relation type indexes return ((InternalRelationType)t).getBaseType()==null; } }); }
@Override public <T extends RelationType> Iterable<T> getRelationTypes(Class<T> clazz) { Preconditions.checkNotNull(clazz); Iterable<? extends TitanVertex> types = null; if (PropertyKey.class.equals(clazz)) { types = QueryUtil.getVertices(transaction, BaseKey.SchemaCategory, TitanSchemaCategory.PROPERTYKEY); } else if (EdgeLabel.class.equals(clazz)) { types = QueryUtil.getVertices(transaction, BaseKey.SchemaCategory, TitanSchemaCategory.EDGELABEL); } else if (RelationType.class.equals(clazz)) { types = Iterables.concat(getRelationTypes(EdgeLabel.class), getRelationTypes(PropertyKey.class)); } else throw new IllegalArgumentException("Unknown type class: " + clazz); return Iterables.filter(Iterables.filter(types, clazz), new Predicate<T>() { @Override public boolean apply(@Nullable T t) { //Filter out all relation type indexes return ((InternalRelationType) t).getBaseType() == null; } }); }