/// <summary> /// Returns XML string with all occurences of Active element "Attribute". /// </summary> /// <param name="index">index of data source in FEplugin data sources table</param> /// <returns>XML string</returns> public static string getList(int index) { string resultString = ""; // result XML string // loading DTD to resultString try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { #if (LADENI) MessageBox.Show("error while loading DTD: " + e.Message); #endif return(resultString); } // root element resultString += "<active_list>"; string ErrStr = ""; // error report #region A) searching all boxes - Attributes (DataMiningCommon.Attributes.Attribute) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Attributes.Attribute"); // processing of each box - searching all Attributes foreach (IBoxModule ABox in AttrBoxes) { try { Rec_attribute rAttr = new Rec_attribute(); // setting ID attribute rAttr.id = "Attr" + ABox.ProjectIdentifier.ToString(); // searching name of literal rAttr.attr_name = ABox.GetPropertyString("NameInLiterals"); // searching data source name (database) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases"); } rAttr.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // searching data matrix name IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + matrix_names.GetLength(0).ToString() + " data matrixes"); } rAttr.matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // searching name of source column or manner of derivation IBoxModule[] col_names = BoxesHelper.ListDirectAncestBoxesWithID(ABox, "DataMiningCommon.Column"); if (col_names.GetLength(0) != 1 && col_names.GetLength(0) != 0) // incorrect number of source columns found { throw new System.Exception("found " + col_names.GetLength(0).ToString() + " zdrojovych sloupcu"); } if (col_names.GetLength(0) == 1) { rAttr.creation = col_names[0].GetPropertyString("Name"); } IBoxModule[] dercol_names = BoxesHelper.ListDirectAncestBoxesWithID(ABox, "DataMiningCommon.DerivedColumn"); if (dercol_names.GetLength(0) != 1 && dercol_names.GetLength(0) != 0) // incorrect number of source columns found { throw new System.Exception("found " + dercol_names.GetLength(0).ToString() + " zdrojovych odvozenych sloupcu"); } if (dercol_names.GetLength(0) == 1) { rAttr.creation = dercol_names[0].GetPropertyString("Formula"); } // searching number of categories rAttr.ctgr_count = ABox.GetPropertyLong("CountOfCategories"); // searching the category "missisng value" string nul_cat = ABox.GetPropertyString("IncludeNullCategory"); List <Rec_missing_value> MisVal_list = new List <Rec_missing_value>(); // array of records with missing values if (!String.IsNullOrEmpty(nul_cat)) { Rec_missing_value MisVal = new Rec_missing_value(); MisVal.name = nul_cat; MisVal_list.Add(MisVal); } // searching category names and their frequencies List <Rec_ctgr> cat_list = new List <Rec_ctgr>(); // list of categories CategoriesStruct cat_str = (ABox.GetPropertyOther("Categories") as CategoriesT).categoriesValue; // long intervals foreach (string key in cat_str.longIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (if possible) //KODY 27.11.2006 - not possible to gain attribute frequencies directly from Ferda. Can be resolved via creating CF task new_li.name = key; cat_list.Add(new_li); } // float intervals foreach (string key in cat_str.floatIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (if possible) new_li.name = key; cat_list.Add(new_li); } // date time intervals foreach (string key in cat_str.dateTimeIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (if possible) new_li.name = key; cat_list.Add(new_li); } // enums foreach (string key in cat_str.enums.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (if possible) new_li.name = key; cat_list.Add(new_li); } #region Generating of one attribute to XML string string oneAttrString = ""; // generating hypotheses to XML if (MisVal_list.Count == 0 && cat_list.Count == 0) { oneAttrString += rAttr.ToXML(); } else { oneAttrString += rAttr.ToXML(cat_list, MisVal_list); } resultString += oneAttrString; #endregion } catch (System.Exception e) { ErrStr += "Box ProjectIdentifier=" + ABox.ProjectIdentifier.ToString() + ": " + e.Message + "\n"; } } #endregion // root element resultString += "</active_list>"; #if (LADENI) // generating of error message: if (!String.IsNullOrEmpty(ErrStr)) { MessageBox.Show("Pri nacitani category doslo k chybam:\n" + ErrStr, "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Kody - storing output to file "XMLAttrExample.xml" in directory XMLHelper.saveXMLexample(resultString, "../XML/XMLAttrExample.xml"); #endif return(resultString); } // TODO: Attributes v krabickach EachValueOneCategory, Equidistant, Equifrequency???
// ==================== Kategorie ================================ public static string fFECategory(int index) { string resultString = ""; // vysledny XML string // nacteni DTD do resultStringu try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { MessageBox.Show("Chyba pri nacitani DTD: " + e.Message); return(resultString); } // korenovy element resultString += "<active_list>"; // zpracovani kazde krabicky - ziskani z ni vsechny kategorie string ErrStr = ""; // zaznam o chybach #region nalezeni a zpracovani vsech krabicek Atributu (DataMiningCommon.Attributes.Attribute) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Attributes.Attribute"); string db_name = ""; string matrix_name = ""; string attr_name = ""; int cat_id_counter = 0; // zpracovani kazde krabicky - ziskani z ni vsechny Kategorie foreach (IBoxModule ABox in AttrBoxes) { List <Rec_category> rCats = new List <Rec_category>(); // seznam vsech kategorii daneho atributu cat_id_counter = 1; // zjisteni jmena atributu (v literalu) attr_name = ABox.GetPropertyString("NameInLiterals"); // nalezeni jmena datoveho zdroje (databaze) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // byl nalezen pocet datovych zdroju ruzny od jedne { throw new System.Exception("bylo nalezeno " + db_names.GetLength(0).ToString() + " databazi"); } db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // nalezeni jmena datove matice IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // byl nalezen pocet datovych matic ruzny od jedne { throw new System.Exception("bylo nalezeno " + matrix_names.GetLength(0).ToString() + " datovych matic"); } matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // nalezeni seznamu kategorii daneho atributu List <Rec_ctgr> cat_list = new List <Rec_ctgr>(); // seznam kategorii CategoriesStruct cat_str = (ABox.GetPropertyOther("Categories") as CategoriesT).categoriesValue; #region Zpracovani kategorii typu Interval // long intervals foreach (string key in cat_str.longIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: doimplementovat, pujde-li rCat.bool_type = "No boolean"; // TODO: co to je? Dodelat. rCat.def_length = cat_str.longIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (LongIntervalStruct lis in cat_str.longIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (lis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (lis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += lis.leftBound.ToString() + ";"; } if (lis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += lis.rightBound.ToString(); } switch (lis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // vypsani jedne kategorie do XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } // float intervals foreach (string key in cat_str.floatIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: doimplementovat, pujde-li rCat.bool_type = "No boolean"; // TODO: co to je? Dodelat. rCat.def_length = cat_str.floatIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (FloatIntervalStruct fis in cat_str.floatIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (fis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (fis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += fis.leftBound.ToString() + ";"; } if (fis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += fis.rightBound.ToString(); } switch (fis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // vypsani jedne kategorie do XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } // date time intervals foreach (string key in cat_str.dateTimeIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: doimplementovat, pujde-li rCat.bool_type = "No boolean"; // TODO: co to je? Dodelat. rCat.def_length = cat_str.floatIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (DateTimeIntervalStruct dis in cat_str.dateTimeIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (dis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (dis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += dis.leftBound.ToString() + ";"; } if (dis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += dis.rightBound.ToString(); } switch (dis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // vypsani jedne kategorie do XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } #endregion // enums foreach (string key in cat_str.enums.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Enumeration"; rCat.ctgr_freq = "N/A"; // TODO: doimplementovat, pujde-li rCat.bool_type = "No boolean"; // TODO: co to je? Dodelat. rCat.def_length = cat_str.enums[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (string enu in cat_str.enums[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); ctgr_def.definition = enu; ctgr_defs.Add(ctgr_def); } // vypsani jedne kategorie do XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } } #endregion resultString += "</active_list>"; // Kody - ulozeni vystupu do souboru "XMLAttrExample.xml" v adresari XMLHelper.saveXMLexample(resultString, "../XML/XMLCatExample.xml"); return(resultString); }
// ==================== Atribut ================================ public static string fFEAttribute(int index) { string resultString = ""; // vysledny XML string // nacteni DTD do resultStringu try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { MessageBox.Show("Chyba pri nacitani DTD: " + e.Message); return(resultString); } // korenovy element resultString += "<active_list>"; string ErrStr = ""; // zaznam o chybach #region A) nalezeni vsech krabicek Atributu (DataMiningCommon.Attributes.Attribute) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Attributes.Attribute"); // zpracovani kazde krabicky - ziskani z ni vsechny Atributy foreach (IBoxModule ABox in AttrBoxes) { Rec_attribute rAttr = new Rec_attribute(); // nastaveni ID atributu rAttr.id = "Attr" + ABox.ProjectIdentifier.ToString(); // zjisteni jmena literalu rAttr.attr_name = ABox.GetPropertyString("NameInLiterals"); // nalezeni jmena datoveho zdroje (databaze) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // byl nalezen pocet datovych zdroju ruzny od jedne { throw new System.Exception("bylo nalezeno " + db_names.GetLength(0).ToString() + " databazi"); } rAttr.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // nalezeni jmena datove matice IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // byl nalezen pocet datovych matic ruzny od jedne { throw new System.Exception("bylo nalezeno " + matrix_names.GetLength(0).ToString() + " datovych matic"); } rAttr.matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // nalezeni jmena zdrojoveho sloupce nebo zpusobu odvozeni IBoxModule[] col_names = BoxesHelper.ListDirectAncestBoxesWithID(ABox, "DataMiningCommon.Column"); if (col_names.GetLength(0) != 1 && col_names.GetLength(0) != 0) // byl nalezen chybny pocet zdrojovych sloupcu { throw new System.Exception("bylo nalezeno " + col_names.GetLength(0).ToString() + " zdrojovych sloupcu"); } if (col_names.GetLength(0) == 1) { rAttr.creation = col_names[0].GetPropertyString("Name"); } IBoxModule[] dercol_names = BoxesHelper.ListDirectAncestBoxesWithID(ABox, "DataMiningCommon.DerivedColumn"); if (dercol_names.GetLength(0) != 1 && dercol_names.GetLength(0) != 0) // byl nalezen chybny pocet zdrojovych sloupcu { throw new System.Exception("bylo nalezeno " + dercol_names.GetLength(0).ToString() + " zdrojovych odvozenych sloupcu"); } if (dercol_names.GetLength(0) == 1) { rAttr.creation = dercol_names[0].GetPropertyString("Formula"); } // nalezeni poctu kategorii rAttr.ctgr_count = ABox.GetPropertyLong("CountOfCategories"); // zjisteni kategorie "chybejici hodnota" string nul_cat = ABox.GetPropertyString("IncludeNullCategory"); List <Rec_missing_value> MisVal_list = new List <Rec_missing_value>(); // pole recordu chybejicich hodnot if (!String.IsNullOrEmpty(nul_cat)) { Rec_missing_value MisVal = new Rec_missing_value(); MisVal.name = nul_cat; MisVal_list.Add(MisVal); } // nalezeni nazvu kategorii a jejich frekvenci List <Rec_ctgr> cat_list = new List <Rec_ctgr>(); // seznam kategorii CategoriesStruct cat_str = (ABox.GetPropertyOther("Categories") as CategoriesT).categoriesValue; // long intervals foreach (string key in cat_str.longIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (doimplementovat, bude-li mozno) new_li.name = key; cat_list.Add(new_li); } // float intervals foreach (string key in cat_str.floatIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (doimplementovat, bude-li mozno) new_li.name = key; cat_list.Add(new_li); } // date time intervals foreach (string key in cat_str.dateTimeIntervals.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (doimplementovat, bude-li mozno) new_li.name = key; cat_list.Add(new_li); } // enums foreach (string key in cat_str.enums.Keys) { Rec_ctgr new_li = new Rec_ctgr(); new_li.freq = "N/A"; // Not Available - TODO (doimplementovat, bude-li mozno) new_li.name = key; cat_list.Add(new_li); } #region Vypsani jednoho Atributu do XML stringu string oneAttrString = ""; // vypsani hypotezy do XML if (MisVal_list.Count == 0 && cat_list.Count == 0) { oneAttrString += rAttr.ToXML(); } else { oneAttrString += rAttr.ToXML(cat_list, MisVal_list); } resultString += oneAttrString; #endregion } #endregion // korenovy element resultString += "</active_list>"; // Kody - ulozeni vystupu do souboru "XMLAttrExample.xml" v adresari XMLHelper.saveXMLexample(resultString, "../XML/XMLAttrExample.xml"); return(resultString); } // TODO: atributy v krabickach EachValueOneCategory, Equidistant, Equifrequency???
/// <summary> /// Returns XML string with all occurences of Active element "Category". /// </summary> /// <param name="index">index of data source in FEplugin data sources table</param> /// <returns>XML string</returns> public static string getList(int index) { string resultString = ""; // result XML string string ErrStr = ""; // error reports // loading DTD to resultString try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { #if (LADENI) MessageBox.Show("error while loading DTD: " + e.Message); #endif return(resultString); } // root element resultString += "<active_list>"; // processing of each box - searching all category #region searching and processing of each boxes of attributes (DataMiningCommon.Attributes.Attribute) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Attributes.Attribute"); string db_name = "unknown"; string matrix_name = "unknown"; string attr_name = "unknown"; int cat_id_counter = 0; // processing of each box - searching all category foreach (IBoxModule ABox in AttrBoxes) { try { List <Rec_category> rCats = new List <Rec_category>(); // seznam vsech category of given attribute cat_id_counter = 1; // searching name of attribute (in literal) attr_name = ABox.GetPropertyString("NameInLiterals"); // searching data source name (database) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases"); } db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // searching data matrix name IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + matrix_names.GetLength(0).ToString() + " data matrixes"); } matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // searching list of categories of given attribute List <Rec_ctgr> cat_list = new List <Rec_ctgr>(); // list of categories CategoriesStruct cat_str = (ABox.GetPropertyOther("Categories") as CategoriesT).categoriesValue; #region processing of category type of Interval // long intervals foreach (string key in cat_str.longIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: if possible rCat.bool_type = "No boolean"; // TODO: What is this? rCat.def_length = cat_str.longIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (LongIntervalStruct lis in cat_str.longIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (lis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (lis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += lis.leftBound.ToString() + ";"; } if (lis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += lis.rightBound.ToString(); } switch (lis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // Generating of one category to XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } // float intervals foreach (string key in cat_str.floatIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: if possible rCat.bool_type = "No boolean"; // TODO: What is this? rCat.def_length = cat_str.floatIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (FloatIntervalStruct fis in cat_str.floatIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (fis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (fis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += fis.leftBound.ToString() + ";"; } if (fis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += fis.rightBound.ToString(); } switch (fis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // Generating of one category to XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } // date time intervals foreach (string key in cat_str.dateTimeIntervals.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Interval"; rCat.ctgr_freq = "N/A"; // TODO: implement if possible rCat.bool_type = "No boolean"; // TODO: what is this? rCat.def_length = cat_str.floatIntervals[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (DateTimeIntervalStruct dis in cat_str.dateTimeIntervals[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); switch (dis.leftBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "(-inf"; break; case BoundaryEnum.Round: ctgr_def.definition += "("; break; case BoundaryEnum.Sharp: ctgr_def.definition += "<"; break; } if (dis.leftBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += dis.leftBound.ToString() + ";"; } if (dis.rightBoundType != BoundaryEnum.Infinity) { ctgr_def.definition += dis.rightBound.ToString(); } switch (dis.rightBoundType) { case BoundaryEnum.Infinity: ctgr_def.definition += "+inf)"; break; case BoundaryEnum.Round: ctgr_def.definition += ")"; break; case BoundaryEnum.Sharp: ctgr_def.definition += ">"; break; } ctgr_defs.Add(ctgr_def); } // Generating of one category to XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } #endregion // enums foreach (string key in cat_str.enums.Keys) { Rec_category rCat = new Rec_category(); rCat.id = "cat" + ABox.ProjectIdentifier.ToString() + "_" + cat_id_counter.ToString(); cat_id_counter++; rCat.db_name = db_name; rCat.matrix_name = matrix_name; rCat.attr_name = attr_name; rCat.ctgr_name = key; rCat.ctgr_type = "Enumeration"; rCat.ctgr_freq = "N/A"; // TODO: if possible rCat.bool_type = "No boolean"; // TODO: What is this? rCat.def_length = cat_str.enums[key].GetLength(0); List <Rec_ctgr_def> ctgr_defs = new List <Rec_ctgr_def>(); foreach (string enu in cat_str.enums[key]) { Rec_ctgr_def ctgr_def = new Rec_ctgr_def(); ctgr_def.definition = enu; ctgr_defs.Add(ctgr_def); } // Generating of one category to XML string OneCatString = ""; if (ctgr_defs.Count == 0) { OneCatString += rCat.ToXML(); } else { OneCatString += rCat.ToXML(ctgr_defs); } resultString += OneCatString; } } catch (System.Exception e) { ErrStr += "Box ProjectIdentifier=" + ABox.ProjectIdentifier.ToString() + ": " + e.Message + "\n"; } } #endregion resultString += "</active_list>"; #if (LADENI) // Kody - storing output to file "XMLAttrExample.xml" in directory XMLHelper.saveXMLexample(resultString, "../XML/XMLCatExample.xml"); if (ErrStr != "") // LADICI { MessageBox.Show("Chyby pri generating seznamu Boolskych cedent:\n" + ErrStr); } #endif return(resultString); }