[XQZone General] About providing dyanamic element compare inpredicate

Nizamuddin, Rashid rnizamuddin at edmunds.com
Tue Jul 18 10:48:19 PDT 2006


I tweaked the query and was able to get the entire node for an asset,
but looks like this query is not working with xdmp:estimate function.
I am trying to look for all assets which has the same file name. Below
is the query and it returns wrong statistics. As a sample I included one
element which describes our assets meta data.

let $searchTerm := '05.Scion.tC.Hbk.Base..f3-4.normal.500.jpg'
let $element-parsed := "file-name"
let $asset-count := 
xdmp:estimate(
               doc("/assets.xml")/assets/asset
                   [./*[name(.) = $element-parsed][. = $searchTerm]]
              )
return $asset-count

Let me know what I am doing wrong

Thanks a lot
Rashid

<asset id="30000015">
  <file-size>65536</file-size> 
  <file-type>JPG</file-type> 
  <pixel-width>500</pixel-width> 
  <pixel-height>315</pixel-height> 
  <file-path>/2005/Scion/tC/Hatchback/Base/Enhanced Stills/</file-path> 
  <file-name>05.Scion.tC.Hbk.Base..f3-4.normal.500.jpg</file-name> 
  <date-inserted>2005-03-28T00:00:00.0-0800</date-inserted> 
  <insert-user-id>1544803905</insert-user-id> 
  <date-modified>2005-03-28T00:00:00.0-0800</date-modified> 
  <date-published>2006-05-18T18:34:45.697724-07:00</date-published> 
  <publish-user-id>1211382781</publish-user-id> 
  <stage>PUBLISHED</stage> 
  <vendor-prefer>No</vendor-prefer> 
- <contributors>
  <contributor contributor_id="91" /> 
  </contributors>
- <asset-categorization-node node-type="0">
- <super-category value="Still Photos" id="1">
- <category value="Enhanced Imagery" id="2">
- <sub-category value="Exterior Stills" id="70">
  <type value="Front 3/4 Normal" id="72" /> 
  </sub-category>
  </category>
  </super-category>
  </asset-categorization-node>
  <ed-style-id>100394782</ed-style-id> 
  <caption>2005 Scion tC Exterior</caption> 
- <child>
  <file-type>JPG</file-type> 
  <file-size>8</file-size> 
  <file-name>05.Scion.tC.Hbk.Base..f3-4.normal.500_T.jpg</file-name> 
  <pixel-width>175</pixel-width> 
  <pixel-height>110</pixel-height> 
  <type>T</type> 
  </child>
- <child>
  <file-type>JPG</file-type> 
  <file-size>1582</file-size> 
  <file-name>05.Scion.tC.Hbk.Base..f3-4.normal.87_ST.jpg</file-name> 
  <pixel-width>87</pixel-width> 
  <pixel-height>55</pixel-height> 
  <type>ST</type> 
  </child>
  <published-photo-id>20072254</published-photo-id> 
  <keywords /> 
- <asset-data-node-binding id="370">
  <match-quality>EM</match-quality> 
  <set>370</set> 
  </asset-data-node-binding>
  </asset>

-----Original Message-----
From: general-bounces at xqzone.marklogic.com
[mailto:general-bounces at xqzone.marklogic.com] On Behalf Of Jason Hunter
Sent: Monday, July 17, 2006 11:53 PM
To: General XQZone Discussion
Subject: Re: [XQZone General] About providing dyanamic element compare
inpredicate

Nizamuddin, Rashid wrote:
> let $f-name := '05.Scion.tC.Hbk.Base..f3-4.normal.500.jpg'
> let $el-name := "file-name"
> let $asset :=
doc("/assets.xml")/assets/asset[xs:QName($el-name)=$f-name]
> return $asset

Hi Rashid,

Try this:

doc("/assets.xml")/assets/asset/*[name(.) = $el-name][. = $f-name]/..

-jh-
_______________________________________________
General mailing list
General at xqzone.marklogic.com
http://xqzone.com/mailman/listinfo/general





More information about the General mailing list