I was testing my SQL Indexing plugin (should push it to sandbox pretty soon), and I was using excellent tests located in qi4j-core\testsupport\src\main\java\org\qi4j\test\indexing\AbstractEntityFinderTest.java . Now, there was one specific test that failed at one point for me, and I started wondering about the logic behind it.

The test is this:
public void script15()
throws EntityFinderException
{
  Male person = templateFor( Male.class );
  // should return Ann and Joe Doe
  Iterable<EntityReference> entities = entityFinder.findEntities(
    Person.class.getName(),
    isNull( person.wife() ),
    NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS
    );
  assertNames( entities, ANN, JOE );
}

The test finds all people, who have their wife-association null. It assumes that it should return two values: Ann and Joe Doe. Looking at data models, the entity representing Ann Doe is of Female-type, and thus doesn't even have wife-association. So, how can "is null" query match something that doesn't even exist? At least I think that in order to be null, something must exist first.

What is your opinion/explanation on this? Should there be separate "exists"-expression in queries? Or "is null" really should match non-existing things too?


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to