The DTYPE in (...) is caused by the treats. Your suggested query has exactly the same clause. Removing one of the two treats from your query, causes the predicate to change to DTYPE = 'SubType2'. I agree that the spec is very unclear about treats, but if you look at them from an OOP point of view, I think a treat should always filter, but only local to that part of the query. A predicate such as treat(a as B).property = 42 reads as a instanceof B && ((B) a).getProperty() == 42 in Java code. The condition can never be satisfied if a is not of type B, but that only affects that part of the query. |