To use this How-To, first clone the Star Wars demo into your team on TerminusCMS. You will then have full access to the data needed for this tutorial
Since WOQL is a datalog, filters are just part of the query. You can express negative information, or constraints on the variables in order to get a restriction down to the things you want.
For instance, we can write the following query in the query panel for the Star Wars demo:
let v =Vars("person","person_name","vehicle","vehicle_name");limit(10).select(v.person_name,v.vehicle_name).and(triple(v.vehicle,"pilot",v.person),triple(v.vehicle,"label",v.vehicle_name),triple(v.person,"label",v.person_name))
We can ask for a specific example of a vehicle name by filtering on equality.
For instance:
let v =Vars("person","person_name","vehicle","vehicle_name");select(v.person_name,v.vehicle_name).and(triple(v.vehicle,"pilot",v.person),triple(v.vehicle,"label",v.vehicle_name),triple(v.person,"label",v.person_name),eq(v.vehicle_name,string("Millennium Falcon")))
let v =Vars("person","person_name","vehicle","vehicle_name");select(v.person_name,v.vehicle_name).and(triple(v.vehicle,"pilot",v.person),triple(v.vehicle,"label",v.vehicle_name),triple(v.person,"label",v.person_name),not(eq(v.vehicle_name,string("Millennium Falcon"))))
In which we get the complement of the above.
Or, we can use the regex operator to get a wider variety, for instance:
let v =Vars("person","person_name","vehicle","vehicle_name","pattern");select(v.person_name,v.vehicle_name).and(triple(v.vehicle,"pilot",v.person),triple(v.vehicle,"label",v.vehicle_name),triple(v.person,"label",v.person_name),regex("W.*",v.vehicle_name, [v.pattern]))