Exemplo n.º 1
0
        private void connectionSelectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.connectionSelectionView.SelectedIndex == -1)
            {
                return;
            }                                                                // do nothing at all. the selection was invalid.
            else
            {
                // add the new path and the related stuff.
                OntologyPath pt     = ((ListViewPathEntry)this.connectionSelectionView.SelectedItem).Path;
                Node         anchor = ((ListViewPathEntry)this.connectionSelectionView.SelectedItem).Anchor;

                Node nodeAdded = this.queryNodeGroup.AddPath(pt, anchor, this.oInfo);
                this.nodegroupCanvas.CheckNodeAdded();

                Debug.WriteLine("Using anchor (" + anchor.GetSparqlID() + ") to add new node on path (" + pt.GenerateUserPathString(anchor, false) + "). ");
                this.PathFlyout.Hide();
                this.AnchorFlyout.Hide();

                // show all the nodes now in the query nodeGroup
                Debug.WriteLine("Nodes currently in the nodeGroup:");
                foreach (Node curr in this.queryNodeGroup.GetNodeList())
                {
                    Debug.WriteLine(curr.GetSparqlID() + " (" + curr.GetFullUriName() + ")");
                }
            }
        }
Exemplo n.º 2
0
        public KeywordListData GetKeywordsListData()
        {
            // Synonyms and keywords
            var tmpsyndoc = HdSearchOntologyHelper.ReadOntologySynonymsXmlFile();

            keywordsList = new SortedSet <string>();
            var synonyms = new ArrayOfOntologyPath();
            var root     = tmpsyndoc.DocumentElement;

            foreach (XmlElement elem in root.ChildNodes)
            {
                var ontoPath = new OntologyPath();
                foreach (XmlElement child in elem.ChildNodes)
                {
                    if (child.Name == "conceptID")
                    {
                        int conceptID;
                        if (Int32.TryParse(child.InnerText, out conceptID))
                        {
                            ontoPath.ConceptID = conceptID;
                        }
                    }
                    else if (child.Name == "ConceptName")
                    {
                        ontoPath.ConceptName = child.InnerText;
                    }
                    else if (child.Name == "ConceptPath")
                    {
                        ontoPath.ConceptPath = child.InnerText;
                    }
                    else if (child.Name == "SearchableKeyword")
                    {
                        ontoPath.SearchableKeyword = child.InnerText;
                    }
                }
                synonyms.Add(ontoPath);
                keywordsList.Add(ontoPath.SearchableKeyword);
            }

            // Ontology tree
            var tree      = new OntologyTree();
            var tmpxmldoc = HdSearchOntologyHelper.ReadOntologyXmlFile();

            FillTree(tmpxmldoc.DocumentElement, tree.Nodes);

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

            return(result);
        }
 public void AddNewPath(OntologyPath op)
 {
     this.PathList.Add(op);
 }
Exemplo n.º 4
0
        public OntologyDesc GetOntologyDesc()
        {
            // Synonyms and keywords
            var tmpsyndoc = ReadOntologySynonymsXmlFile();

            keywordsList = new SortedSet <string>();
            var synonyms = new List <OntologyPath>();
            var root     = tmpsyndoc.DocumentElement;

            foreach (XmlElement elem in root.ChildNodes)
            {
                var ontoPath = new OntologyPath();
                foreach (XmlElement child in elem.ChildNodes)
                {
                    var text = child.InnerText.Trim();
                    if (child.Name == "conceptID")
                    {
                        int conceptID;
                        if (Int32.TryParse(text, out conceptID))
                        {
                            ontoPath.ConceptID = conceptID;
                        }
                    }
                    else if (child.Name == "ConceptName")
                    {
                        ontoPath.ConceptName = text;
                    }
                    else if (child.Name == "ConceptPath")
                    {
                        ontoPath.ConceptPath = text;
                    }
                    else if (child.Name == "SearchableKeyword")
                    {
                        ontoPath.SearchableKeyword = text;
                    }
                }
                // Add to sysnonyms, only if SearchableKeyword != ConceptName
                if (!string.Equals(ontoPath.SearchableKeyword, ontoPath.ConceptName) &&
                    !string.IsNullOrEmpty(ontoPath.SearchableKeyword))
                {
                    synonyms.Add(ontoPath);
                }
                if (!String.IsNullOrWhiteSpace(ontoPath.SearchableKeyword))
                {
                    keywordsList.Add(ontoPath.SearchableKeyword);
                }
            }

            // Ontology tree
            var tree      = new OntologyTree();
            var tmpxmldoc = ReadOntologyXmlFile();

            FillTree(tmpxmldoc.DocumentElement, tree.Nodes);

            // Replace Hydroshpere with All
            keywordsList.Remove("Hydrosphere");
            keywordsList.Add(Constants.RootName);
            if (tree.Nodes.Count > 0)
            {
                tree.Nodes[0].Text = Constants.RootName;
            }

            // Return result
            var result = new OntologyDesc
            {
                OntoloyTree = tree,
                Keywords    = keywordsList,
                Synonyms    = synonyms,
            };

            return(result);
        }
Exemplo n.º 5
0
 public ListViewPathEntry(OntologyPath path, Node anchor)
 {
     this.PathAsString = path.GenerateUserPathString(anchor, false);
     this.Path         = path;
     this.Anchor       = anchor;
 }