示例#1
0
        public void TestAnalyze()
        {
            var descList = new OuterJoinDesc[2];

            descList[0] = SupportOuterJoinDescFactory.MakeDesc(
                container, "IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.LEFT);
            descList[1] = SupportOuterJoinDescFactory.MakeDesc(
                container, "SimpleProperty", "s2", "TheString", "s1", OuterJoinType.LEFT);
            // simpleProperty in s2

            var graph = new QueryGraphForge(3, null, false);

            OuterJoinAnalyzer.Analyze(descList, graph);
            Assert.AreEqual(3, graph.NumStreams);

            Assert.IsTrue(graph.IsNavigableAtAll(0, 1));
            Assert.AreEqual(1, SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1).Length);
            Assert.AreEqual("IntPrimitive", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1)[0]);
            Assert.AreEqual(1, SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0).Length);
            Assert.AreEqual("IntBoxed", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0)[0]);

            Assert.IsTrue(graph.IsNavigableAtAll(1, 2));
            Assert.AreEqual("TheString", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 2)[0]);
            Assert.AreEqual("SimpleProperty", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 2, 1)[0]);
        }
示例#2
0
        public void TestGetProperties()
        {
            // s1.p11 = s0.p01 and s0.p02 = s1.p12
            queryGraph.AddStrictEquals(1, "P11", Make(1, "P11"), 0, "P01", Make(0, "P01"));
            queryGraph.AddStrictEquals(0, "P02", Make(0, "P02"), 1, "P12", Make(1, "P12"));
            log.Debug(queryGraph.ToString());

            string[] expectedOne = new string[] { "P11", "P12" };
            string[] expectedTwo = new string[] { "P01", "P02" };
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 1, 0)));
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 1)));
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 1, 0)));
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 1)));
        }
示例#3
0
        public void TestFillEquivalency()
        {
            // test with just 3 streams
            queryGraph.AddStrictEquals(0, "P00", Make(0, "P00"), 1, "P10", Make(1, "P10"));
            queryGraph.AddStrictEquals(1, "P10", Make(1, "P10"), 2, "P20", Make(2, "P20"));

            Assert.IsFalse(queryGraph.IsNavigableAtAll(0, 2));
            Assert.AreEqual(0, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 2).Length);
            Assert.AreEqual(0, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 2).Length);

            QueryGraphForge.FillEquivalentNav(types, queryGraph);

            Assert.IsTrue(queryGraph.IsNavigableAtAll(0, 2));
            string[] expectedOne = new string[] { "P00" };
            string[] expectedTwo = new string[] { "P20" };
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 2)));
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 2)));

            // test with 5 streams, connect all streams to all streams
            queryGraph = new QueryGraphForge(5, null, false);
            queryGraph.AddStrictEquals(0, "P0", Make(0, "P0"), 1, "P1", Make(1, "P1"));
            queryGraph.AddStrictEquals(3, "P3", Make(3, "P3"), 4, "P4", Make(4, "P4"));
            queryGraph.AddStrictEquals(2, "P2", Make(2, "P2"), 3, "P3", Make(3, "P3"));
            queryGraph.AddStrictEquals(1, "P1", Make(1, "P1"), 2, "P2", Make(2, "P2"));

            QueryGraphForge.FillEquivalentNav(types, queryGraph);

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    Assert.IsTrue(queryGraph.IsNavigableAtAll(i, j), "Not navigable: i=" + i + " j=" + j);
                }
            }
        }