Hello,
Need to get following reactive queries developed -
Scenario - Three types of objects - GrandParent,Parent,Child
Test Scenario - Create 4 objects of each type
GrandParent-GP1,GP2,GP3,GP4,
Parent- P11,P12,P13,P14,P21,P22,P23,P24,P31,P32,P41,P42
Child - C111,C112,C121,C122,C123,C121,C122,C123,C124,C131,C132,C141,C142 and so on
Relationship - GP1 is related to P11, P12,P13, P14 . Relationship from P to G is called "Parent"
P11 is related to C111,C112 Relationship from C to P is called "ParentOf" and relationship P to C is called "ChildOf"
( first number represent object of GrandParent, 2nd Parent, 3 is for child) .This is just sample (object name can be anything)
we have event -
AEvent
{
string objectType;
string name;
string pc ;
string dc;
string reason;
int cond;
}
here cond=1 means active event
cond =2 mean event now inactive
Reactive Query Requirement (You are getting continuous stream of events, which can be corresponding to any type with any name or other properties)
Requirement 1-
a) If I recv events where pc= "CD" and cond=1 where objectType = "CHILD" for all the childs of a given parent during duration X sec, create a new event for corresponding parent with PC="PC" and cond =1, reason="CD", if during the duration X, if for anychild you recv pc=CD and cond=2 the scenario is no longer valid
b)If you recv a event with pc= "CD" and cond =2 for a child and during that time PC="PC" and cond =1, reason="CD" exist for its parent , wait for N sec, if during the time you recv a event with cond = 1 for the same child, do nothing, otherwise raise event PC="PC" and cond =2, reason="CD".
Consider following function, you can hardcode them
a)GetNodeCount(string NodeType,string NodeName,string RelationShipKind)
b)GetNodeRelation(string NodeType,string NodeName, string RelationShipKind) -
Example of function B call - if for child C1, i want to want to find a relation of kind ParentOf
the function call will look like GetNodeRelation("CHILD","C111", "ParentOf") it will give P11
Example of function A call - if I want to find number of child of the parent C1111 , i can use it like - GetNodeCount("PARENT",GetNodeRelation("CHILD","C111", "ParentOf") ,"CHILDOF")
c) RaiseEvent(AEvent evt) - The moment you raise it, on the next statement if you try function as mentioned in d, you will get 1.
d) GetExistingEventCount(string wherecondition) - this is to get count of events matching a given condition ; where condition is of like requlaer sql condition, like if i want to check if there exists a event with objecttype="CHILD" and name = "ABC" my where condtion will look like "objecttype='CHILD' and name = 'ABC'
Requirement 2
Its same as requirement 1, only difference is there is no constrain of time X there in point 1
Requirement 3
There is a Continuous influx of csv - csv is for the form (first line is header)
KeyCol1,KeyCol2,KeyCol3, Date, Time, D1,D2,D3,D4
Requirement - (Say GapTime is 15 minutes)
a) For each KeyColumn combination, output the different of last 2 values ( say you recvd 1st file at time 10:15 which has data for key1,Key2,Key3,Key4
then at 10:30 you got the 2nd file, at this time you will output key1,Key2,Key3,Key4,from 10:30 file(D1) - 10:15 (D1), 10:30 file (D2) - 10:15(d2)
and so on
and now you can relase 10:15 data for key1,key2,key3,key4 and keep 10:30 data for key1,Key2,Key3,Key4
if you never recvd 10:45 data, but directly recvd 11:00 data, then you dont output anything, just release 10:30 data and keep 11:00 data