public void SaveGraph(EntityGraph entityTree, string fileName) { fileName = PathUtils.Decode(fileName); using (StreamWriter sw = new StreamWriter(fileName)) { //Write header sw.WriteLine("<TestOntology>"); //Write Entities foreach (IEntity entity in entityTree.GetAllEntities().GetItems()) { sw.WriteLine(); PrintEntity(sw, entity); } //Write Relationships foreach (IRelationship relationship in entityTree.GetAllRelationships()) { sw.WriteLine(); if (relationship is ConditionalRuleRelationship) { PrintRule(sw, relationship as ConditionalRuleRelationship); } else { PrintRelationship(sw, relationship); } } //Write header sw.WriteLine(); sw.WriteLine("</TestOntology>"); sw.Close(); } }