Graphs in RavenDBWhat’s the role of the middle man?
An interesting challenge with implementing graph queries is that you sometimes get into situations where the correct behavior is counter intuitive.
Consider the case of the graph on the right and the following query:
This will return:
- Source: Arava, Destination: Oscar
But what would be the value of the Edge property? The answer to that is… complicated. What we actually return is the edge itself. Let’s see what I mean by that.
And, indeed, the value of Edge in this query is going to be dogs/oscar.
This isn’t very helpful if we are talking about a simple edge like this. After all, we can deduce this from the Src –> Destination pair. This gets more interesting when the edge is more complex. Consider the following query:
What do you this should be the output here? In this case, the edge isn’t the Product property, it is the specific line that match the filter on the edge. Here is what the result looks like:
As you can imagine, knowing exactly what edge led you from one document to another can be very useful when you look at the query results.
More posts in "Graphs in RavenDB" series:
- (08 Nov 2018) Real world use cases
- (01 Nov 2018) Recursive queries
- (31 Oct 2018) Inconsistency abhorrence
- (29 Oct 2018) Selecting the syntax
- (26 Oct 2018) What’s the role of the middle man?
- (25 Oct 2018) I didn’t mean to build this feature!
- (22 Oct 2018) Query results
- (21 Sep 2018) Graph modeling vs. document modeling
- (20 Sep 2018) Pre-processing the queries
- (19 Sep 2018) The query language
- (18 Sep 2018) The overall design
Comments
Comment preview