Ejemplo n.º 1
0
        public opis InitNewScriptContext(string[] sentenceParts)
        {
            opis cont = null;

            OntologyTreeBuilder otb = new OntologyTreeBuilder();

            otb.context = Parser.ContextGlobal["words"];

            cont = new opis("context");
            cont.PartitionName = "context";
            cont.Vset("level", "topBranch");
            cont.Vset(context.Higher, "none");
            cont.Vset(context.Organizer, "контекстречення");

            foreach (string term in sentenceParts)
            {
                otb.buildTree(otb.context.Find(term), cont);
            }

            cont[OntologyTreeBuilder.globalcomm] = new opisEventsSubscription();

            otb.initInstances(cont);

            otb.contextToIgnite = cont;
            otb.igniteTree();


            return(cont);
        }
Ejemplo n.º 2
0
        public opis CodenotionScript(string specName, string sysName, string method, opis param)
        {
            var methodRun = CreateMethodMessage(sysName, method, param);

            lock (scriptLocker)
            {
                if (ScriptContext == null)
                {
                    OntologyTreeBuilder tpb = new OntologyTreeBuilder();
                    tpb.context = Parser.ContextGlobal["words"];

                    opis o = new opis("context");
                    o.PartitionName = "context";
                    o.Vset("level", "topBranch");
                    o.Vset(context.Higher, "none");
                    o.Vset(context.Organizer, "контекстречення");

                    tpb.buildTree(tpb.context.Find(specName), o);

                    opis currContext = o;
                    currContext["globalcomm"] = new opisEventsSubscription();

                    var vmsg = CreateMethodMessage(sysName, "version");

                    tpb.messagesToSend = new opis();
                    tpb.messagesToSend.AddArr(vmsg);

                    tpb.initInstances(currContext);

                    #if NETFRAMEWORK
                    if (SysInstance.Log != null)
                    {
                        SysInstance.Log.Clear();
                    }
                    #endif

                    tpb.contextToIgnite = currContext;
                    tpb.igniteTree();

                    ScriptContext = currContext;
                    //AddAnalytic(222, "Init new ScriptContext ", specName, vmsg["p"].serialize(), "");
                    ScriptContext["globalcomm"][sysName] = methodRun;
                }
                else
                {
                    try
                    {
                        ScriptContext["globalcomm"][sysName] = methodRun;
                    }
                    catch (Exception e)
                    {
                        //AddAnalytic(222, "Exception running ScriptContext " + e.StackTrace, specName, methodRun.serialize(), e.Message);
                    }
                }
            }

            return(methodRun["p"]);
        }
Ejemplo n.º 3
0
        public static bool NotionTreeLinearOntoContainsTerm(opis nt, opis term)
        {
            var  forms = OntologyTreeBuilder.Forms(term);
            bool found = false;

            nt.RunRecursively(x => { found = found || ContainNonPrefixedSuffixed(x.body, forms); });

            return(found);
        }
Ejemplo n.º 4
0
        public static bool NotionTreeContainsTerm(opis nt, opis term)
        {
            var  forms = OntologyTreeBuilder.Forms(term);
            bool found = false;

            nt.RunRecursively(x => { found = found || forms.Contains(x.PartitionName); });

            return(found);
        }
Ejemplo n.º 5
0
        public opis SendMsg(string term, string method, opis param = null)
        {
            var    t             = Parser.ContextGlobal["words"].Find(term);
            string receiverClass = t.V(ModelNotion.intellection);

            receiverClass = OntologyTreeBuilder.isMetaTerm(receiverClass) ? term : receiverClass;

            var message = receiverClass == term?CreateMethodMessage(receiverClass, method, param)
                              : CreateMethodMessage(receiverClass, term, method, param);

            return(SendMsg(receiverClass, message));
        }
Ejemplo n.º 6
0
        public static void DeCompressWords()
        {
            var words    = ContextGlobal["words"];
            var sentence = words.Find("sentence_context");

            if (!sentence.isInitlze)
            {
                return;
            }

            if (sentence.isHere("compress words"))
            {
                for (int i = 0; i < words.listCou; i++)
                {
                    OntologyTreeBuilder.DecompressTerm(words[i]);
                }
            }
        }