I am using janus graph deployed in embedded mode. And i am using java. And firing following queries
--> g.V().has('deleted',false).valueMap() //slow
--> g.V().has('deleted',false).toList() //slow
the above query takes time after implementing composite indexes also
--> g.V().has('deleted',false) //fast
above query is fast and use implemented composite index created on deleted key.
Also tried the same using java code
List<Vertex> list = new ArrayList<>();
DateTime dt1 = new DateTime();
JanusGraphQuery<? extends JanusGraphQuery> query = GraphClient.getJGraph().query();
Iterator iterator = query.has("deleted",false).vertices().iterator();
while(iterator.hasNext()) {
Vertex next = (Vertex) iterator.next();
getPropertyMapByVertex(next); //time consuming to convert vertex into Map.
list.add(next);
}
public static Map<String, Object> getPropertyMapByVertex(Vertex vertex) {
Map<String, Object> propertyMap = new HashMap<>();
try {
if (vertex != null) {
Iterator<VertexProperty<Object>> properties = vertex.properties();
if (properties != null) {
while (properties.hasNext()) {
Property<Object> property = properties.next();
propertyMap.put(property.key(), property.value());
}
propertyMap.put(GraphConstants.VERTEX_ID, vertex.id());
}
}
} catch (Exception e) {
logger.error("Exception in getPropertyMapByVertex : {}", ExceptionUtils.getStackTrace(e));
}
return propertyMap;
}
do we have some way to fast "getPropertyMapByVertex" method or any other way to fire query and get data quickly using java.