Esempio n. 1
0
 private void btnLoad_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         helper = new MindMapOntology(openFileDialog1.FileName);
         //MindMapConcept c1 = helper.Concepts["READ"];
         //MindMapConcept c2 = helper.Concepts["GOLF"];
         //DistanceInfo info = MindMapConcept.Distance(c1, c2);
         //MessageBox.Show(info.Distance.ToString());
         foreach (string conceptName in helper.Concepts.Keys)
         {
             this.lboxChildren.Items.Add(conceptName);
         }
         MyWordInfo word = new MyWordInfo("accomplishment", PartsOfSpeech.Noun);
         word.Sense = 1;
         MindMapConcept concept = MindMapMapper.GetConcept(word, helper);
         if (concept == null)
         {
             MessageBox.Show("Test");
         }
         else
         {
             MessageBox.Show(concept.Name);
         }
     }
 }
Esempio n. 2
0
 List <string> CreateCombination(string path, MindMapConcept concept, int PropertyIndex, List <string> previous, List <string> visualProperties)
 {
     if (PropertyIndex == visualProperties.Count)
     {
         if (previous.Count == 0)
         {
             return(new List <string>(new string[] { concept.Name }));
         }
         List <string> adjOrder = new List <string>(previous);
         adjOrder.Sort();
         string fileName = adjOrder[0];
         for (int i = 1; i < adjOrder.Count; i++)
         {
             fileName += " " + adjOrder[i];
         }
         return(new List <string>(new string[] { fileName }));
     }
     else
     {
         List <string> result = new List <string>();
         result.AddRange(CreateCombination(path, concept, PropertyIndex + 1, previous, visualProperties));
         for (int i = 0; i < concept.VisualProperties[visualProperties[PropertyIndex]].Count; i++)
         {
             previous.Add(concept.VisualProperties[visualProperties[PropertyIndex]][i]);
             result.AddRange(CreateCombination(path, concept, PropertyIndex + 1, previous, visualProperties));
             previous.RemoveAt(previous.Count - 1);
         }
         return(result);
     }
 }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>
        /// Returns Distance Info That Contains -->
        /// int Distance between C1 & C2
        /// Distance = c1ToParent + c2ToParent
        /// Return MindMapConcept parent --> The first Parent they have
        /// Return string path --> The Path between the two Concepts
        /// Return int c1ToParent --> The Distance between C1 & Parent of the two
        /// Return int c2ToParent --> The Distance between C2 & Parent of the two
        /// </returns>
        public static DistanceInfo Distance(MindMapConcept c1, MindMapConcept c2)
        {
            if (c1 == c2)
            {
                return(new DistanceInfo(0, c1, 0, 0, new List <MindMapConcept>(), new List <MindMapConcept>()));
            }
            List <MindMapConcept> c1Parents = new List <MindMapConcept>(), c2Parents = new List <MindMapConcept>();

            c1Parents.Add(c1);
            while (c1.Parent != null)
            {
                c1 = c1.Parent;
                c1Parents.Add(c1);
            }
            c2Parents.Add(c2);
            while (c2.Parent != null)
            {
                c2 = c2.Parent;
                c2Parents.Add(c2);
            }
            while (c1Parents[c1Parents.Count - 1] == c2Parents[c2Parents.Count - 1])
            {
                c1Parents.RemoveAt(c1Parents.Count - 1);
                c2Parents.RemoveAt(c2Parents.Count - 1);
                if (c1Parents.Count == 0)
                {
                    return(new DistanceInfo(c2Parents.Count, c2Parents[c2Parents.Count - 1].Parent, 0, c2Parents.Count, c1Parents, c2Parents));
                }
                else if (c2Parents.Count == 0)
                {
                    break;
                }
            }
            return(new DistanceInfo(c2Parents.Count + c1Parents.Count, c1Parents[c1Parents.Count - 1].Parent, c1Parents.Count, c2Parents.Count, c1Parents, c2Parents));
        }
Esempio n. 4
0
        public MindMapOntology(string fileName)
        {
            Concepts = new Dictionary <string, MindMapConcept>();
            IOwlGraph  graph;
            IOwlParser parser = new OwlXmlParser();
            object     o      = parser.ParseOwl(fileName);

            graph = (IOwlGraph)o;
            foreach (DictionaryEntry entry in graph.Nodes)
            {
                IOwlNode node = (IOwlNode)entry.Value;
                if (node.GetType() == typeof(OwlAnnotationProperty) && node.ID != eMaplex && node.ID != eDefinition)
                {
                    annotations.Add(node.ID, ((string)entry.Key).Substring(eAnnotation.Length));
                }
            }
            foreach (DictionaryEntry entry in graph.Literals)
            {
                IOwlLiteral literal = (IOwlLiteral)entry.Value;
                if (literal.ParentEdges[0].ParentNode.ChildEdges[eLabel, 0] == null || ((IOwlLiteral)(literal.ParentEdges[0].ParentNode.ChildEdges[eLabel, 0].ChildNode)) != literal)
                {
                    continue;
                }
                MindMapConcept concept = new MindMapConcept();
                concept.Name                = literal.ID;
                concept.Defintion           = GetDefinition(literal);
                concept.VisualProperties    = GetVisualFeatures(literal);
                concept.NonVisualProperties = GetNonVisualFeatures(literal);
                concept.Maplex              = GetMaplex(literal);
                if (concept.Name.ToUpper() != "THING" && GetParent(literal) != null)
                {
                    concept.ParentConceptName = GetParent(literal).ID;
                }
                else
                {
                    concept.ParentConceptName = "";
                }
                Concepts.Add(concept.Name, concept);
                //Concepts.Add(concept.Name.Split('^')[0], concept);
            }
            foreach (KeyValuePair <string, MindMapConcept> concept in Concepts)
            {
                if (concept.Value.Name.ToUpper() != "THING" && concept.Value.ParentConceptName != null && concept.Value.ParentConceptName != "")
                {
                    try
                    {
                        concept.Value.Parent = Concepts[concept.Value.ParentConceptName];
                    }
                    catch (Exception)
                    {
                        concept.Value.Parent = null;
                    }
                }
                else
                {
                    concept.Value.Parent = null;
                }
            }
        }
Esempio n. 5
0
        private void btnDefinition_Click(object sender, EventArgs e)
        {
            MindMapConcept concept = helper.Concepts["CAR"];
            List <string>  names   = helper.SetPropertiesCombinations("c:\\", concept);

            this.lblParent.Text = names.Count.ToString();
            //this.lblParent.Text = helper.GetDefinition(this.txtConceptName.Text);
        }
Esempio n. 6
0
 public DistanceInfo(int distance, MindMapConcept parent, int c1ToParent, int c2ToParent, List <MindMapConcept> c1ToParentPath, List <MindMapConcept> c2ToParentPath)
 {
     this._distance           = distance;
     this._parent             = parent;
     this._c1ToParentDistance = c1ToParent;
     this._c2ToParentDistance = c2ToParent;
     this._c1ToParentPath     = c1ToParentPath;
     this._c2ToParentPath     = c2ToParentPath;
 }
Esempio n. 7
0
        public List <string> SetPropertiesCombinations(string path, MindMapConcept concept)
        {
            if (!Directory.Exists(concept.Name))
            {
                Directory.CreateDirectory(concept.Name);
            }
            List <string> visualProperties = new List <string>(concept.VisualProperties.Keys);

            return(CreateCombination(path, concept, 0, new List <string>(), visualProperties));
        }