Esempio n. 1
0
        public OntologyDesc GetOntologyDesc()
        {
            // Keywords
            var searcher     = new MetadataCacheSearcher();
            var keywordsList = searcher.GetKeywords();

            keywordsList.Add(Constants.RootName);
            var sortedKeywords = new SortedSet <string>(keywordsList);

            // Ontology tree
            var tree       = new OntologyTree();
            var parentNode = new OntologyNode(Constants.RootName);

            foreach (var keyword in keywordsList.Where(keyword => keyword != Constants.RootName))
            {
                parentNode.Nodes.Add(new OntologyNode(keyword));
            }
            tree.Nodes.Add(parentNode);

            // Return result
            var result = new OntologyDesc
            {
                Keywords    = sortedKeywords,
                OntoloyTree = tree,
            };

            return(result);
        }
Esempio n. 2
0
        public KeywordListData GetKeywordsListData()
        {
            // Keywords
            var searcher     = new MetadataCacheSearcher();
            var keywordsList = searcher.GetKeywords();

            keywordsList.Add("Hydrosphere");
            var sortedKeywords = new SortedSet <string>(keywordsList);

            // Ontology tree
            var tree       = new OntologyTree();
            var parentNode = new OntologyNode("Hydrosphere");

            foreach (var keyword in keywordsList.Where(keyword => keyword != "Hydrosphere"))
            {
                parentNode.Nodes.Add(new OntologyNode(keyword));
            }
            tree.Nodes.Add(parentNode);

            //------
            var result = new KeywordListData
            {
                Keywords    = sortedKeywords.ToList(),
                OntoloyTree = tree,
            };

            return(result);
        }
        public void GetKeywordsAndOntology(out IList <string> keywords, out OntologyTree ontoloyTree)
        {
            // Keywords
            var searcher     = new MetadataCacheSearcher();
            var keywordsList = searcher.GetKeywords();

            keywordsList.Add("Hydrosphere");
            var sortedKeywords = new SortedSet <string>(keywordsList);

            // Ontology tree
            var tree       = new OntologyTree();
            var parentNode = new OntologyNode("Hydrosphere");

            foreach (var keyword in keywordsList.Where(keyword => keyword != "Hydrosphere"))
            {
                parentNode.Nodes.Add(new OntologyNode(keyword));
            }
            tree.Nodes.Add(parentNode);

            //------
            keywords    = sortedKeywords.ToList();
            ontoloyTree = tree;
        }