SPARQL/UNION

The intersection of A and B, big capitals of the European Union, can simply be achieved by combining all the triples. This results in 1 city.

All capitals of the European union, excluding big cities can be achieved by filtering using. This results in the other 27 capitals.

Finally a  of capitals and big cities result in 30 cities, one of which was deduplicated by.

Mind that the 2 parts of the union should both be within brackets.

Two simpler examples of  are
 * for or.
 * or.
 * The last code can be simplified by using property path

An overview of all kind of joins: