Query on modelling definition usecase involve more than 2 vertices

32 views
Skip to first unread message

Naresh Yadav

unread,
Mar 26, 2015, 9:00:25 AM3/26/15
to aureliu...@googlegroups.com
Hi All,

I am new to titan and learning basics of it. I have following usecase of graph :

1. Sales -> hasMap -> Map1  -> hasAnalytic  -> Sum

2. Revenue -> hasMap -> Map1  -> hasAnalytic  -> Average

Query 1 : Give me analytic defined on Sales, Map1
Query 2 : Give me analytic defined on Revenue, Map1

How do i store these type of relations because if i model normal way then when i need to get analytic of [Sales, Map1] then Map1 will be connected to
both Sum, Average but expected is only Sum.

Please help me on this if i had explained my problem properly.

Thanks
Naresh

Stephen Mallette

unread,
Mar 27, 2015, 6:59:42 AM3/27/15
to aureliu...@googlegroups.com
Hard to say how you should model that as I don't understand your domain, but you definitely have a problem as Sales and Revenue both tie to Map1 but then are also need some relation to Sum and Average independently. A couple of ideas:

+ Add a property hasAnalytic to define whether the analytic is related to Sales or Revenue
+ Add an Edge from the Sales/Revenue to the Sum/Average to indicate that it is related.

Seems like there could be many ways to solve the problem actually - the best approach just depends on the details of your project.

--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/0bf0b1ef-b3af-4393-b98f-af83b4af15b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Naresh Yadav

unread,
Mar 30, 2015, 9:00:37 AM3/30/15
to aureliu...@googlegroups.com
Hi Stephen,

thanks for your valuable ideas and you clearly got problem with my usecase.

Model 1 you suggested will work for sure in which we are solving this usecase by adding property on edge to tell it is for Sales OR Revenue.
You may better know performance issues of this model from scale point of view as property based queries will come into picture here.

Model 2 will break with additional definitions for example :


1. Sales -> hasMap -> Map1  -> hasAnalytic  -> Sum
    Model 2 :
                    Sales -> hasMap -> Map1
                    Map1  -> hasAnalytic  -> Sum
                    Sales -> hasAnalytic -> Sum

2. Revenue -> hasMap -> Map1  -> hasAnalytic  -> Average
    Model 2 :
                    Revenue -> hasMap -> Map1
                    Map1  -> hasAnalytic  -> Average
                    Revenue -> hasAnalytic -> Average
3. Sales -> hasMap -> Map2  -> hasAnalytic  -> Average
    Model 2 :
                    Sales -> hasMap -> Map2 
                    Map2  -> hasAnalytic  -> Average
                    Sales -> hasAnalytic -> Average
With these 3 usecases stored in graph then if we need to get what is analytic on Sales, Map1 then it will break.
        Map1 -> hasAnalytic = Sum, Average
        Sales -> hasAnalytic = Sum, Average
        Intersection is Sum, Average which is wrong answer for Sales, Map1. Expected answer is only Sum

Please give your suggestions further on this.

Thanks
Naresh

Stephen Mallette

unread,
Mar 30, 2015, 10:29:23 AM3/30/15
to aureliu...@googlegroups.com
If Model 2 breaks down for you then perhaps just go with Model 1.  Model 1 has the advantage of being able to take advantage of vertex-centric indices (i.e. will scale well), so it is probably a good approach if you don't have other ideas.

Naresh Yadav

unread,
Mar 31, 2015, 9:03:20 AM3/31/15
to aureliu...@googlegroups.com
Hi Stephen,

Thanks will definitely try Model1 with vertex centric indices. No other options i am able to think, unless someone post more models for this usecase.

Thanks
Naresh
Reply all
Reply to author
Forward
0 new messages