Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/feature-ft_module 
into lp:zorba.

Requested reviews:
  Paul J. Lucas (paul-lucas)
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #944795 in Zorba: "XQDoc doesn't handle & in URLs"
  https://bugs.launchpad.net/zorba/+bug/944795

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-ft_module/+merge/109457

1. Fixed return type of ft:thesaurus-lookup().
2. Added a test to ensure that a look-up of a non-existant word works.
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-ft_module/+merge/109457
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/full-text.xq'
--- modules/com/zorba-xquery/www/modules/full-text.xq	2012-05-17 22:44:24 +0000
+++ modules/com/zorba-xquery/www/modules/full-text.xq	2012-06-08 23:39:24 +0000
@@ -636,7 +636,7 @@
  : The phrase's
  : <a href="http://www.w3.org/TR/xmlschema-2/#language";>language</a>
  : is assumed to be the one returned by <code>ft:current-lang()</code>.
- : @return the original and related phrases.
+ : @return the related phrases.
  : @error err:FTST0009 if <code>ft:current-lang()</code> is not supported.
  : @error zerr:ZXQP8401 if the thesaurus data file's version is not supported
  : by the currently running version of Zorba.
@@ -646,7 +646,7 @@
  : @example test/rbkt/Queries/zorba/fulltext/ft-module-thesaurus-lookup-1.xq
  :)
 declare function ft:thesaurus-lookup( $phrase as xs:string )
-  as xs:string+ external;
+  as xs:string* external;
 
 (:~
  : Looks-up the given phrase in the thesaurus specified by the given URI.
@@ -656,7 +656,7 @@
  : @param $lang The
  : <a href="http://www.w3.org/TR/xmlschema-2/#language";>language</a>
  : of <code>$phrase</code>.
- : @return the original and related phrases.
+ : @return the related phrases.
  : @error err:FTST0009 if <code>$lang</code> is not supported.
  : @error err:FTST0018 if <code>$uri</code> refers to a thesaurus
  : that is not found in the statically known thesauri.
@@ -671,7 +671,7 @@
  :)
 declare function ft:thesaurus-lookup( $uri as xs:string, $phrase as xs:string,
                                       $lang as xs:language )
-  as xs:string+ external;
+  as xs:string* external;
 
 (:~
  : Looks-up the given phrase in a thesaurus.
@@ -681,7 +681,7 @@
  : The phrase's
  : <a href="http://www.w3.org/TR/xmlschema-2/#language";>language</a>
  : is assumed to be the one the one returned by <code>ft:current-lang()</code>.
- : @return the original and related phrases.
+ : @return the related phrases.
  : @error err:FTST0009 if <code>ft:current-lang()</code> is unsupported.
  : @error err:FTST0018 if <code>$uri</code> refers to a thesaurus
  : that is not found in the statically known thesauri.
@@ -695,7 +695,7 @@
  : @example test/rbkt/Queries/zorba/fulltext/ft-module-thesaurus-lookup-3.xq
  :)
 declare function ft:thesaurus-lookup( $uri as xs:string, $phrase as xs:string )
-  as xs:string+ external;
+  as xs:string* external;
 
 (:~
  : Looks-up the given phrase in a thesaurus.
@@ -707,7 +707,7 @@
  : of <code>$phrase</code>.
  : @param $relationship The relationship the results are to have to
  : <code>$phrase</code>.
- : @return the original and related phrases.
+ : @return the related phrases.
  : @error err:FTST0018 if <code>$uri</code> refers to a thesaurus
  : that is not found in the statically known thesauri.
  : @error err:FTST0009 if <code>$lang</code> is not supported.
@@ -723,7 +723,7 @@
 declare function ft:thesaurus-lookup( $uri as xs:string, $phrase as xs:string,
                                       $lang as xs:language,
                                       $relationship as xs:string )
-  as xs:string+ external;
+  as xs:string* external;
 
 (:~
  : Looks-up the given phrase in a thesaurus.
@@ -739,7 +739,7 @@
  : travers$ed.
  : @param $level-most The maximum number of levels within the thesaurus to be
  : traversed.
- : @return the original and related phrases.
+ : @return the related phrases.
  : @error err:FOCA0003 if either <code>$level-least</code> or
  : <code>$level-most</code> is either negative or too large.
  : @error err:FTST0018 if <code>$uri</code> refers to a thesaurus
@@ -759,7 +759,7 @@
                                       $relationship as xs:string,
                                       $level-least as xs:integer,
                                       $level-most as xs:integer )
-  as xs:string+ external;
+  as xs:string* external;
 
 (:~
  : Tokenizes the given node and all of its descendants.

=== modified file 'src/functions/pregenerated/func_ft_module.cpp'
--- src/functions/pregenerated/func_ft_module.cpp	2012-04-26 13:25:13 +0000
+++ src/functions/pregenerated/func_ft_module.cpp	2012-06-08 23:39:24 +0000
@@ -366,7 +366,7 @@
     DECL_WITH_KIND(sctx, full_text_thesaurus_lookup,
         (createQName("http://www.zorba-xquery.com/modules/full-text","","thesaurus-lookup";), 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FULL_TEXT_THESAURUS_LOOKUP_1);
 
   }
@@ -383,7 +383,7 @@
         (createQName("http://www.zorba-xquery.com/modules/full-text","","thesaurus-lookup";), 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FULL_TEXT_THESAURUS_LOOKUP_2);
 
   }
@@ -401,7 +401,7 @@
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.LANGUAGE_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FULL_TEXT_THESAURUS_LOOKUP_3);
 
   }
@@ -420,7 +420,7 @@
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.LANGUAGE_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FULL_TEXT_THESAURUS_LOOKUP_4);
 
   }
@@ -441,7 +441,7 @@
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
         GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
-        GENV_TYPESYSTEM.STRING_TYPE_PLUS),
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FULL_TEXT_THESAURUS_LOOKUP_6);
 
   }

=== modified file 'src/runtime/spec/full_text/ft_module.xml'
--- src/runtime/spec/full_text/ft_module.xml	2012-05-17 18:16:26 +0000
+++ src/runtime/spec/full_text/ft_module.xml	2012-06-08 23:39:24 +0000
@@ -127,25 +127,25 @@
   <zorba:function>
     <zorba:signature localname="thesaurus-lookup" prefix="full-text">
       <zorba:param>xs:string</zorba:param>    <!-- phrase -->
-      <zorba:output>xs:string+</zorba:output>
+      <zorba:output>xs:string*</zorba:output>
     </zorba:signature>
     <zorba:signature localname="thesaurus-lookup" prefix="full-text">
       <zorba:param>xs:string</zorba:param>    <!-- URI -->
       <zorba:param>xs:string</zorba:param>    <!-- phrase -->
-      <zorba:output>xs:string+</zorba:output>
+      <zorba:output>xs:string*</zorba:output>
     </zorba:signature>
     <zorba:signature localname="thesaurus-lookup" prefix="full-text">
       <zorba:param>xs:string</zorba:param>    <!-- URI -->
       <zorba:param>xs:string</zorba:param>    <!-- phrase -->
       <zorba:param>xs:language</zorba:param>  <!-- lang -->
-      <zorba:output>xs:string+</zorba:output>
+      <zorba:output>xs:string*</zorba:output>
     </zorba:signature>
     <zorba:signature localname="thesaurus-lookup" prefix="full-text">
       <zorba:param>xs:string</zorba:param>    <!-- URI -->
       <zorba:param>xs:string</zorba:param>    <!-- phrase -->
       <zorba:param>xs:language</zorba:param>  <!-- lang -->
       <zorba:param>xs:string</zorba:param>    <!-- relationship -->
-      <zorba:output>xs:string+</zorba:output>
+      <zorba:output>xs:string*</zorba:output>
     </zorba:signature>
     <zorba:signature localname="thesaurus-lookup" prefix="full-text">
       <zorba:param>xs:string</zorba:param>    <!-- URI -->
@@ -154,7 +154,7 @@
       <zorba:param>xs:string</zorba:param>    <!-- relationship -->
       <zorba:param>xs:integer</zorba:param>   <!-- level-least -->
       <zorba:param>xs:integer</zorba:param>   <!-- level-most -->
-      <zorba:output>xs:string+</zorba:output>
+      <zorba:output>xs:string*</zorba:output>
     </zorba:signature>
   </zorba:function>
   <zorba:state generateInit="use-default">

=== added file 'test/rbkt/ExpQueryResults/zorba/fulltext/ft-module-thesaurus-lookup-6.xml.res'
--- test/rbkt/ExpQueryResults/zorba/fulltext/ft-module-thesaurus-lookup-6.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/fulltext/ft-module-thesaurus-lookup-6.xml.res	2012-06-08 23:39:24 +0000
@@ -0,0 +1,1 @@
+true

=== added file 'test/rbkt/Queries/zorba/fulltext/ft-module-thesaurus-lookup-6.xq'
--- test/rbkt/Queries/zorba/fulltext/ft-module-thesaurus-lookup-6.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/fulltext/ft-module-thesaurus-lookup-6.xq	2012-06-08 23:39:24 +0000
@@ -0,0 +1,6 @@
+import module namespace ft = "http://www.zorba-xquery.com/modules/full-text";;
+
+declare ft-option using language "en";
+
+let $synonyms := ft:thesaurus-lookup( "no_such_word" )
+return fn:empty( $synonyms )

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to