public Task <bool> ExistsQueryAsync(BigInteger id, BlockParameter blockParameter = null) { var existsFunction = new ExistsFunction(); existsFunction.Id = id; return(ContractHandler.QueryAsync <ExistsFunction, bool>(existsFunction, blockParameter)); }
/// <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)); }
public void FilterInsideNotExists() { // given var b = QueryBuilder.SelectAll() .Where(tpb => tpb.Subject("x").PredicateUri(":p").Object("n")) .Filter(fb => !fb.Exists(ex => ex.Where(tpb => tpb.Subject("x").PredicateUri(":q").Object("m")) .Filter(inner => inner.Variable("n") != inner.Variable("m")))); b.Prefixes.AddNamespace("", new Uri("http://example.com/")); // when var q = b.BuildQuery(); // then ExistsFunction exists = (ExistsFunction)q.RootGraphPattern.Filter.Expression.Arguments.First(); Assert.True(exists.Arguments.Single() is GraphPatternTerm); Assert.True(((GraphPatternTerm)exists.Arguments.Single()).Pattern.IsFiltered); }
public Task <bool> ExistsQueryAsync(ExistsFunction existsFunction, BlockParameter blockParameter = null) { return(ContractHandler.QueryAsync <ExistsFunction, bool>(existsFunction, blockParameter)); }