Merge lp:~diogo-simoes89/zorba/DC-documentation into lp:zorba/data-cleaning-module

Proposed by Diogo Simões
Status: Rejected
Rejected by: Diogo Simões
Proposed branch: lp:~diogo-simoes89/zorba/DC-documentation
Merge into: lp:zorba/data-cleaning-module
Diff against target: 252 lines (+27/-27)
3 files modified
src/com/zorba-xquery/www/modules/data-cleaning/consolidation.xq (+19/-19)
src/com/zorba-xquery/www/modules/data-cleaning/conversion.xq (+5/-5)
src/com/zorba-xquery/www/modules/data-cleaning/set-similarity.xq (+3/-3)
To merge this branch: bzr merge lp:~diogo-simoes89/zorba/DC-documentation
Reviewer Review Type Date Requested Status
Zorba Coders Pending
Review via email: mp+103728@code.launchpad.net

Commit message

Changes in functions signatures

Description of the change

Addition of return types in functions signatures:
 Applied in conversion, consolidation and set-similarity modules.

To post a comment you must log in.
43. By Diogo Simões

Changes in documentation

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/com/zorba-xquery/www/modules/data-cleaning/consolidation.xq'
2--- src/com/zorba-xquery/www/modules/data-cleaning/consolidation.xq 2011-08-01 11:26:53 +0000
3+++ src/com/zorba-xquery/www/modules/data-cleaning/consolidation.xq 2012-04-27 15:23:18 +0000
4@@ -50,7 +50,7 @@
5 : @return The most frequent node in the input sequence.
6 : @example test/Queries/data-cleaning/consolidation/most-frequent.xq
7 :)
8-declare function con:most-frequent ( $s ) {
9+declare function con:most-frequent ( $s ) as item(){
10 (for $str in set:distinct($s) order by count($s[deep-equal(.,$str)]) descending return $str)[1]
11 };
12
13@@ -67,7 +67,7 @@
14 : @return The least frequent node in the input sequence.
15 : @example test/Queries/data-cleaning/consolidation/leastfrequent_1.xq
16 :)
17-declare function con:least-frequent ( $s ) {
18+declare function con:least-frequent ( $s ) as item(){
19 let $aux := for $str in set:distinct($s) order by count($s[deep-equal(.,$str)]) return $str
20 return if (count($aux) = 0) then () else ($aux[1])
21 };
22@@ -242,7 +242,7 @@
23 : @return The node having the largest number of descending elements in the input sequence.
24 : @example test/Queries/data-cleaning/consolidation/most-elements.xq
25 :)
26-declare function con:most-elements ( $s ) {
27+declare function con:most-elements ( $s ) as element(){
28 (for $str in set:distinct($s) order by count($str/descendant-or-self::element()) descending return $str)[1]
29 };
30
31@@ -260,7 +260,7 @@
32 : @return The node having the largest number of descending attributes in the input sequence.
33 : @example test/Queries/data-cleaning/consolidation/most-attributes.xq
34 :)
35-declare function con:most-attributes ( $s ) {
36+declare function con:most-attributes ( $s ) as element(){
37 (for $str in set:distinct($s) order by count($str/descendant-or-self::*/attribute()) descending return $str)[1]
38 };
39
40@@ -278,7 +278,7 @@
41 : @return The node having the largest number of descending nodes in the input sequence.
42 : @example test/Queries/data-cleaning/consolidation/most-nodes.xq
43 :)
44-declare function con:most-nodes ( $s ) {
45+declare function con:most-nodes ( $s ) as element(){
46 (for $str in set:distinct($s) order by count($str/descendant-or-self::node()) descending return $str)[1]
47 };
48
49@@ -296,7 +296,7 @@
50 : @return The node having the smallest number of descending elements in the input sequence.
51 : @example test/Queries/data-cleaning/consolidation/least-elements.xq
52 :)
53-declare function con:least-elements ( $s ) {
54+declare function con:least-elements ( $s ) as element(){
55 (for $str in set:distinct($s) order by count($str/descendant-or-self::element()) return $str)[1]
56 };
57
58@@ -314,7 +314,7 @@
59 : @return The node having the smallest number of descending attributes in the input sequence.
60 : @example test/Queries/data-cleaning/consolidation/least-attributes.xq
61 :)
62-declare function con:least-attributes ( $s ) {
63+declare function con:least-attributes ( $s ) as element(){
64 (for $str in set:distinct($s) order by count($str/descendant-or-self::*/attribute()) return $str)[1]
65 };
66
67@@ -332,7 +332,7 @@
68 : @return The node having the smallest number of descending nodes in the input sequence.
69 : @example test/Queries/data-cleaning/consolidation/least-nodes.xq
70 :)
71-declare function con:least-nodes ( $s ) {
72+declare function con:least-nodes ( $s ) as element(){
73 (for $str in set:distinct($s) order by count($str/descendant-or-self::node()) return $str)[1]
74 };
75
76@@ -350,7 +350,7 @@
77 : @return The node having the largest number of distinct descending elements in the input sequence.
78 : @example test/Queries/data-cleaning/consolidation/most-distinct-elements.xq
79 :)
80-declare function con:most-distinct-elements ( $s ) {
81+declare function con:most-distinct-elements ( $s ) as element(){
82 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::element())) descending return $str)[1]
83 };
84
85@@ -368,7 +368,7 @@
86 : @return The node having the largest number of distinct descending attributes in the input sequence.
87 : @example test/Queries/data-cleaning/consolidation/most-distinct-attributes.xq
88 :)
89-declare function con:most-distinct-attributes ( $s ) {
90+declare function con:most-distinct-attributes ( $s ) as element(){
91 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::*/attribute())) descending return $str)[1]
92 };
93
94@@ -386,7 +386,7 @@
95 : @return The node having the largest number of distinct descending nodes in the input sequence.
96 : @example test/Queries/data-cleaning/consolidation/most-distinct-nodes.xq
97 :)
98-declare function con:most-distinct-nodes ( $s ) {
99+declare function con:most-distinct-nodes ( $s ) as element(){
100 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::node())) descending return $str)[1]
101 };
102
103@@ -404,7 +404,7 @@
104 : @return The node having the smallest number of distinct descending elements in the input sequence.
105 : @example test/Queries/data-cleaning/consolidation/least-distinct-elements.xq
106 :)
107-declare function con:least-distinct-elements ( $s ) {
108+declare function con:least-distinct-elements ( $s ) as element(){
109 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::element())) return $str)[1]
110 };
111
112@@ -422,7 +422,7 @@
113 : @return The node having the smallest number of distinct descending attributes in the input sequence.
114 : @example test/Queries/data-cleaning/consolidation/least-distinct-attributes.xq
115 :)
116-declare function con:least-distinct-attributes ( $s ) {
117+declare function con:least-distinct-attributes ( $s ) as element(){
118 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::*/attribute())) return $str)[1]
119 };
120
121@@ -440,7 +440,7 @@
122 : @return The node having the smallest number of distinct descending nodes in the input sequence.
123 : @example test/Queries/data-cleaning/consolidation/least-distinct-nodes.xq
124 :)
125-declare function con:least-distinct-nodes ( $s ) {
126+declare function con:least-distinct-nodes ( $s ) as element(){
127 (for $str in set:distinct($s) order by count(set:distinct($str/descendant-or-self::node())) return $str)[1]
128 };
129
130@@ -457,7 +457,7 @@
131 : @param $paths A sequence of strings denoting XPath expressions.
132 : @return The elements that, when matched to the given set of XPath expressions, always return a non-empty set of nodes.
133 :)
134-declare function con:all-xpaths ( $s as element()* , $paths as xs:string* ) {
135+declare function con:all-xpaths ( $s as element()* , $paths as xs:string* ) as element()*{
136 (:
137 for $str in set:distinct($s)
138 where every $path in $paths satisfies count(
139@@ -484,7 +484,7 @@
140 : @return The elements that, when matched to the given set of XPath expressions, return a non-empty set of nodes
141 : for at least one of the cases.
142 :)
143-declare function con:some-xpaths ( $s as element()* , $paths as xs:string* ) {
144+declare function con:some-xpaths ( $s as element()* , $paths as xs:string* ) as element()*{
145 (:
146 for $str in set:distinct($s)
147 where some $path in $paths satisfies count(
148@@ -512,7 +512,7 @@
149 : @return The element that matches the largest number of XPath expressions producing a non-empty set of nodes.
150 :)
151
152-declare function con:most-xpaths ( $s as element()* , $paths as xs:string* ) {
153+declare function con:most-xpaths ( $s as element()* , $paths as xs:string* ) as element()*{
154 (:
155 (
156 for $str in set:distinct($s)
157@@ -543,7 +543,7 @@
158 : @return The element that matches the smallest number of XPath expressions producing a non-empty set of nodes.
159 :)
160
161-declare function con:least-xpaths ( $s as element()* , $paths as xs:string* ) {
162+declare function con:least-xpaths ( $s as element()* , $paths as xs:string* ) as element()*{
163 (:
164 (
165 for $str in set:distinct($s)
166@@ -574,6 +574,6 @@
167 : <br/><br/><b> Attention : This function is still not implemented. </b> <br/>
168 :
169 :)
170-declare function con:validating-schema ( $s as element()*, $schema as element() ) {
171+declare function con:validating-schema ( $s as element()*, $schema as element() ) as element()*{
172 false()
173 };
174
175=== modified file 'src/com/zorba-xquery/www/modules/data-cleaning/conversion.xq'
176--- src/com/zorba-xquery/www/modules/data-cleaning/conversion.xq 2012-04-11 09:50:34 +0000
177+++ src/com/zorba-xquery/www/modules/data-cleaning/conversion.xq 2012-04-27 15:23:18 +0000
178@@ -191,7 +191,7 @@
179 : @return The value resulting from the conversion
180 : @example test/Queries/data-cleaning/conversion/unit-convert.xq
181 :)
182-declare %an:nondeterministic function conversion:unit-convert ( $v as xs:double, $t as xs:string, $m1 as xs:string, $m2 as xs:string ) {
183+declare %an:nondeterministic function conversion:unit-convert ( $v as xs:double, $t as xs:string, $m1 as xs:string, $m2 as xs:string ) as xs:double {
184 if ( $m1 = $m2 ) then $v else
185
186 let $conversion-table :=
187@@ -351,7 +351,7 @@
188 : @see http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
189 : @example test/Queries/data-cleaning/conversion/currency-convert.xq
190 :)
191-declare %an:nondeterministic function conversion:currency-convert ( $v as xs:double, $m1 as xs:string, $m2 as xs:string, $date as xs:string ) {
192+declare %an:nondeterministic function conversion:currency-convert ( $v as xs:double, $m1 as xs:string, $m2 as xs:string, $date as xs:string ) as xs:double{
193 let $daily := "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"
194 let $hist := "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml"
195 let $doc := if (string-length($date) = 0) then http:get-node($daily)[2] else
196@@ -374,7 +374,7 @@
197 : <br/><br/><b> Attention : This function is still not implemented. </b> <br/>
198 :
199 :)
200-declare function conversion:phone-from-domain ( $domain as xs:string ) {
201+declare function conversion:phone-from-domain ( $domain as xs:string ) as xs:string*{
202 ()
203 };
204
205@@ -388,7 +388,7 @@
206 : <br/><br/><b> Attention : This function is still not implemented. </b> <br/>
207 :
208 :)
209-declare function conversion:address-from-domain ( $domain as xs:string ) {
210+declare function conversion:address-from-domain ( $domain as xs:string ) as xs:string*{
211 ()
212 };
213
214@@ -402,6 +402,6 @@
215 : <br/><br/><b> Attention : This function is still not implemented. </b> <br/>
216 :
217 :)
218-declare function conversion:name-from-domain ( $domain as xs:string ) {
219+declare function conversion:name-from-domain ( $domain as xs:string ) as xs:string*{
220 ()
221 };
222
223=== modified file 'src/com/zorba-xquery/www/modules/data-cleaning/set-similarity.xq'
224--- src/com/zorba-xquery/www/modules/data-cleaning/set-similarity.xq 2011-08-01 11:26:53 +0000
225+++ src/com/zorba-xquery/www/modules/data-cleaning/set-similarity.xq 2012-04-27 15:23:18 +0000
226@@ -46,7 +46,7 @@
227 : @return The union of both sets.
228 : @example test/Queries/data-cleaning/set-similarity/deep-union.xq
229 :)
230-declare function set:deep-union ( $s1 , $s2 ) {
231+declare function set:deep-union ( $s1 , $s2 ) as item()*{
232 let $s := ( $s1 , $s2 )
233 for $a at $apos in $s
234 where every $ba in subsequence($s, 1, $apos - 1) satisfies not(deep-equal($ba,$a))
235@@ -66,7 +66,7 @@
236 : @return The intersection of both sets.
237 : @example test/Queries/data-cleaning/set-similarity/deep-intersect.xq
238 :)
239-declare function set:deep-intersect ( $s1 , $s2 ) {
240+declare function set:deep-intersect ( $s1 , $s2 ) as item()*{
241 for $a at $apos in $s1
242 let $t1 := every $ba in subsequence($s1, 1, $apos - 1) satisfies not(deep-equal($ba,$a))
243 let $t2 := some $bb in $s2 satisfies deep-equal($bb,$a)
244@@ -86,7 +86,7 @@
245 : @return The set provided as input without the exact duplicates (i.e., returns the distinct nodes from the set provided as input).
246 : @example test/Queries/data-cleaning/set-similarity/distinct.xq
247 :)
248-declare function set:distinct ( $s ) {
249+declare function set:distinct ( $s ) as item()*{
250 for $a at $apos in $s
251 where every $ba in subsequence($s, 1, $apos - 1) satisfies not(deep-equal($ba,$a))
252 return $a

Subscribers

People subscribed via source and target branches

to all changes: