Re: [bdbxml] Query problem
"Michael Beddow" <[email protected]> Tue, 16 Aug 2005 20:23:34 +0100
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <047101c5a298$07219fe0$0200a8c0@michaelnt2k> |
> I have index node-element-equality-string and > node-element-substring-string on LITERAL. > If I use a query /SYNSET[SYNONYM/LITERAL="something"], I get correct > results. But if I try /SYNSET[contains(SYNONYM/LITERAL, "something")], I > get error saying: > Error: SequenceType matching failed: the sequence contains more than one > item [err:XP0006] > > Please, how can I search using contains() or starts-with()? > Thanks for any help. This is a general XQuery point, nothing to to with any specific implementation. The first parameter passed to contains(), starts-with() etc.must either be a string or be a sequence containing zero or one items, which can be silently cast to a string (or the empty string in the case of the empty sequence.) So if in your target document SYNONYM/LITERAL evaluates to a single node you are OK. But if it evaluates to a sequence of more than one nodes you will get the error you describe. The remedy is to use a suitable predicate to restrict the return sequence to a single member, or rethink your query strategy so it is never applied when the context node has several SYNONYM/LITERAL descendants. E.g you could gather all the nodes into a variable and iterate over them with a FLOWR expression, applying contains() to each node in turn. Michael Beddow ------------------------------------------ To remove yourself from this list, send an email to [email protected]