Пример #1
0
        public Manager GetManager(_P p)
        {
            Assembly assembly    = this.GetAssembly(p.ManagerAssemblyPath);
            var      typeManager = assembly.GetType(p.ManagerType);
            var      manager     = (Manager)System.Activator.CreateInstance(typeManager, this.Neo4j);

            return(manager);
        }
Пример #2
0
        public object GetParameter2(_P p)
        {
            object result = null;

            if (!string.IsNullOrEmpty(p.Argument2Json))
            {
                Assembly assembly      = this.GetAssembly(p.Argument2AssemblyPath);
                var      typeParameter = assembly.GetType(p.Argument2Type);
                result = this.Deserialize(p.Argument2Json, typeParameter);
            }
            return(result);
        }
Пример #3
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);
        }