Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 56644 invoked from network); 20 May 2007 11:48:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 May 2007 11:48:17 -0000 Received: (qmail 82231 invoked by uid 500); 20 May 2007 11:48:22 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 82212 invoked by uid 500); 20 May 2007 11:48:22 -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 Received: (qmail 82199 invoked by uid 99); 20 May 2007 11:48:22 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2007 04:48:22 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of julian.reschke@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 20 May 2007 04:48:15 -0700 Received: (qmail invoked by alias); 20 May 2007 11:47:54 -0000 Received: from p508fa954.dip0.t-ipconnect.de (EHLO [192.168.178.22]) [80.143.169.84] by mail.gmx.net (mp030) with SMTP; 20 May 2007 13:47:54 +0200 X-Authenticated: #1915285 X-Provags-ID: V01U2FsdGVkX1+13Z8m0cO1WXPajvi7/tTCwoF97WS1h7h5pN3djj WFYkED9StHdRd/ Message-ID: <46503562.6080104@gmx.de> Date: Sun, 20 May 2007 13:47:46 +0200 From: Julian Reschke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.4) Gecko/20060516 Thunderbird/1.5.0.4 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: users@jackrabbit.apache.org CC: user-list@magnolia.info Subject: Re: Xpath to SQL Query with a number and subselect References: <2123A704743EB34295B4AA1DB09475680148BDF7@jaxmsx02.nemours.org> In-Reply-To: <2123A704743EB34295B4AA1DB09475680148BDF7@jaxmsx02.nemours.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org Amir Mistric wrote: > Hi > > I was wondering if someone can help me translate a Xpath query into SQL one. > The XPath query works like a charm untill you pass in a path with a number.... > > WORKS: > /jcr:root/site1/news//element(*,nt:base)[@tag='news' and MetaData/@mgnl:template='np-article'] order by @date descending > > FAILS: > /jcr:root/site1/news/2007//element(*,nt:base)[@tag='news' and MetaData/@mgnl:template='np-article'] order by @date descending > > Reason why it fails is outlined here (http://issues.apache.org/jira/browse/JCR-579) Well, read that entirely and you'll find out that there is no bug, and that you need to escape the leading digit: /jcr:root/site1/news/_x0032_007//element(*,nt:base)[@tag='news' and MetaData/@mgnl:template='np-article'] order by @date descending > My attempts to convert this to SQL query have failed as it seems impossible to put child into a predicate... > Here is what I have (but it does not work): For conversion between JCR query languages, is your friend. > ... Best regards, Julian