public void TestSelectRegexFilter() { // Arrange graph = new RDFGraph(); RDFSelectQuery query; BuildGraph(graph); // Act query = new RDFSelectQuery(); var x = new RDFVariable("x"); var y = new RDFVariable("y"); var z = new RDFVariable("z"); var patternGroup = new RDFPatternGroup("PatternGroup1").AddPattern(new RDFPattern(x, y, z)); var filter = new RDFRegexFilter(x, new Regex(@".1$", RegexOptions.IgnoreCase)); // Filter subjects ending with 1 patternGroup.AddFilter(filter); query.AddPatternGroup(patternGroup) .AddProjectionVariable(x) .AddProjectionVariable(y) .AddProjectionVariable(z); var result = query.ApplyToGraph(graph); // Assert Assert.AreEqual(3, result.SelectResultsCount); }
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()); }