Ejemplo n.º 1
0
        public override FactBaseQuery GetQuery(Taxonomy taxonomy, Hierarchy <XbrlIdentifiable> currentfilter, FactBaseQuery parent)
        {
            //Console.WriteLine(String.Format("ConceptFilter.GetQuery( {0} ) ", currentfilter.Item));

            var factparts    = taxonomy.FactParts;
            var factsofparts = taxonomy.FactsOfParts;
            //var query = new FactBaseQuery();
            FactBaseQuery result  = null;
            var           queries = new List <FactBaseQuery>();

            if (Concepts.Count == 1)
            {
            }
            foreach (var concept in Concepts)
            {
                var query = new FactBaseQuery();
                queries.Add(query);
                var tag = concept.QName.Content;
                query.Concept = tag;
                if (!Complement)
                {
                    query.DictFilters = parent.DictFilters + String.Format("{0} ", tag);
                    if (factparts.ContainsKey(tag))
                    {
                        query.DictFilterIndexes.Add(factparts[tag]);
                    }
                }
                else
                {
                    query.FalseFilters = parent.DictFilters + String.Format("{0} ", tag);
                    if (factparts.ContainsKey(tag))
                    {
                        query.NegativeDictFilterIndexes.Add(factparts[tag]);
                    }
                }
                SetCover(query);
            }
            if (queries.Count == 1)
            {
                result = queries.FirstOrDefault();
            }
            if (queries.Count > 1)
            {
                result = new FactPoolQuery();
                foreach (var query in queries)
                {
                    result.AddChildQuery(query);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public override FactBaseQuery GetQuery(Taxonomy taxonomy, Hierarchy <XbrlIdentifiable> currentfilter, FactBaseQuery parent)
        {
            var query = new FactPoolQuery();

            query.DictFilterIndexes.AddRange(parent.DictFilterIndexes);
            foreach (var child in currentfilter.Children)
            {
                var filter = child.Item as Filter;
                if (filter != null)
                {
                    var childquery = filter.GetQuery(taxonomy, child, query);
                    query.AddChildQuery(childquery);
                }
            }
            parent.AddChildQuery(query);
            return(query);
        }