Showing a filter builder

I am looking for possible ways to build an intuitive and/or filter builder. For example:

enter image description here

Or:

enter image description here

What might be a good way to show this?