예제 #1
0
        public void CreateRegexFilter()
        {
            //Arrange
            var n      = new RDFVariable("n");
            var filter = new RDFRegexFilter(n, new Regex(@"Mouse", RegexOptions.IgnoreCase));
            var pg1    = new RDFPatternGroup("PG1");

            //Act
            pg1.AddFilter(filter);

            //Assert
            Assert.Contains(filter.ToString(), pg1.ToString());
        }
예제 #2
0
        public void CreateIsNumericFilter()
        {
            //Arrange
            var x      = new RDFVariable("x");
            var filter = new RDFIsUriFilter(x);
            var pg1    = new RDFPatternGroup("PG1");

            //Act
            pg1.AddFilter(filter);

            //Assert
            Assert.Contains(filter.ToString(), pg1.ToString());
        }
예제 #3
0
        public void CreateComparisonFilter()
        {
            //Arrange
            var y      = new RDFVariable("y");
            var filter = new RDFComparisonFilter(RDFQueryEnums.RDFComparisonFlavors.LessThan, y, new RDFPlainLiteral("25"));
            var pg1    = new RDFPatternGroup("PG1");

            //Act
            pg1.AddFilter(filter);

            //Assert
            Assert.Contains(filter.ToString(), pg1.ToString());
        }
예제 #4
0
        public void CreateLangMatchesFilter()
        {
            //Arrange
            var n      = new RDFVariable("n");
            var filter = new RDFLangMatchesFilter(n, "it-IT");
            var pg1    = new RDFPatternGroup("PG1");

            //Act
            pg1.AddFilter(filter);

            //Assert
            Assert.Contains(filter.ToString(), pg1.ToString());
        }
예제 #5
0
        public void CreateSameTermFilter()
        {
            //Arrange
            var x      = new RDFVariable("x");
            var filter = new RDFSameTermFilter(x, donaldduck);
            var pg1    = new RDFPatternGroup("PG1");

            //Act
            pg1.AddFilter(filter);

            //Assert
            Assert.Contains(filter.ToString(), pg1.ToString());
        }
        /// <summary>
        /// Get the result table of the given pattern group
        /// </summary>
        internal static void CombinePatterns(RDFDescribeQuery query, RDFPatternGroup patternGroup) {
            if (patternGroup.Patterns.Any()) {

                //Populate pattern group result table
                DataTable patternGroupResultTable                      = RDFQueryEngine.CombineTables(query.PatternResultTables[patternGroup], false);

                //Add it to the list of pattern group result tables
                query.PatternGroupResultTables.Add(patternGroup, patternGroupResultTable);

                //Populate its metadata
                query.PatternGroupResultTables[patternGroup].TableName = patternGroup.ToString();
                if (!query.PatternGroupResultTables[patternGroup].ExtendedProperties.ContainsKey("IsOptional")) {
                    query.PatternGroupResultTables[patternGroup].ExtendedProperties.Add("IsOptional", patternGroup.IsOptional);
                }
                else {
                    query.PatternGroupResultTables[patternGroup].ExtendedProperties["IsOptional"]  = patternGroup.IsOptional;
                }
                if (!query.PatternGroupResultTables[patternGroup].ExtendedProperties.ContainsKey("JoinAsUnion")) {
                    query.PatternGroupResultTables[patternGroup].ExtendedProperties.Add("JoinAsUnion", patternGroup.JoinAsUnion);
                }
                else {
                    query.PatternGroupResultTables[patternGroup].ExtendedProperties["JoinAsUnion"] = patternGroup.JoinAsUnion;
                }

            }
        }