예제 #1
0
        public void ShouldAllowUsingISparqlExpressionForFilter()
        {
            // given
            ISparqlExpression expression = new IsIriFunction(new VariableTerm("x"));

            _builder.Filter(expression);

            // when
            GraphPattern graphPattern = _builder.BuildGraphPattern(_namespaceMapper.Object);

            // then
            Assert.True(graphPattern.IsFiltered);
            Assert.Same(expression, graphPattern.Filter.Expression);
        }
        /// <summary>
        /// Creates a call of the EXISTS function
        /// </summary>
        /// <param name="eb"></param>
        /// <param name="buildExistsPattern">a function, which will create the graph pattern parameter</param>
        public static BooleanExpression Exists(this ExpressionBuilder eb, Action <IGraphPatternBuilder> buildExistsPattern)
        {
            GraphPatternBuilder builder = new GraphPatternBuilder();

            buildExistsPattern(builder);
            var existsFunction = new ExistsFunction(builder.BuildGraphPattern(eb.Prefixes), true);

            return(new BooleanExpression(existsFunction));
        }
 protected override SparqlQuery BuildQuery(SparqlQuery query)
 {
     query.ConstructTemplate = _builder.BuildGraphPattern(Prefixes);
     return(base.BuildQuery(query));
 }
 public GraphPattern BuildGraphPattern(INamespaceMapper prefixes)
 {
     return(_builder.BuildGraphPattern(prefixes));
 }