protected void SetContexts() { this.Contexts.Clear(); var dict = new Dictionary <string, string>(); foreach (var fact in Facts) { var dimfact = new LogicalModel.Base.FactBase(); dimfact.Dimensions.AddRange(fact.Dimensions); if (!dict.ContainsKey(dimfact.FactString)) { var context = GetContext(fact); dict.Add(dimfact.FactString, context.ID); AddToContext(this.Contexts, context); //this.Contexts.Add(context); } else { } fact.ContextID = dict[dimfact.FactString]; } var filingcontext = GetContext(new LogicalModel.InstanceFact()); filingcontext.ID = FilingIndicator.DefaultContextID; //this.Contexts.Add(filingcontext); AddToContext(this.Contexts, filingcontext); }
private void test() { var fact = new LogicalModel.Base.FactBase(); //fact.SetFromString("eba_met:mi235,[eba_dim:BAS]eba_BA:x9,[eba_dim:LEC]eba_typ:LE,[eba_dim:MCY]eba_MC:x27,[eba_dim:TRI]eba_TR:x6,"); fact.SetFromString("eba_met:mi235,[eba_dim:BAS]eba_BA:x9,[*:LEC]eba_typ:LE:1234,[*:MCY]eba_MC:x27,[*:TRI]eba_TR:x6,"); var k1 = fact.GetFactKey(); var s1 = fact.GetFactString(); fact.SetFromString("eba_met:mi235,[eba_dim:BAS]eba_BA:x9,[eba_dim:LEC]eba_typ:LE:1234,[eba_dim:MCY]eba_MC:x27,[eba_dim:TRI]eba_TR:x6,"); var k2 = fact.GetFactKey(); var s2 = fact.GetFactString(); }
//public static List<int> GetOptionalItems(int[] factintkey,Table table) //{ // var result = new List<int>(); // foreach (var keypart in factintkey) // { // if (table.Taxonomy.DimensionDomainsOfMembers.ContainsKey(keypart)) // { // var items = GetAspectItems(keypart, table); // if (items.Any(i => i.Contains(Literals.DefaultMember))) // { // result.Add(keypart); // } // } // } // return result; //} public static List <string> GetAspectItems(int dimkey, Table table) { var result = new List <string>(); var dimensionstr = table.Taxonomy.CounterFactParts[dimkey]; var f = new LogicalModel.Base.FactBase(); f.SetFromStringStable(dimensionstr); var dimension = f.Dimensions.FirstOrDefault(); if (!dimension.IsTyped) { var hypercubes = table.HyperCubes.Where(i => i.DimensionItems.Any(j => j.FullName == dimension.DimensionItemFullName)).ToList(); var domains = hypercubes.SelectMany(i => i.DimensionItems.Where(j => j.FullName == dimension.DimensionItemFullName)).SelectMany(k => k.Domains).ToList(); var distinctdomains = domains.Distinct().ToList(); if (distinctdomains.Count == 1) { foreach (var dm in distinctdomains.FirstOrDefault().DomainMembers) { result.Add(dm.Content); } } } return(result); }