public wordnetSymsetResults query_srb_symset(List <String> symsetCodes, ILogBuilder response)
        {
            wordnetSymsetResults output = new wordnetSymsetResults();

            getReady();

            List <DataRow> matches = new List <DataRow>();

            foreach (String code in symsetCodes)
            {
                matches.AddRangeUnique(table.Select(SRB_COLUMN_CODE + " = '" + code + "'"));
            }


            foreach (DataRow dr in matches)
            {
                String srb  = dr[SRB_COLUMN_TOKEN].toStringSafe();
                String code = dr[SRB_COLUMN_CODE].toStringSafe();
                output.Add(code, srb);
            }

            if (response != null)
            {
                response.log("wordnet_srb_symset(" + symsetCodes.Join(',') + ") = rows[" + matches.Count + "] => words[" + output.GetEnglish().Count + "]");
            }

            return(output);
        }
        public wordnetSymsetResults query_srb(List <String> srb_tokens, ILogBuilder response, Boolean buildModel = true)
        {
            wordnetSymsetResults output = new wordnetSymsetResults();

            getReady();

            List <DataRow> matches = new List <DataRow>();

            foreach (String tkn in srb_tokens)
            {
                matches.AddRangeUnique(table.Select(SRB_COLUMN_TOKEN + " LIKE '" + tkn + "'"));
            }

            foreach (DataRow dr in matches)
            {
                String eng  = dr[SRB_COLUMN_TOKEN].toStringSafe();
                String code = dr[SRB_COLUMN_CODE].toStringSafe();
                output.Add(code, eng);
            }

            if (buildModel)
            {
                foreach (var pair in output)
                {
                    termExploreModel md  = null;
                    String           srb = pair.Key;
                    if (!output.models.ContainsKey(srb))
                    {
                        md = new termExploreModel(srb);



                        output.models.Add(srb, md);
                    }
                    else
                    {
                        md = output.models[srb];
                    }

                    String   symc = pair.Value[0].ToString();
                    pos_type pt   = posConverter.wordNetFirstNumToPosType.getValue(symc, pos_type.none);

                    gramFlags gr = new gramFlags();
                    gr.Set(pt);
                    md.gramSet.Add(gr);

                    md.wordnetPrimarySymsets.AddUnique(pair.Value);
                }
            }


            return(output);
        }
        /// <summary>
        /// Queries Wordnet_eng codes by words/tokens/lemmas. This should be used before <see cref="query_eng_symset(List{string}, imbSCI.Core.interfaces.ILogBuilder)"/>
        /// </summary>
        /// <param name="eng_tokens">The eng tokens.</param>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public wordnetSymsetResults query_eng(List <String> eng_tokens, ILogBuilder response)
        {
            //List<symsetSpark> output = new List<symsetSpark>();
            wordnetSymsetResults output = new wordnetSymsetResults();

            if (!isEngWordNetReady)
            {
                prepare_eng(response);
            }

            List <DataRow> matches = new List <DataRow>();

            foreach (DataTable dt in wordnet_eng.Tables)
            {
                DataColumn wColumn = dt.Columns[0];
                wColumn.ColumnName = "wCol";
                foreach (String tkn in eng_tokens)
                {
                    matches.AddRangeUnique(dt.Select(wColumn.ColumnName + " LIKE '" + tkn + "'"));
                }
            }

            if (response != null)
            {
                response.log("wordnet_eng(" + eng_tokens.Join(',') + ") = rows[" + matches.Count() + "]");
            }

            foreach (DataRow dr in matches)
            {
                DataColumn wColumn = dr.Table.Columns[0];
                DataColumn cColumn = dr.Table.Columns[1];
                String     eng     = dr[wColumn].toStringSafe();
                String     code    = dr[cColumn].toStringSafe();
                output.Add(code, eng);
            }

            if (response != null)
            {
                response.log("wordnet_eng(" + eng_tokens.Join(',') + ") = rows[" + matches.Count() + "] => token-symset[" + output.Count + "]");
            }

            return(output);
        }
        /// <summary>
        /// Returns words matchin symset codes
        /// </summary>
        /// <param name="symsetCodes">The symset codes.</param>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public wordnetSymsetResults query_eng_symset(List <String> symsetCodes, ILogBuilder response)
        {
            wordnetSymsetResults output = new wordnetSymsetResults();

            if (!isEngWordNetReady)
            {
                prepare_eng(response);
            }

            List <DataRow> matches = new List <DataRow>();

            foreach (DataTable dt in wordnet_eng.Tables)
            {
                DataColumn cColumn = dt.Columns[1];
                cColumn.ColumnName = "cCol";
                foreach (String code in symsetCodes)
                {
                    matches.AddRangeUnique(dt.Select(cColumn.ColumnName + " = '" + code + "'"));
                }
            }

            foreach (DataRow dr in matches)
            {
                DataColumn wColumn = dr.Table.Columns[0];
                wColumn.ColumnName = "wCol";
                DataColumn cColumn = dr.Table.Columns[1];
                cColumn.ColumnName = "cCol";
                String eng  = dr[wColumn].toStringSafe();
                String code = dr[cColumn].toStringSafe();
                output.Add(code, eng);
            }

            if (response != null)
            {
                response.log("wordnet_eng_symset(" + symsetCodes.Join(',') + ") = rows[" + matches.Count + "] => words[" + output.GetEnglish().Count + "]");
            }

            return(output);
        }
        /// <summary>
        /// Queries apropriate wordnet database according to graph node type.
        /// </summary>
        /// <param name="graph">The graph.</param>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public tokenGraphNode queryWithGraph(tokenGraphNode graph, ILogBuilder response, WordnetSource wn_type = WordnetSource.none, WordnetQueryType wn_qtype = WordnetQueryType.none)
        {
            resolve(graph, ref wn_type, ref wn_qtype);


            if (graph.Count() == 0)
            {
                return(graph);
            }

            List <IObjectWithPathAndChildren> leafs = graph.getAllLeafs();
            var tokens = leafs.getNames();

            wordnetSymsetResults res = null;

            switch (wn_type)
            {
            case WordnetSource.english:


                if (wn_qtype == WordnetQueryType.getSymsetCodesByWord)
                {
                    res = query_eng(tokens, response);
                    foreach (tokenGraphNode node in leafs)
                    {
                        node.AddValueMatches(res, tokenGraphNodeType.symset_code);
                    }
                    //graph.AddKeyValueChildren(res, tokenGraphNodeType.word_eng, tokenGraphNodeType.symset_code, true);
                }
                else
                {
                    res = query_eng_symset(tokens, response);
                    foreach (tokenGraphNode node in leafs)
                    {
                        node.AddKeyMatches(res, tokenGraphNodeType.word_eng);
                    }
                    //graph.AddKeyValueChildren(res, tokenGraphNodeType.symset_code, tokenGraphNodeType.word_eng);
                }
                break;

            case WordnetSource.serbian:
                if (wn_qtype == WordnetQueryType.getSymsetCodesByWord)
                {
                    res = query_srb(tokens, response);
                    foreach (tokenGraphNode node in leafs)
                    {
                        node.AddValueMatches(res, tokenGraphNodeType.symset_code);
                    }
                    //graph.AddKeyValueChildren(res, tokenGraphNodeType.word_srb, tokenGraphNodeType.symset_code, true);
                }
                else
                {
                    res = query_srb_symset(tokens, response);
                    foreach (tokenGraphNode node in leafs)
                    {
                        node.AddKeyMatches(res, tokenGraphNodeType.word_srb);
                    }
                    //graph.AddKeyValueChildren(res, tokenGraphNodeType.symset_code, tokenGraphNodeType.word_srb);
                }
                break;
            }

            ////var tokens = graph.getChildTokens();

            //switch (childType)
            //{
            //    case tokenGraphNodeType.symset_code:
            //        if (parentType == tokenGraphNodeType.word_srb)
            //        {
            //            var synonimres = query_srb_symset(tokens, response);
            //            graph.AddKeyValueChildren(synonimres, tokenGraphNodeType.symset_code, tokenGraphNodeType.word_srb, true);
            //        } else
            //        {
            //            var synonimres = query_eng_symset(tokens, response);
            //            graph.AddKeyValueChildren(synonimres, tokenGraphNodeType.symset_code, tokenGraphNodeType.word_eng, true);
            //        }
            //        break;
            //    case tokenGraphNodeType.word_eng:
            //    case tokenGraphNodeType.word_query:
            //        var coderes = query_eng(tokens, response);
            //        graph.AddKeyValueChildren(coderes, tokenGraphNodeType.word_eng, tokenGraphNodeType.symset_code, true);
            //        break;
            //    case tokenGraphNodeType.word_srb:
            //        var codesrbres = query_srb(tokens, response);
            //        graph.AddKeyValueChildren(codesrbres, tokenGraphNodeType.word_srb, tokenGraphNodeType.symset_code, true);
            //        break;
            //}

            return(graph);
        }