/// <summary> /// Gets all IRelationship contained in the graph. /// </summary> public IRelationship[] GetAllRelationships() { int size = Relationships.Count + SubclassRelationships.Count + PropertyRelationships.Count + EquivalenceRelationships.Count; List <IRelationship> all = new List <IRelationship>(size); foreach (Relationship r in Relationships.GetItems()) { all.Add(r); } foreach (SubclassRelationship sr in SubclassRelationships.GetItems()) { all.Add(sr); } foreach (PropertyRelationship pr in PropertyRelationships.GetItems()) { all.Add(pr); } foreach (EquivalenceRelationship er in EquivalenceRelationships.GetItems()) { all.Add(er); } return(all.ToArray()); }
/// <summary> /// Returns all parent classes of class entity from graph. /// </summary> /// <param name="entity"></param> /// <returns>All parent classes.</returns> public IEntitySet <IClassEntity> GetParents(IClassEntity entity) { IEntitySet <IClassEntity> temp = new EntitySet <IClassEntity>(); foreach (SubclassRelationship sr in SubclassRelationships.GetItems()) { if (sr.Descendant.Identity == entity.Identity) { temp.Add(sr.Parent); } } return(temp); }