I am building a credit card applicatoin and want an information structure of interconnected objects that may be queried and traversed. The connections between objects could be arbitrary and never always known before hands. I want this data structure to become queryable (what usual SQL provides) as well as traversable (what new graph database like neo4j provide). I am looking to get something which does both and works together with large data sets effectively. Let us refer to this as data structure dao. I'd require the following primitive techniques:
// dealing with the objects dao.save(s); Something s = dao.load(Something.class, 5); dao.update(s); dao.delete(s); // dealing with the relations dao.relate(s, t); dao.unrelate(s, t); // the tricky methods dao.querier(Something.class).filter(...).sort(...).values(); dao.traverser(Something.class).start(s).path(...).filter(...).sort(...).values();
The filter could be something similar to the sql where clause, the sort could be something similar to the sql order clause, the start will be the beginning node for that traversal, and also the path would define such things as BFS and DFS crossing in addition to when you should stop searching.
I have attempted to model this as vertices by having an adjacency list but there has to be an easy method. Any ideas?
maybe while using sparql query engine for neo4j?
Yes, Neo4j will be a wise decision. Near the raw usage from Java, Jo4neo provides annotation-based persistence for the object model to the graph. For querying, you can either may use the Neo4j high-speed Java Traversers, or use such things as the JRuby Wrapper that provides very convenient abstractions for queries from JRuby. Also, Gremlin is specialized on deep graph traversals, but not enhanced for speed.