Esempio n. 1
0
 public Property(Concept concept, string name, Concept inheritedFrom)
 {
     this.Concept       = concept;
     this.name          = name;
     this.inheritedFrom = inheritedFrom;
     Fillers            = new FillerList();
 }
Esempio n. 2
0
        public FillerList Copy(Property Pro, Concept con)
        {
            FillerList newlist = new FillerList();
            ArrayList  arr     = new ArrayList();

            foreach (Filler f in this.fillers)
            {
                arr.Add(f.Copy(Pro, con));
            }
            newlist.fillers = arr;
            return(newlist);
        }
Esempio n. 3
0
 void FillGraph()
 {
     //Graph = new Dictionary<string, Vertex>();//
     //onto = new Ontology(OntologyConceptsEditor.projectData.path);
     //StreamReader sr = new StreamReader(OntologyConceptsEditor.projectData.path + @"\Get.txt");
     //string str = null;
     //int x = 0;
     //while ((str = sr.ReadLine()) != null)
     //{
     //    //if (++x < 1000)
     //    {
     //        if (str == "")
     //            continue;
     //        onto.LoadConcept(str);
     //        this.Graph.Add(str, new Vertex(str));
     //        //cmbConceptNames.Items.Add(str);
     //        //cmbFirstConcept.Items.Add(str);
     //        //cmbSecondConcept.Items.Add(str);
     //    }
     //}
     //sr.Close();
     foreach (Concept c in onto)
     {
         PropertiesDictionary pd = c.FullProperties;
         int n = 0;
         foreach (Property de in pd.Properties)
         {
             OntologyLibrary.OntoSem.FillerList OF = de.Fillers;
             List <TreeNode> ch = new List <TreeNode>();
             foreach (Filler Ofiller in OF)
             {
                 if (Ofiller.ConceptFiller != null)
                 {
                     if (de.Name == "SUBCLASSES")
                     {
                         //Graph[c.Name].Edges = new List<Relation>();
                         //Graph[Ofiller.ConceptFiller.Name].Edges = new List<Relation>();
                         Graph[c.Name].Edges.Add(new Relation(Graph[c.Name], Graph[Ofiller.ConceptFiller.Name], RelationType.SubClass));
                         Graph[Ofiller.ConceptFiller.Name].Edges.Add(new Relation(Graph[Ofiller.ConceptFiller.Name], Graph[c.Name], RelationType.InheritedFrom));
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
        private void GetData(string zzz)
        {
            richTextBox1.Text = "";
            onto.LoadConcept(zzz);
            Concept c = onto[zzz];
            PropertiesDictionary pd = c.FullProperties;

            foreach (Property de in pd.Properties)
            {
                OntologyLibrary.OntoSem.FillerList OF = de.Fillers;
                foreach (Filler Ofiller in OF)
                {
                    if (Ofiller.ConceptFiller != null)
                    {
                        richTextBox1.Text += de.Name + "   =   " + Ofiller.ConceptFiller.Name + "\n";
                    }
                }
            }
        }
Esempio n. 5
0
        public void Fill(TreeNode t)
        {
            Concept c = onto[t.Text];
            PropertiesDictionary pd = c.FullProperties;

            foreach (Property de in pd.Properties)
            {
                OntologyLibrary.OntoSem.FillerList OF = de.Fillers;
                List <TreeNode> ch = new List <TreeNode>();
                foreach (Filler Ofiller in OF)
                {
                    if (de.Name == "SUBCLASSES" && Ofiller.ConceptFiller != null)
                    {
                        t.Nodes.Add(new TreeNode(Ofiller.ConceptFiller.Name));
                    }
                }
            }
            for (int i = 0; i < t.Nodes.Count; i++)
            {
                Fill(t.Nodes[i]);
            }
        }
Esempio n. 6
0
        private void btnFillTree_Click(object sender, EventArgs e)
        {
            nodes.Add(new TreeNode("ALL"));
            lst.Enqueue("ALL");
            int n     = lst.Count;
            int index = 0;

            for (int i = 0; i < n; i++)
            {
                string str = lst.Dequeue();
                n--;
                Concept c = onto[str];

                PropertiesDictionary pd = c.FullProperties;

                foreach (Property de in pd.Properties)
                {
                    OntologyLibrary.OntoSem.FillerList OF = de.Fillers;

                    foreach (Filler Ofiller in OF)
                    {
                        if (de.Name == "IS-A" && Ofiller.ConceptFiller != null)
                        {
                            TreeNode tn = new TreeNode(Ofiller.ConceptFiller.Name);
                            int      k  = 0;
                            foreach (TreeNode _n in nodes)
                            {
                                if (_n.Text == tn.Text)
                                {
                                    index = k;//nodes.IndexOf(tn);
                                    goto l;
                                }
                                k++;
                            }
                            //if (nodes.Contains(tn.Text))
                            //{

                            //}
                        }
l:
                        if (de.Name == "SUBCLASSES" && Ofiller.ConceptFiller != null)
                        {
                            //all.Nodes.Add(Ofiller.ConceptFiller.Name);
                            nodes.Add(new TreeNode(Ofiller.ConceptFiller.Name));
                            nodes[index].Nodes.Add(new TreeNode(Ofiller.ConceptFiller.Name));
                            lst.Enqueue(Ofiller.ConceptFiller.Name);
                            n++;
                            //treeView1.Nodes.Add(nodes[nodes.Count - 1]);
                            //richTextBox1.Text += de.Name + "   =   " + Ofiller.ConceptFiller.Name + "\n";
                            //treeView1.Nodes.Add(new TreeNode(
                        }
                    }
                }
            }
            //lb1:
            treeView1.Nodes.Add(nodes[0]);
            #region
            //foreach (Concept c in onto)
            //{
            //    PropertiesDictionary pd=c.FullProperties;

            //foreach (Property de in pd.Properties)
            //{
            //    OntologyLibrary.OntoSem.FillerList OF = de.Fillers;
            //    foreach (Filler Ofiller in OF)
            //    {
            //        if (de.Name == "SUBCLASSES" && Ofiller.ConceptFiller!=null)
            //        {
            //            //all.Nodes.Add(Ofiller.ConceptFiller.Name);
            //            nodes.Add(new TreeNode(Ofiller.ConceptFiller.Name));
            //            //richTextBox1.Text += de.Name + "   =   " + Ofiller.ConceptFiller.Name + "\n";
            //            //treeView1.Nodes.Add(new TreeNode(
            //        }
            //    }

            //}
            //foreach (Property de in pd.Properties)
            //{
            //    OntologyLibrary.OntoSem.FillerList OF = de.Fillers;
            //    foreach (Filler Ofiller in OF)
            //    {
            //        if (de.Name == "IS-A" && Ofiller.ConceptFiller!=null)
            //        {
            //            TreeNode tn=new TreeNode(Ofiller.ConceptFiller.Name);
            //            if(nodes.Contains(tn))
            //            {
            //            int index = nodes.IndexOf(tn);
            //            nodes[index].Nodes.Add(c.Name);
            //            }
            //        }
            //    }

            //}
            //foreach (TreeNode  node in nodes)
            //{
            //    if(!treeView1.Nodes.Contains(node))
            //    treeView1.Nodes.Add(node);
            //}
            //}
            #endregion
        }