jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amir Mistric" <amist...@nemours.org>
Subject Xpath to SQL Query with a number and subselect
Date Wed, 02 May 2007 01:13:27 GMT
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)


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):

SELECT * FROM nt:base WHERE jcr:path LIKE '/site1/news/2007[%]/%' AND tag='news' AND mgnl:template='np-article'


The query will work with one AND predicate but not both...

Any help is appreciated.


Regards
Amir



P.S.

Tree looks something like this (this is just an excerpt):

/site1/news/2007/04/26/article-one/pc-ccol/0
/site1/news/2007/04/26/article-one/pc-ccol/0/imageCSSClass=left
/site1/news/2007/04/26/article-one/pc-ccol/0/inheritOrder=before
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:uuid=6410fcff-ae8b-406f-b5b1-a2f06ca318ab
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:mixinTypes=mix:versionable
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:created=2007-05-01T08:29:08.673-04:00
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:baseVersion=3a45bd77-e74e-4669-97e5-282c8f6cb8e9
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:isCheckedOut=true
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:primaryType=mgnl:contentNode
/site1/news/2007/04/26/article-one/pc-ccol/0/location=City, State
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:predecessors=3a45bd77-e74e-4669-97e5-282c8f6cb8e9
/site1/news/2007/04/26/article-one/pc-ccol/0/inherit=false
/site1/news/2007/04/26/article-one/pc-ccol/0/byline=Lastname Firstname
/site1/news/2007/04/26/article-one/pc-ccol/0/jcr:versionHistory=ab3dc3f5-8270-4c67-a3ea-775516a27836
/site1/news/2007/04/26/article-one/pc-ccol/0/tag=news
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:authorid=superuser
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:lastaction=2007-05-01T15:10:46.493-04:00
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:creationdate=2007-04-26T16:22:51.010-04:00
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/jcr:uuid=1db77921-4b55-4313-9309-166492808682
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/jcr:created=2007-05-01T08:29:08.673-04:00
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/jcr:baseVersion=6de3179e-0778-43f5-bbcf-86e1b5d95d8f
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:lastmodified=2007-05-01T15:13:51.747-04:00
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/jcr:isCheckedOut=true
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/jcr:primaryType=mgnl:metaData
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:activatorid=superuser
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:template=np-article
/site1/news/2007/04/26/article-one/pc-ccol/0/MetaData/mgnl:activated=false

Mime
View raw message