Rules Definition Evaluation: Data Modeling

25 views
Skip to first unread message

Ranga S

unread,
Jan 26, 2016, 6:24:37 PM1/26/16
to Neo4j
Hi

I was wondering if someone could help me with modeling rules data. Here are the requirements for my use-case:
  • A node in the graph would represent a domain entity. Lets call it a "Partition" type
  • Multiple "filters/criterias" could be defined for a Partition
  • Filter could be defined as another node type. For e.g.: "Country", "Region", "Load"
  • Queries would be of the form: Retrieve the list of partitions that match an input criteria
    • E.g.: Country IN ['China', 'India'], Region = 'Primary', Load > 40
Here is what I am struggling with:
  • Could a Graph DB used for my use-case?
  • Defining thresholds/operators for each filter
    • Each filter type could have a value and also an "operator" 
  • Dynamic query creation based on input criteria
    • Should I retrieve all the nodes and based on their filters create the appropriate queries?
    • Or is there a way to create the queries based on the input criteria and then retrieve the nodes that match that?
  • How should nested criteria be modeled/evaluated?
Thanks for your help.


Ranga

Mahesh Lal

unread,
Jan 27, 2016, 3:52:05 AM1/27/16
to Neo4j
Graphs do sound suited to your problem. 
Moe replies inline.


On 26 January 2016 at 22:48, Ranga S <sra...@gmail.com> wrote:
Hi

I was wondering if someone could help me with modeling rules data. Here are the requirements for my use-case:
  • A node in the graph would represent a domain entity. Lets call it a "Partition" type
  • Multiple "filters/criterias" could be defined for a Partition
  • Filter could be defined as another node type. For e.g.: "Country", "Region", "Load"
  • Queries would be of the form: Retrieve the list of partitions that match an input criteria
    • E.g.: Country IN ['China', 'India'], Region = 'Primary', Load > 40
Here is what I am struggling with:
  • Could a Graph DB used for my use-case?
  • Defining thresholds/operators for each filter
    • Each filter type could have a value and also an "operator" 
Can you please elaborate on what would filter type, value and operator be?
Is it something like filter_type:"Population", value:1Billion, operator:"Less than"? 
  • Dynamic query creation based on input criteria
    • Should I retrieve all the nodes and based on their filters create the appropriate queries?
    • Or is there a way to create the queries based on the input criteria and then retrieve the nodes that match that?
Filtering can be modelled as a traversal and you can construct queries based on some input criteria to retrieve the nodes that you want.  
  • How should nested criteria be modeled/evaluated?
Can you give and example of this to help the community understand this better?
Thanks for your help.


Ranga

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- Thanks and Regards
   Mahesh Lal

Ranga S

unread,
Jan 27, 2016, 2:08:06 PM1/27/16
to Neo4j
Thanks Mahesh. Answers to your questions are as follows:

Q: Can you please elaborate on what would filter type, value and operator be? Is it something like filter_type:"Population", value:1Billion, operator:"Less than"? 
A: Yes, that is exactly what it means. I had specified an example in my original question as well. E.g. Country IN ['China', 'India'], Region = 'Primary', Load > 40. Here the filter types (nodes) are: "Country", "Region", "Load". Operators would be: "IN", "=", ">". Value would be: ['China', 'India'], Primary, 40. 

My input criteria could be: {Country = 'India', Load = 70}. This should match the example defined above (even though the Region filter is missing). You had mentioned that I need to model filtering as a traversal. Could you provide an example of this? Should I traverse the graph first, get all the filters and then apply the criteria as queries?

Q: Can you give and example of this (how nested criteria should be modeled) to help the community understand this better?
We could have a filter defined as: Type - "OS Version", Value - "10.3.4.5", Operator - ">"
An input criteria of "10.4" should match the above and so should "10.3.4.5.1"
I was thinking about defining this filter as four separate "nested" nodes (and hence the question). 10 -> 3 -> 4 -> 5



Ranga
Reply all
Reply to author
Forward
0 new messages