Graph in stream
BangDB streams can also use Graph for the events which are time-series data. To use Graph in the stream, we may simply edit the schema and add set of relations as needed.
Example
Let's say we have a schema where we receive purchase events for e-commerce and we would like to link user and the product he/she purchases, then we would simply add following:
"rels":[{"sub":"user","obj":"product","rel":"BUYS"}]
Here is the short schema definition for example:
{
"schema":"grpahschema",
"streams":[
{
"name":"order",
"type":1,
"swsz":86400,
"inpt":[
],
"attr":[
{
"name":"product",
"type":"STRING",
"sidx":1,
"kysz":32,
"stat":"UCOUNT"
},
{
"name":"user",
"type":"STRING",
"sidx":1,
"stat":"UCOUNT"
}
],
"rels":[
{
"sub":"user",
"obj":"product",
"rel":"BUYS"
}
]
}
]
}
That's it, where the "user" and "product" are attributes in the Order stream. Once defined, db would simply keep creating the relations (and creating nodes as required).
To query, we can use Cypher as described above using usual methods.
Now, let's look at some of the topics in detail and in advance sense, also we will introduce SYMM, ASYMM, AGGREGATION in detail, Filtering in detail, SHORT_PATH and ALL_PATH in more complex situations and SIMILARITY.