Exemple #1
0
        public void Receive(ImageMessage msg)
        {
            //Grafo 1: (_Input)-[:_R]->(ImageMessage)
            //Grafo 2: (ImageMessage)-[:_R]->(_SELF)
            //Grafo 3: (_SELF)-[:_R]->(_P)
            _I  iFrame = new _I();
            _S  self   = new _S();
            var query  = this.Neo4j.Client.Cypher
                         //Nodes: _I, _S, ImageMessage, _P
                         .Create($"(i:_I {{iFrame}})")
                         .Create($"(m:ImageMessage {{msg}})")
                         .Create($"(s:_S)")
                         .WithParams(new { iFrame, msg })
                         .Create("(i)-[:_L]->(s)")
                         .Create("(s)<-[:_Q]-(m)")
                         .Return((i, m, s) =>
                                 new
            {
                input   = i.As <Neo4jClient.Node <_I> >(),
                message = m.As <Neo4jClient.Node <ImageMessage> >(),
                self    = s.As <Neo4jClient.Node <_S> >()
            }
                                 );
            var result = query.Results.Single();
            //Create Process to Exceute
            _P pToExecute = new _P();

            pToExecute.ManagerType   = "Nasdan.Core.Senses.SensesManager";
            pToExecute.FunctionName  = "Process";
            pToExecute.Argument1Json = this.Serialize(result.self);
            pToExecute.Argument1Type = result.self.GetType().ToString();
            pToExecute.Argument2Json = this.Serialize(result.message);
            pToExecute.Argument2Type = result.message.GetType().ToString();
            pToExecute.ResultType    = "Nasdan.Core.Representation._N`1";
            var query2 = this.Neo4j.Client.Cypher
                         .Create($"(p:_P {{pToExecute}})")
                         .WithParams(new { iFrame, msg, pToExecute })
                         //Edges
                         .Create("(s)-[p:_P {{pToExecute}}]->(m)")
                         .WithParams(new { pToExecute })
                         .Return(p => p.As <Neo4jClient.Node <_P> >());
            var _pNode = query2.Results.Single();
            var _p     = ((Neo4jClient.Node <_P>)_pNode).to_N <_P>();

            SelfActor.Tell(_p);
        }
Exemple #2
0
 static _I()
 {
     instance = new _I();
 }