3

Let's say I want to model a graph with sales people. They belong to an organisation, have a manager, etc.. They are assigned to specific territories and/or client accounts. Your company may work with external partners, which must be managed, and so on. A nice, none-trivial, graph.

Elements in this graph keep on changing all the time: sales people come and go, or move within the organisation and thus change responsibilities; customers sign contract or cancel them, ...

In my specific use cases, the point in time is very important. How did the graph look like at the end of last month? End of last fiscal year? last Monday when we run job ABC. E.g. what was the manager hierarchy end of last month? Which clients did the sale person manage end of last month? and so on.

In our use cases, DELETE doesn't delete anything, but some sort of end_date gets updated. UPDATE doen't update anything, but a new version of the record is created.

I'm sure I can add CREATED and START-/END_DATE properties to nodes as well as relations, and for sure I can also create queries. But these queries are a pain to write, and almost unreadable, with tons of repeating where clauses everywhere.

I wish graph databases (and their graphical query builder) would allow me to travel in time more easily, e.g. by setting a session variable to a point in time, and all the where clauses are automatically added for all nodes and references that have the start/end date properties. The algorithm should not fail for objects that don't have these properties, but consider the condition met.

What are you thoughts about this use case und what help does memgraph provide for these use cases?

thanks a lot Juergen

bechbd
  • 6,206
  • 3
  • 28
  • 47
Juergen
  • 699
  • 7
  • 20
  • 3
    Hi! It’s fantastic to see StackOverflow questions directly referencing Memgraph. Features like this one are specific to the application logic. Even though Memgraph doesn’t have a lot of functions and data types related to the time data yet, it allows modeling and querying of time-related data. The session feature seems blurry because it’s not clear what would be query execution edge cases in case there is the session variable or every query is modified. Would you provide an example of a database query and how it could be changed to support your use-case? – buda Nov 18 '18 at 19:55
  • The SO memgraphdb tag does not exist as mentioned on your homepage – Juergen Nov 18 '18 at 20:38
  • 2
    As explained here https://stackoverflow.com/help/privileges/create-tags, a new tag could be created by somebody who has reputation of minimum 1500. @Stanislav Kralin, could you please update the question by adding memgraphdb tag? – buda Nov 18 '18 at 20:55
  • unfortunately not. I don't have so many reputation points. – Juergen Nov 19 '18 at 08:38
  • 1
    I have added the memgraphdb tag to the system and added it to this question – bechbd Nov 19 '18 at 13:18

1 Answers1

3

As far as I am aware there is not any graph database that supports the type of functionality you are asking about directly although as @buda points out you can model and query against time series data. I agree with @buda that the way in which you would like this to work seems a bit undefined and very application specific so I would not expect this to be a feature of any database.

The closest I can think of to out of the box support for something like this would be to use a Tinkerpop-enabled database with a PartitionStrategy or SubgraphStrategy to create the subgraph of only the times you wanted and then query against that. Another option would be creating a domain specific language to minimize the amount of times you need to repeated code in your queries.

PartitionStrategy

SubgraphStrategy

Domain Specific Languages

bechbd
  • 6,206
  • 3
  • 28
  • 47
  • That matches my experience. I've been looking at other graph dbs for some time, but the answer has been the same. In our legacy code base we are using an RDBMS and an abstraction layer which works as explained above: a JDBC compliant server (can be used from any SQL client) which implements the abstraction layer, and connection specific attributes (e.g. the timestamp). The layer is not very dynamic right now, and also not really fast. I was hoping to be able to replace it at one point with a better implementation. – Juergen Nov 19 '18 at 16:11