Example #1
0
        /// <summary>
        /// Optimizes the map execution
        /// </summary>
        /// <returns></returns>
        public override BaseMap Optimize()
        {
            InputMap1 = InputMap1.Optimize();
            InputMap2 = InputMap2.Optimize();

            return(this);
        }
Example #2
0
        /// <summary>
        /// Evaluates the join map
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public override IEnumerable <LabelledTreeNode <object, Term> > Evaluate <T>(IGraphSource source)
        {
            var tempSet = new List <LabelledTreeNode <object, Term> >();

            foreach (var treeJoin in InputMap2.Evaluate <T>(source))
            {
                tempSet.Add(treeJoin);
            }

            foreach (var treeBase in InputMap1.Evaluate <T>(source))
            {
                var  result       = treeBase;
                bool isCompatible = false;

                foreach (var treeJoin in tempSet)
                {
                    if (JoinHelper.Compatible(treeBase, treeJoin, _addressPairList))
                    {
                        isCompatible = true;
                        result       = JoinHelper.Join(result, treeJoin, _addressPairList);
                    }
                }

                if (isCompatible)
                {
                    yield return(result);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Evaluates the union map
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public override IEnumerable <LabelledTreeNode <object, Term> > Evaluate <T>(IGraphSource source)
        {
            foreach (var tree in InputMap1.Evaluate <T>(source))
            {
                yield return(tree);
            }

            foreach (var tree in InputMap2.Evaluate <T>(source))
            {
                yield return(tree);
            }
        }
Example #4
0
        /// <summary>
        /// Removes empty maps from this instance
        /// </summary>
        /// <returns></returns>
        public override BaseMap Trim()
        {
            if (InputMap1 is EmptyMap && InputMap2 is EmptyMap)
            {
                return(new EmptyMap());
            }
            if (InputMap1 is EmptyMap)
            {
                return(InputMap2.Trim());
            }
            if (InputMap2 is EmptyMap)
            {
                return(InputMap1.Trim());
            }
            InputMap1 = InputMap1.Trim();
            InputMap2 = InputMap2.Trim();

            return(this);
        }