Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: Sequence does not match type xs:string

RokoAJan 17 2015 — edited Jan 30 2015

I am using BDB XML 2.5.16 to store and query my XML  documents in Java. The documents are IMDB xml documents containing actors information

obtained from INEX website https://inex.mmci.uni-saarland.de/login.jsp.  One of  the document I stored in the database is the following

    <?xml version="1.0" encoding="UTF-8"?>

     <persons>

      <person>

          <name>jason angeles

          </name>

          <filmography>

             <act>

                <movie>

                   <title>prison planet 3 the revenge 1998

                    </title>

                  <year>1998

                  </year>

                 <character>evil ninja

                  </character>

               </movie>

             </act>

          </filmography>

         </person>

         </persons>

I want to  search using XQuery  for filmography element whose title element contains ANY of the following keywords ('planet', 'revenge', '1998'). Below is the query I used

              // declaring function functx:contains-any-of

            String qryRk = "declare namespace functx = 'http://www.functx.com';

                  + "declare function functx:contains-any-of "

                 + "( $arg as xs:string?" + " , "  + " $searchStrings as xs:string* )  as xs:boolean { "

                 + "some $searchString in $searchStrings "

                +  " satisfies contains($arg,$searchString)} ; ";

             String myQuery101 = qryRk + "for $entity in collection('simpleExampleData2.dbxml')//filmography "

                  + "where functx:contains-any-of ( $entity/act/movie/title ,  ('planet', 'revenge', '1998'))"

                  + "return $entity";

When I  execute the query  i  expect to get at least get the following element as mu output

                       Document : person_31000.xml:

                    <filmography>

                           <act>

                                 <movie>

                                 <title>prison planet 3 the revenge 1998

                                </title>

                                <year>1998

                                </year>

                               <character>evil ninja

                               </character>

                              </movie>

                           </act>

                         </filmography>

However instead of the above element i got the  following Error

                             Exception in thread "main" com.sleepycat.dbxml.XmlException: Error: Sequence does not match type xs:string? - the sequence contains more than one item [err:XPTY0004], <query>:1:343, errcode =               

                              QUERY_EVALUATION_ERROR

                                  at com.sleepycat.dbxml.dbxml_javaJNI.XmlManager_query__SWIG_0(Native Method)

                                  at com.sleepycat.dbxml.XmlManager.query(XmlManager.java:544)

                                 at com.sleepycat.dbxml.XmlManager.query(XmlManager.java:320)

                                 at xmlirsystemstruxplus.XQueryEngine.queryEngine(XQueryEngine.java:269)

                                 at xmlirsystemstruxplus.XMLIRSystemStruXplus.main(XMLIRSystemStruXplus.java:109)

                                 Java Result: 1

    Note that i used  contains-any-of() function because the contains () function does not work with  'planet revenge 1998' string may be because the keywords do not appear in the order they appear in the element content.

   Please  can any body help me to find out  (1) why i have the  above error ? and solution  (2)  why  the condition contains  ( $entity/act/movie/title ,  'planet revenge 1998') is not working ? how do i use contains() function w.r.t this

Thank you in advance

Message was edited by: RokoA 19/01/2015  by RokoA

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2015
Added on Jan 17 2015
2 comments
2,466 views