/// <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 classes from graph related with propertyEntity by PropertyRelationship. /// </summary> /// <param name="entity"></param> /// <returns></returns> public IEntitySet <IClassEntity> GetClasses(IPropertyEntity entity) { IEntitySet <IClassEntity> temp = new EntitySet <IClassEntity>(); foreach (PropertyRelationship pr in PropertyRelationships.GetItems()) { if (pr.Property.Identity == entity.Identity) { temp.Add(pr.Class); } } return(temp); }
/// <summary> /// Adds PropertyRelationship to the graph. /// </summary> /// <param name="propertyRelationship"></param> public void Add(PropertyRelationship propertyRelationship) { PropertyRelationships.Add(propertyRelationship); }