예제 #1
0
        /// <summary>
        /// Executes the meta object
        /// </summary>
        /// <seealso cref="aceOperationArgs"/>
        /// <returns></returns>
        public String executeMeta()
        {
            String output = "";

            if (metaObject is aceOperationArgs)
            {
                aceOperationArgs marg = metaObject as aceOperationArgs;

                /*
                 * if (inputLine != "")
                 * {
                 *  marg.paramSet.addFromString(inputLine);
                 * }*/

                Object[] array = marg.getInvokeArray();

                if (marg.method != null)
                {
                    marg.method.Invoke(marg.executor, array);
                }

                output = "";
            }
            else
            {
                output = String.Format("metaObject[{0}] type is not supported yet ", metaObject.GetType().Name);
            }

            return(output);
        }
예제 #2
0
        /// <summary>
        /// Method of menu option PreloadLexicon (key:preloadLexicon). <args> expects param: word:String;steps:Int32;debug:Boolean;
        /// </summary>
        /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  word:String;steps:Int32;debug:Boolean;</param>
        /// <remarks>
        /// <para>Loads all Lemma and Instances from triplestore into memory and indexed dictionaries</para>
        /// <para>Performs the Lexicon preload to increase performances of the semantic components</para>
        /// <para>Message if item disabled: (disabled)</para>
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_runPreloadLexicon(aceOperationArgs args)
        {
            DateTime start = DateTime.Now; output.getLastLine();

            semanticLexiconManager.lexiconCache.preloadLexicon(response, semanticLexiconManager.manager.lexiconContext);


            output.AppendLine("PreloadLexicon done in: " + DateTime.Now.Subtract(start).TotalMinutes.ToString("#0.0##") + " min");
            output.getLastLine().saveStringToFile("preloadLexicon_record.txt");
        }
예제 #3
0
        /// <summary>
        /// Method of menu option sampleByIndexPage (key:SIP). <args> expects param: evaluationState:indexPageEvaluationEntryState;limit:Int32;skip:Int32;
        /// </summary>
        /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  evaluationState:indexPageEvaluationEntryState;limit:Int32;skip:Int32;</param>
        /// <remarks>
        /// <para>It will select all pages that reflect the specified criterion and put their domains into current sample list</para>
        /// <para>Selects the sample set from the index database accorting to specified indexPageEvaluationEntryState</para>
        /// <para>Message if item disabled: (disabled)</para>
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_definesampleByIndexPage(aceOperationArgs args)
        {
            var           assert = imbWEMManager.index.domainIndexTable.GetDomainIndexAssertion(null, true);
            List <string> l      = assert[indexDomainContentEnum.indexed];


            state.sampleList = new webSiteSimpleSample();
            state.sampleList.Add(imbWEMManager.index.domainIndexTable.GetDomains(l));



            //workspace.sampleAcceptAndPrepare(null, true, null, args.Get<Int32>("limit"), args.Get<Int32>("skip"), indexDomainContentEnum.none, args.Get<indexPageEvaluationEntryState>("evaluationState"));
        }
        public void saveOpLog(aceOperationArgs args)
        {
            String output = "Time: " + DateTime.Now.ToString();

            output = output.addLine(args.paramSet.ToString());
            output = output.addLine("-- RESPONSE --");
            output = output.addLine(console.output.getLastLine());
            output = output.addLine("-- RESPONSE --");
            output = output.addLine(console.response.getLastLine());

            String path = folder[aceCCFolders.logs].pathFor("Operation_" + args.method.Name + "_log".add("md", "."));

            output.saveStringToFile(path, getWritableFileMode.autoRenameExistingOnOtherDate);
        }
예제 #5
0
        /// <summary>
        /// Method of menu option CrawlerComment (key:crawlerComment). <args> expects param: comment:String;signatureSufix:String;appendSufix:Boolean;
        /// </summary>
        /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  comment:String;signatureSufix:String;appendSufix:Boolean;</param>
        /// <remarks>
        /// <para>It will add comment line into crawler settings and set signature sufix that is used for experiment session crawler signature</para>
        /// <para>Use this command to add text about specific customizations made to the crawler instance</para>
        /// <para>Message if item disabled: (disabled)</para>
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_configCrawlerComment(aceOperationArgs args)
        {
            string comment        = args.Get <string>("comment");
            string signatureSufix = args.Get <string>("signatureSufix");
            bool   appendSufix    = args.Get <bool>("appendSufix");

            response.log("CrawlerComment with comment=" + comment + ", signatureSufix =" + signatureSufix + ", appendSufix=" + appendSufix + ".");

            state.crawler.settings.Comment = state.crawler.settings.Comment.addLine(comment);
            if (appendSufix)
            {
                state.crawler.settings.SignatureSufix = state.crawler.settings.SignatureSufix.add(signatureSufix, "|");
            }
            else
            {
                state.crawler.settings.SignatureSufix = signatureSufix;
            }
        }
예제 #6
0
        /// <summary>
        /// Method of menu option CrawlerSet (key:crawlerSet). <args> expects param: par:String;newValue:Double;debug:Boolean;
        /// </summary>
        /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  par:String;newValue:Double;debug:Boolean;</param>
        /// <remarks>
        /// <para>It will pharse the parameters and change crawler configuration from default settings to specified ones</para>
        /// <para>Use this command to change configuration of the current crawler</para>
        /// <para>Message if item disabled: (disabled)</para>
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_configCrawlerSet(aceOperationArgs args)
        {
            string par           = args.Get <string>("par");
            double newValue      = args.Get <double>("newValue");
            bool   appendComment = args.Get <bool>("appendComment");

            bool changed = false;

            if (state.crawler == null)
            {
                response.log("No current crawler specified");
            }

            var pi = state.crawler.getProperty(par);

            if (pi == null)
            {
                response.log("ERROR: Parameter [" + par + "] not found at crawler [" + state.crawler.name + "]");
            }
            else
            {
                double oldValue = state.crawler.imbGetPropertySafe(par, 0).imbConvertValueSafeTyped <double>();
                state.crawler.imbSetPropertyConvertSafe(pi, newValue);

                double curValue = state.crawler.imbGetPropertySafe <double>(pi);

                changed = (newValue != curValue);

                if (changed)
                {
                    response.log("Parameter [" + par + $"] not changed [old:{oldValue}] [in:{newValue}] [final:{curValue}] {state.crawler.name}");
                }
                else
                {
                    response.log($"Parameter [{par}] changed from {oldValue} to {newValue} at crawler [{state.crawler.name}]");
                    state.crawler.settings.Comment        = state.crawler.settings.Comment.addLine($"[{par}] set to: {newValue}  (def: {oldValue})");
                    state.crawler.settings.SignatureSufix = state.crawler.settings.SignatureSufix.add($"{par}{newValue}", "|");
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Populates menu with provided <c>executor</c>
        /// </summary>
        /// <param name="executor">The executor: Console or Screen that performs operations</param>
        /// <param name="component">The specific component that is related to the execution of this menu</param>
        public void setItems(aceOperationSetExecutorBase executor, IAceComponent component = null, BindingFlags binding = BindingFlags.Public | BindingFlags.Instance)
        {
            var executorType = executor.GetType();

            MethodInfo[] __methods = executorType.GetMethods(binding);
            foreach (var __m in __methods)
            {
                if (__m.Name.StartsWith(aceMenuItemMeta.METHOD_PREFIX))
                {
                    aceMenuItem item        = new aceMenuItem();
                    var         args        = new aceOperationArgs(executor, this, item, __m, component);
                    String      displayName = __m.Name.removeStartsWith(aceMenuItemMeta.METHOD_PREFIX);

                    item.itemName = displayName.removeStartsWith(args.methodInfo.categoryName);

                    item.metaObject = args;
                    item.index      = Count;
                    //item.group = ;
                    Add(item);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Method of menu option pageIndex (key:pageIndex). <args> expects param: operation:indexPageTableOperation;sourceFile:String;debug:Boolean;
        /// </summary>
        /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  operation:indexPageTableOperation;sourceFile:String;debug:Boolean;</param>
        /// <remarks>
        /// <para>It will propt for secondary command if not specified by parameters</para>
        /// <para>Performs management operations over page index data table</para>
        /// <para>Message if item disabled: (disabled)</para>
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_runpageIndex(aceOperationArgs args)

        {
            indexPageTableOperation operation = args.Get <indexPageTableOperation>("operation");

            string sourceFile = args.Get <string>("sourceFile");
            bool   ok         = false;
            string sufix      = "";

            if (state.sampleList.Any())
            {
                sufix = " (Active sample: " + state.sampleList.Count + ")";
            }
            if (operation == indexPageTableOperation.none)
            {
                operation = aceTerminalInput.askForEnum <indexPageTableOperation>("Select indexPage operation to perform", indexPageTableOperation.none);
            }
            if (operation == indexPageTableOperation.loadReviewedTable)
            {
                if (!File.Exists(imbWEMManager.index.folder.pathFor(sourceFile)))
                {
                    var files = imbWEMManager.index.folder.findFiles("*.xlsx|*.csv", SearchOption.TopDirectoryOnly, true);
                    sourceFile = aceTerminalInput.askForOption("Select data table file for operation: " + operation.ToString() + "", files.First(), files, null).toStringSafe();
                }

                ok = File.Exists(imbWEMManager.index.folder.pathFor(sourceFile));
            }
            else
            {
                ok = aceTerminalInput.askYesNo("Are you sure to: " + operation.ToString() + "? " + sufix, false);
            }

            if (ok)
            {
                imbWEMManager.index.ExecuteIndexPageOperation(operation, sourceFile, state.sampleList, output);
            }
        }
예제 #9
0
 /// <summary>
 /// Method of menu option ImportSample (key:importSample). <args> expects param: word:String;steps:Int32;debug:Boolean;
 /// </summary>
 /// <param name="args"><seealso cref="aceOperationArgs"/> requered parameters:  word:String;steps:Int32;debug:Boolean;</param>
 /// <remarks>
 /// <para>It loads specified txt file found in the console project and loads domains specified there into state sample list</para>
 /// <para>Importing domain sample list from txt file</para>
 /// <para>Message if item disabled: (disabled)</para>
 /// </remarks>
 /// <seealso cref="aceOperationSetExecutorBase"/>
 public void aceOperation_defineImportSample(aceOperationArgs args)
 {
     workspace.sampleAcceptAndPrepare(args.Get <string>("filename"), args.Get <bool>("fileHasPriority"), args.Get <string>("group_tags"), args.Get <int>("limit"), args.Get <int>("skip"), indexDomainContentEnum.none, indexPageEvaluationEntryState.none, args.Get <string>("samplename"));
 }