Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 18298 invoked from network); 9 Nov 2009 13:27:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Nov 2009 13:27:48 -0000 Received: (qmail 65108 invoked by uid 500); 9 Nov 2009 13:27:43 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 65086 invoked by uid 500); 9 Nov 2009 13:27:43 -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 65073 invoked by uid 99); 9 Nov 2009 13:27:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 13:27:43 +0000 X-ASF-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,URIBL_SBL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.64.63.171] (HELO mail.sptci.com) (208.64.63.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 13:27:40 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.sptci.com (Postfix) with ESMTP id 697531D99F for ; Mon, 9 Nov 2009 05:27:19 -0800 (PST) X-Virus-Scanned: amavisd-new at sptci.com Received: from mail.sptci.com ([127.0.0.1]) by localhost (mail.sptci.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id epfzyvqUez7X for ; Mon, 9 Nov 2009 05:27:09 -0800 (PST) Received: from www.rakeshv.org (unknown [64.81.229.247]) by mail.sptci.com (Postfix) with ESMTPSA id B0CB21D99E for ; Mon, 9 Nov 2009 05:27:08 -0800 (PST) From: Rakesh Vidyadharan Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: multipart/alternative; boundary=Apple-Mail-861-293153447 Subject: Re: Equivalent JCR_SQL2 statement Date: Mon, 9 Nov 2009 07:27:07 -0600 In-Reply-To: <91f3b2650911082336n8d50dc3oe08bf8348420682b@mail.gmail.com> To: users@jackrabbit.apache.org References: <91f3b2650911082320n4eb3d974w92b5b993268e503f@mail.gmail.com> <91f3b2650911082336n8d50dc3oe08bf8348420682b@mail.gmail.com> Message-Id: <9A035ED4-99A0-4D6C-8DF0-3E1F5F96058D@sptci.com> X-Mailer: Apple Mail (2.1076) --Apple-Mail-861-293153447 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Hi Thomas, Thanks for the clarifications. The query now "compiles" but I get =20 back no results (the XPath versions work as I would expect as these =20 are part of a unit test suite). I had looked into the JR 2 unit test =20= suite before I posted, but I think all of those are based on the older =20= SQL/XPath standards. Rakesh On 9 Nov 2009, at 1:36:25 AM, Thomas M=FCller wrote: > Hi, > > I found the relevant section of the spec: > http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.4%20Name > Name ::=3D '[' quotedName ']' | '[' simpleName ']' | simpleName > simpleName ::=3D /* A JCR Name that is also a legal SQL identifier */ > See the SQL:92 rules for (in ISO/IEC 9075:1992 =A7 > 5.2 and ). > As far as I read the SQL-92 spec, this basically means the same rules > as for Java identifiers apply. > > I guess we should have railroad diagrams. I will try to create them. > > Regards, > Thomas > > > > > On Mon, Nov 9, 2009 at 8:20 AM, Thomas M=FCller =20 > wrote: >> Hi, >> >> Try: >> >> select * from [nt:unstructured] where [jcr:path] like >> '/%/unitTestPage' and [cms:nodeType] =3D 'page' >> >> Regards, >> Thomas >> >> >> On Sun, Nov 8, 2009 at 5:30 AM, Rakesh Vidyadharan =20 >> wrote: >>> Since XPath is deprecated in JCR 2.0, I am trying to move to =20 >>> JCR_SQL2 >>> (JR-2.0-beta1). I have the following XPath query: >>> >>> //unitTestPage[@cms:nodeType =3D 'page'] >>> >>> I tried writing the query in SQL as: >>> >>> select * from nt:unstructured where jcr:path like '/%/=20 >>> unitTestPage' and >>> cms:nodeType =3D 'page' >>> >>> This statement however fails with an exception: >>> >>> javax.jcr.query.InvalidQueryException: Query: >>> select * from nt:(*)unstructured where jcr:path like '/%/=20 >>> unitTestFolder' and >>> cms:nodeType =3D 'page'; expected: >>> at >>> org.apache.jackrabbit.commons.query.sql2.Parser.getSyntaxError=20 >>> (Parser.java:968) >>> at >>> org.apache.jackrabbit.commons.query.sql2=20 >>> .Parser.createQueryObjectModel(Parser.java:124) >>> at >>> org.apache.jackrabbit.commons.query.sql2=20 >>> .SQL2QOMBuilder.createQueryObjectModel(SQL2QOMBuilder.java:55) >>> at >>> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery=20 >>> (QOMQueryFactory.java:69) >>> at >>> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery=20 >>> (CompoundQueryFactory.java:67) >>> at >>> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery=20 >>> (QueryManagerImpl.java:98) >>> >>> Can some one tell me what I am missing? >>> >>> Thanks >>> Rakesh >>> >>> >>> >> Rakesh Vidyadharan President & CEO Sans Pareil Technologies, Inc. http://sptci.com/ | 100 W. Chestnut, Suite 1305 | Chicago, IL 60610-3296 USA | | Ph: +1 (312) 212 3933 | Mobile: +1 (312) 315-1596 (US), +91 949 611 =20= 0873 (IN) | Fax: +1 (312) 276-4410 | E-mail: rakesh@sptci.com --Apple-Mail-861-293153447--