Here is a working example:
Mutation:
{
set {
_:e1 <ehid> "1" .
_:c1 <customer_id> "2" .
_:c1 <subscribes_as> _:e1 .
_:o1 <xcode> "x3" .
_:o1 <authenticate_as> _:c1 .
}
}
Query (with filter)
{
var(func:eq(customer_id, "2")) {
C_ID AS customer_id
}
search_by_ehid_using_cust_id_link (func:eq(ehid, "1")) @normalize {
~subscribes_as @filter(uid(C_ID)) {
~authenticate_as{
result: xcode
}
}
}
}
If I pass in customer_id value other than 2, the filter correctly kicks in and no xcode is returned. If however, I dont have a customer_id value at all (and as per your question, this will be an int, so prob be zero in that case ) - i dont want the filter logic to be applied.