Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA3BE9C59 for ; Thu, 23 May 2013 05:42:15 +0000 (UTC) Received: (qmail 66100 invoked by uid 500); 23 May 2013 05:42:15 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 65738 invoked by uid 500); 23 May 2013 05:42:11 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Delivered-To: moderator for users@jackrabbit.apache.org Received: (qmail 15111 invoked by uid 99); 22 May 2013 22:12:16 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sofia.sbyrne.net X-Spam-Level: Message-ID: <519D434E.2080604@sbyrne.net> Date: Wed, 22 May 2013 18:14:38 -0400 From: Stephen Byrne User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: users@jackrabbit.apache.org Subject: Condition on left outer joined node's property Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 I would like to have a query condition based on a property of a node selected by a left outer join. If the left joined node exists, I have no problem. If the left joined node does not exist, I cannot use the property in a constraint. I tried doing something like this: SELECT * FROM [m:foo] AS foo LEFT OUTER JOIN [m:foochild] AS maybe ON ISSAMENODE(maybe,foo,'fc1') WHERE maybe.bar <> 'X' I understand that this is like SQL and the where clause will evaluate to false if maybe.bar is null. So I tried this: SELECT * FROM [m:foo] AS foo LEFT OUTER JOIN [m:foochild] AS maybe ON ISSAMENODE(maybe,foo,'foo') WHERE maybe.bar IS NULL OR maybe.bar <> 'X' But that also returns null if maybe is null. So I tried: SELECT * FROM [m:foo] AS foo LEFT OUTER JOIN [m:foochild] AS maybe ON ISSAMENODE(maybe,foo,'foo') WHERE NOT maybe.bar IS NOT NULL OR maybe.bar <> 'X' But that does not work either. Is there a way to get something to evaluate to true if a left outer joined node is null? -- Stephen Byrne stephen@sbyrne.net