Merge lp:~zorba-coders/zorba/bug-1041445 into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Ghislain Fourny
Approved revision: 11044
Merged at revision: 11044
Proposed branch: lp:~zorba-coders/zorba/bug-1041445
Merge into: lp:zorba
Diff against target: 981 lines (+338/-120)
42 files modified
ChangeLog (+1/-0)
include/zorba/store_consts.h (+1/-1)
modules/org/jsoniq/www/functions.xq (+20/-3)
src/api/serialization/serializer.cpp (+1/-1)
src/context/static_context.cpp (+2/-2)
src/context/static_context.h (+1/-1)
src/functions/func_jsoniq_functions_impl.cpp (+1/-1)
src/functions/pregenerated/func_jsoniq_functions.cpp (+29/-1)
src/functions/pregenerated/func_jsoniq_functions.h (+16/-0)
src/functions/pregenerated/function_enum.h (+1/-0)
src/runtime/booleans/BooleanImpl.cpp (+22/-13)
src/runtime/core/arithmetic_impl.cpp (+20/-16)
src/runtime/json/jsoniq_functions_impl.cpp (+25/-1)
src/runtime/json/pregenerated/jsoniq_functions.cpp (+25/-0)
src/runtime/json/pregenerated/jsoniq_functions.h (+32/-0)
src/runtime/pregenerated/iterator_enum.h (+1/-0)
src/runtime/spec/json/jsoniq_functions.xml (+36/-18)
src/runtime/spec/mappings.xml (+1/-1)
src/runtime/visitors/pregenerated/planiter_visitor.h (+7/-0)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+15/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+5/-0)
src/store/naive/json_items.cpp (+4/-4)
src/store/naive/json_items.h (+1/-1)
src/store/naive/store.cpp (+7/-7)
src/store/naive/store.h (+4/-4)
src/types/casting.cpp (+2/-2)
src/types/root_typemanager.cpp (+25/-25)
src/types/root_typemanager.h (+5/-5)
src/zorbaserialization/serialize_zorba_types.cpp (+2/-2)
test/rbkt/ExpQueryResults/zorba/jsoniq/null02.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/null04.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/null05.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/null08.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/serializer-JNSE0022.xml.res (+1/-1)
test/rbkt/Queries/zorba/jsoniq/null01.xq (+1/-3)
test/rbkt/Queries/zorba/jsoniq/null02.xq (+1/-3)
test/rbkt/Queries/zorba/jsoniq/null03.xq (+1/-3)
test/rbkt/Queries/zorba/jsoniq/null04.xq (+2/-0)
test/rbkt/Queries/zorba/jsoniq/null05.xq (+2/-0)
test/rbkt/Queries/zorba/jsoniq/null06.xq (+3/-0)
test/rbkt/Queries/zorba/jsoniq/null07.xq (+1/-0)
test/rbkt/Queries/zorba/jsoniq/null08.xq (+10/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1041445
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Till Westmann Approve
Review via email: mp+124191@code.launchpad.net

Commit message

Implementing semantics of arithmetics and comparison operators for JSON nulls.

Description of the change

Implementing semantics of arithmetics and comparison operators for JSON nulls.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug-1041445 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-1041445-2012-09-13T12-55-25.237Z is finished. The
  final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1041445-2012-09-13T13-31-14.234Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Pending.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Maybe we should add the change to the ChangeLog.

Revision history for this message
Till Westmann (tillw) :
review: Approve
lp:~zorba-coders/zorba/bug-1041445 updated
11043. By Ghislain Fourny

Merged trunk back.

11044. By Ghislain Fourny

Edited ChangeLog.

Revision history for this message
Ghislain Fourny (gislenius) wrote :

I edited the ChangeLog.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1041445-2012-09-14T15-02-24.445Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-09-14 04:33:18 +0000
3+++ ChangeLog 2012-09-14 14:40:27 +0000
4@@ -12,6 +12,7 @@
5 functions. jn:object is also supported.
6 * jn:parse-json can parse multiple top-level JSON items. Also, there is jn:parse-json#2 that
7 takes options to parameterize the parsing process (see bug #1047547)
8+ * Implemented semantics of null for comparison and arithmetics operations.
9
10 Optimizations:
11 * New memory management for compiler expressions (no more ref counting)
12
13=== modified file 'include/zorba/store_consts.h'
14--- include/zorba/store_consts.h 2012-09-11 22:55:05 +0000
15+++ include/zorba/store_consts.h 2012-09-14 14:40:27 +0000
16@@ -84,7 +84,7 @@
17 XS_QNAME = 43,
18 XS_NOTATION = 44,
19
20- JDM_NULL = 45,
21+ JS_NULL = 45,
22
23 XS_LAST
24 };
25
26=== modified file 'modules/org/jsoniq/www/functions.xq'
27--- modules/org/jsoniq/www/functions.xq 2012-09-11 22:55:05 +0000
28+++ modules/org/jsoniq/www/functions.xq 2012-09-14 14:40:27 +0000
29@@ -35,11 +35,9 @@
30
31 import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
32
33-declare namespace jdm = "http://www.jsoniq.org/";
34-
35 declare namespace err = "http://www.w3.org/2005/xqt-errors";
36-
37 declare namespace jerr = "http://www.jsoniq.org/errors";
38+declare namespace js = "http://www.jsoniq.org/types";
39
40 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
41 declare option ver:module-version "1.0";
42@@ -180,3 +178,22 @@
43 : @error jerr:JNDY0003 if there is a pair collision.
44 :)
45 declare function jn:object($o as object()*) as object() external;
46+
47+(:~
48+ : Returns the JSON null.
49+ :
50+ : @return The JSON null.
51+ :)
52+declare function jn:null() as js:null external;
53+
54+(:~
55+ : Tests whether the supplied atomic item is a JSON null.
56+ :
57+ : @param An atomic item.
58+ :
59+ : @return true if the item is of type js:null.
60+ :)
61+declare function jn:is-null($i as xs:anyAtomicType) as xs:boolean external;
62+
63+
64+
65
66=== modified file 'src/api/serialization/serializer.cpp'
67--- src/api/serialization/serializer.cpp 2012-09-13 08:28:50 +0000
68+++ src/api/serialization/serializer.cpp 2012-09-14 14:40:27 +0000
69@@ -1040,7 +1040,7 @@
70 tr << (item->getBooleanValue() ? "true" : "false");
71 break;
72
73- case store::JDM_NULL:
74+ case store::JS_NULL:
75 tr << "null";
76 break;
77
78
79=== modified file 'src/context/static_context.cpp'
80--- src/context/static_context.cpp 2012-09-11 22:55:05 +0000
81+++ src/context/static_context.cpp 2012-09-14 14:40:27 +0000
82@@ -397,8 +397,8 @@
83 #ifdef ZORBA_WITH_JSON
84
85 const char*
86-static_context::JSONIQ_NS =
87-"http://www.jsoniq.org/";
88+static_context::JSONIQ_DM_NS =
89+"http://www.jsoniq.org/types";
90
91 const char*
92 static_context::JSONIQ_FN_NS =
93
94=== modified file 'src/context/static_context.h'
95--- src/context/static_context.h 2012-09-11 22:55:05 +0000
96+++ src/context/static_context.h 2012-09-14 14:40:27 +0000
97@@ -527,7 +527,7 @@
98 static const char* ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS;
99
100 #ifdef ZORBA_WITH_JSON
101- static const char* JSONIQ_NS;
102+ static const char* JSONIQ_DM_NS;
103 static const char* JSONIQ_FN_NS;
104 #endif
105
106
107=== modified file 'src/functions/func_jsoniq_functions_impl.cpp'
108--- src/functions/func_jsoniq_functions_impl.cpp 2012-09-13 08:28:50 +0000
109+++ src/functions/func_jsoniq_functions_impl.cpp 2012-09-14 14:40:27 +0000
110@@ -145,7 +145,7 @@
111 return type;
112
113 if (type->max_card() == 0)
114- return GENV_TYPESYSTEM.JDM_NULL_TYPE_ONE;
115+ return GENV_TYPESYSTEM.JS_NULL_TYPE_ONE;
116
117 return theSignature.returnType();
118 }
119
120=== modified file 'src/functions/pregenerated/func_jsoniq_functions.cpp'
121--- src/functions/pregenerated/func_jsoniq_functions.cpp 2012-09-11 22:55:05 +0000
122+++ src/functions/pregenerated/func_jsoniq_functions.cpp 2012-09-14 14:40:27 +0000
123@@ -142,6 +142,18 @@
124
125 #endif
126 #ifdef ZORBA_WITH_JSON
127+PlanIter_t fn_jsoniq_is_null::codegen(
128+ CompilerCB*,
129+ static_context* sctx,
130+ const QueryLoc& loc,
131+ std::vector<PlanIter_t>& argv,
132+ expr& ann) const
133+{
134+ return new JSONIsNullIterator(sctx, loc, argv[0]);
135+}
136+
137+#endif
138+#ifdef ZORBA_WITH_JSON
139 PlanIter_t op_zorba_json_array_insert::codegen(
140 CompilerCB*,
141 static_context* sctx,
142@@ -379,7 +391,7 @@
143 {
144 DECL_WITH_KIND(sctx, fn_jsoniq_null,
145 (createQName("http://www.jsoniq.org/functions","","null"),
146- GENV_TYPESYSTEM.JDM_NULL_TYPE_ONE),
147+ GENV_TYPESYSTEM.JS_NULL_TYPE_ONE),
148 FunctionConsts::FN_JSONIQ_NULL_0);
149
150 }
151@@ -392,6 +404,22 @@
152
153
154 {
155+ DECL_WITH_KIND(sctx, fn_jsoniq_is_null,
156+ (createQName("http://www.jsoniq.org/functions","","is-null"),
157+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_ONE,
158+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
159+ FunctionConsts::FN_JSONIQ_IS_NULL_1);
160+
161+ }
162+
163+
164+#endif
165+
166+
167+#ifdef ZORBA_WITH_JSON
168+
169+
170+ {
171 DECL_WITH_KIND(sctx, op_zorba_json_array_insert,
172 (createQName("http://www.zorba-xquery.com/internal/zorba-ops","","json-array-insert"),
173 GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE,
174
175=== modified file 'src/functions/pregenerated/func_jsoniq_functions.h'
176--- src/functions/pregenerated/func_jsoniq_functions.h 2012-09-13 08:28:50 +0000
177+++ src/functions/pregenerated/func_jsoniq_functions.h 2012-09-14 14:40:27 +0000
178@@ -234,6 +234,22 @@
179 #endif
180 #ifdef ZORBA_WITH_JSON
181
182+//fn-jsoniq:is-null
183+class fn_jsoniq_is_null : public function
184+{
185+public:
186+ fn_jsoniq_is_null(const signature& sig, FunctionConsts::FunctionKind kind)
187+ :
188+ function(sig, kind)
189+ {
190+
191+ }
192+
193+ CODEGEN_DECL();
194+};
195+#endif
196+#ifdef ZORBA_WITH_JSON
197+
198 //op-zorba:json-array-insert
199 class op_zorba_json_array_insert : public function
200 {
201
202=== modified file 'src/functions/pregenerated/function_enum.h'
203--- src/functions/pregenerated/function_enum.h 2012-09-13 08:28:50 +0000
204+++ src/functions/pregenerated/function_enum.h 2012-09-14 14:40:27 +0000
205@@ -238,6 +238,7 @@
206 FN_JSONIQ_FLATTEN_1,
207 OP_ZORBA_JSON_ITEM_ACCESSOR_2,
208 FN_JSONIQ_NULL_0,
209+ FN_JSONIQ_IS_NULL_1,
210 OP_ZORBA_JSON_ARRAY_INSERT_3,
211 OP_ZORBA_JSON_DELETE_2,
212 OP_ZORBA_JSON_REPLACE_VALUE_3,
213
214=== modified file 'src/runtime/booleans/BooleanImpl.cpp'
215--- src/runtime/booleans/BooleanImpl.cpp 2012-09-11 22:55:05 +0000
216+++ src/runtime/booleans/BooleanImpl.cpp 2012-09-14 14:40:27 +0000
217@@ -142,7 +142,7 @@
218 TypeOps::is_subtype(type, store::XS_STRING) ||
219 TypeOps::is_subtype(type, store::XS_ANY_URI) ||
220 type == store::XS_UNTYPED_ATOMIC ||
221- type == store::JDM_NULL ||
222+ type == store::JS_NULL ||
223 TypeOps::is_numeric(type)))
224 {
225 // atomic type xs_boolean, xs_string, xs_anyURI, xs_untypedAtomic
226@@ -488,19 +488,23 @@
227 if (consumeNext(item0, theChild0.getp(), planState) &&
228 consumeNext(item1, theChild1.getp(), planState))
229 {
230- STACK_PUSH(GENV_ITEMFACTORY->
231- createBoolean(result,
232- CompareIterator::valueComparison(loc,
233- item0,
234- item1,
235- theCompType,
236- theTypeManager,
237- theTimezone,
238- theCollation)),
239- state);
240+ if (item0->getTypeCode() != store::JS_NULL &&
241+ item1->getTypeCode() != store::JS_NULL)
242+ {
243+ STACK_PUSH(GENV_ITEMFACTORY->
244+ createBoolean(result,
245+ CompareIterator::valueComparison(loc,
246+ item0,
247+ item1,
248+ theCompType,
249+ theTypeManager,
250+ theTimezone,
251+ theCollation)),
252+ state);
253
254- assert(!consumeNext(item0, theChild0.getp(), planState) &&
255- !consumeNext(item1, theChild1.getp(), planState));
256+ assert(!consumeNext(item0, theChild0.getp(), planState) &&
257+ !consumeNext(item1, theChild1.getp(), planState));
258+ }
259 }
260 }
261
262@@ -685,6 +689,11 @@
263 long timezone,
264 XQPCollator* aCollation)
265 {
266+ if (aItem0->getTypeCode() == store::JS_NULL ||
267+ aItem1->getTypeCode() == store::JS_NULL)
268+ {
269+ return false;
270+ }
271 try
272 {
273 switch(aCompType)
274
275=== modified file 'src/runtime/core/arithmetic_impl.cpp'
276--- src/runtime/core/arithmetic_impl.cpp 2012-09-11 22:55:05 +0000
277+++ src/runtime/core/arithmetic_impl.cpp 2012-09-14 14:40:27 +0000
278@@ -115,24 +115,28 @@
279 {
280 if (this->consumeNext(n1, this->theChild1.getp(), planState))
281 {
282- status = compute(result,
283- planState.theLocalDynCtx,
284- this->theSctx->get_typemanager(),
285- this->loc,
286- n0,
287- n1);
288- /*
289- if (this->consumeNext(n0, this->theChild0.getp(), planState) ||
290- this->consumeNext(n1, this->theChild1.getp(), planState))
291+ if (n0->getTypeCode() != store::JS_NULL &&
292+ n1->getTypeCode() != store::JS_NULL)
293 {
294- throw XQUERY_EXCEPTION(
295- err::XPTY0004,
296- ERROR_PARAMS( ZED( NoSeqAsArithOp ) ),
297- ERROR_LOC( this->loc )
298- );
299+ status = compute(result,
300+ planState.theLocalDynCtx,
301+ this->theSctx->get_typemanager(),
302+ this->loc,
303+ n0,
304+ n1);
305+ /*
306+ if (this->consumeNext(n0, this->theChild0.getp(), planState) ||
307+ this->consumeNext(n1, this->theChild1.getp(), planState))
308+ {
309+ throw XQUERY_EXCEPTION(
310+ err::XPTY0004,
311+ ERROR_PARAMS( ZED( NoSeqAsArithOp ) ),
312+ ERROR_LOC( this->loc )
313+ );
314+ }
315+ */
316+ STACK_PUSH ( status, state );
317 }
318- */
319- STACK_PUSH ( status, state );
320 }
321 }
322
323
324=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
325--- src/runtime/json/jsoniq_functions_impl.cpp 2012-09-11 22:55:05 +0000
326+++ src/runtime/json/jsoniq_functions_impl.cpp 2012-09-14 14:40:27 +0000
327@@ -512,7 +512,7 @@
328
329
330 /*******************************************************************************
331- j:null()) as jdm:null
332+ jn:null() as jn:null
333 ********************************************************************************/
334 bool
335 JSONNullIterator::nextImpl(
336@@ -529,6 +529,30 @@
337
338
339 /*******************************************************************************
340+ jn:is-null(xs:anyAtomicType) as xs:boolean
341+********************************************************************************/
342+bool
343+JSONIsNullIterator::nextImpl(
344+ store::Item_t& result,
345+ PlanState& planState) const
346+{
347+ PlanIteratorState* state;
348+ store::Item_t lItem;
349+ bool lIsNull;
350+
351+ DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
352+
353+ consumeNext(lItem, theChild.getp(), planState);
354+
355+ lIsNull = (lItem->getTypeCode() == store::JS_NULL);
356+
357+ STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, lIsNull), state);
358+
359+ STACK_END(state);
360+}
361+
362+
363+/*******************************************************************************
364 updating function op-zorba:object-insert(
365 $o as object(),
366 $name1 as xs:string, $value1 as item(),
367
368=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.cpp'
369--- src/runtime/json/pregenerated/jsoniq_functions.cpp 2012-09-11 22:55:05 +0000
370+++ src/runtime/json/pregenerated/jsoniq_functions.cpp 2012-09-14 14:40:27 +0000
371@@ -327,6 +327,31 @@
372
373 #endif
374 #ifdef ZORBA_WITH_JSON
375+// <JSONIsNullIterator>
376+SERIALIZABLE_CLASS_VERSIONS(JSONIsNullIterator)
377+
378+void JSONIsNullIterator::serialize(::zorba::serialization::Archiver& ar)
379+{
380+ serialize_baseclass(ar,
381+ (UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>*)this);
382+}
383+
384+
385+void JSONIsNullIterator::accept(PlanIterVisitor& v) const
386+{
387+ v.beginVisit(*this);
388+
389+ theChild->accept(v);
390+
391+ v.endVisit(*this);
392+}
393+
394+JSONIsNullIterator::~JSONIsNullIterator() {}
395+
396+// </JSONIsNullIterator>
397+
398+#endif
399+#ifdef ZORBA_WITH_JSON
400 // <JSONArrayInsertIterator>
401 SERIALIZABLE_CLASS_VERSIONS(JSONArrayInsertIterator)
402
403
404=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
405--- src/runtime/json/pregenerated/jsoniq_functions.h 2012-09-11 22:55:05 +0000
406+++ src/runtime/json/pregenerated/jsoniq_functions.h 2012-09-14 14:40:27 +0000
407@@ -418,6 +418,38 @@
408 #ifdef ZORBA_WITH_JSON
409 /**
410 *
411+ * Author:
412+ */
413+class JSONIsNullIterator : public UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>
414+{
415+public:
416+ SERIALIZABLE_CLASS(JSONIsNullIterator);
417+
418+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONIsNullIterator,
419+ UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>);
420+
421+ void serialize( ::zorba::serialization::Archiver& ar);
422+
423+ JSONIsNullIterator(
424+ static_context* sctx,
425+ const QueryLoc& loc,
426+ PlanIter_t& child)
427+ :
428+ UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>(sctx, loc, child)
429+ {}
430+
431+ virtual ~JSONIsNullIterator();
432+
433+ void accept(PlanIterVisitor& v) const;
434+
435+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
436+};
437+
438+#endif
439+
440+#ifdef ZORBA_WITH_JSON
441+/**
442+ *
443 * internal function
444 *
445 * Author: Zorba Team
446
447=== modified file 'src/runtime/pregenerated/iterator_enum.h'
448--- src/runtime/pregenerated/iterator_enum.h 2012-09-13 08:28:50 +0000
449+++ src/runtime/pregenerated/iterator_enum.h 2012-09-14 14:40:27 +0000
450@@ -161,6 +161,7 @@
451 TYPE_JSONArrayFlattenIterator,
452 TYPE_JSONItemAccessorIterator,
453 TYPE_JSONNullIterator,
454+ TYPE_JSONIsNullIterator,
455 TYPE_JSONArrayInsertIterator,
456 TYPE_JSONDeleteIterator,
457 TYPE_JSONReplaceValueIterator,
458
459=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
460--- src/runtime/spec/json/jsoniq_functions.xml 2012-09-13 08:28:50 +0000
461+++ src/runtime/spec/json/jsoniq_functions.xml 2012-09-14 14:40:27 +0000
462@@ -267,24 +267,42 @@
463 </zorba:iterator>
464
465
466-<!--
467-/*******************************************************************************
468-********************************************************************************/
469--->
470-<zorba:iterator name="JSONNullIterator" arity="noary"
471- preprocessorGuard="#ifdef ZORBA_WITH_JSON">
472-
473- <zorba:function isDeterministic="true">
474- <zorba:signature localname="null" prefix="fn-jsoniq">
475- <zorba:output>jdm:null</zorba:output>
476- </zorba:signature>
477-
478- </zorba:function>
479-
480-</zorba:iterator>
481-
482-
483-<!--
484+ <!--
485+/*******************************************************************************
486+********************************************************************************/
487+-->
488+ <zorba:iterator name="JSONNullIterator" arity="noary"
489+ preprocessorGuard="#ifdef ZORBA_WITH_JSON">
490+
491+ <zorba:function isDeterministic="true">
492+ <zorba:signature localname="null" prefix="fn-jsoniq">
493+ <zorba:output>js:null</zorba:output>
494+ </zorba:signature>
495+
496+ </zorba:function>
497+
498+ </zorba:iterator>
499+
500+
501+ <!--
502+/*******************************************************************************
503+********************************************************************************/
504+-->
505+ <zorba:iterator name="JSONIsNullIterator" arity="unary"
506+ preprocessorGuard="#ifdef ZORBA_WITH_JSON">
507+
508+ <zorba:function isDeterministic="true">
509+ <zorba:signature localname="is-null" prefix="fn-jsoniq">
510+ <zorba:param>xs:anyAtomicType</zorba:param>
511+ <zorba:output>xs:boolean</zorba:output>
512+ </zorba:signature>
513+
514+ </zorba:function>
515+
516+ </zorba:iterator>
517+
518+
519+ <!--
520 /*******************************************************************************
521 ********************************************************************************/
522 <zorba:iterator name="JSONObjectInsertIterator" arity="nary"
523
524=== modified file 'src/runtime/spec/mappings.xml'
525--- src/runtime/spec/mappings.xml 2012-09-11 22:55:05 +0000
526+++ src/runtime/spec/mappings.xml 2012-09-14 14:40:27 +0000
527@@ -207,7 +207,7 @@
528 <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type>
529 <zorba:type zorbaType="JSON_ARRAY">array()</zorba:type>
530 <zorba:type zorbaType="JSON_OBJECT">object()</zorba:type>
531- <zorba:type zorbaType="JDM_NULL">jdm:null</zorba:type>
532+ <zorba:type zorbaType="JS_NULL">js:null</zorba:type>
533 </zorba:types>
534
535 <!-- XQuery Occurrence Indicators -->
536
537=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
538--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-09-13 08:28:50 +0000
539+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-09-14 14:40:27 +0000
540@@ -339,6 +339,9 @@
541 class JSONNullIterator;
542 #endif
543 #ifdef ZORBA_WITH_JSON
544+ class JSONIsNullIterator;
545+#endif
546+#ifdef ZORBA_WITH_JSON
547 class JSONArrayInsertIterator;
548 #endif
549 #ifdef ZORBA_WITH_JSON
550@@ -1179,6 +1182,10 @@
551 virtual void endVisit ( const JSONNullIterator& ) = 0;
552 #endif
553 #ifdef ZORBA_WITH_JSON
554+ virtual void beginVisit ( const JSONIsNullIterator& ) = 0;
555+ virtual void endVisit ( const JSONIsNullIterator& ) = 0;
556+#endif
557+#ifdef ZORBA_WITH_JSON
558 virtual void beginVisit ( const JSONArrayInsertIterator& ) = 0;
559 virtual void endVisit ( const JSONArrayInsertIterator& ) = 0;
560 #endif
561
562=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
563--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-09-13 08:28:50 +0000
564+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-09-14 14:40:27 +0000
565@@ -2114,6 +2114,21 @@
566
567 #endif
568 #ifdef ZORBA_WITH_JSON
569+// <JSONIsNullIterator>
570+void PrinterVisitor::beginVisit ( const JSONIsNullIterator& a) {
571+ thePrinter.startBeginVisit("JSONIsNullIterator", ++theId);
572+ printCommons( &a, theId );
573+ thePrinter.endBeginVisit( theId );
574+}
575+
576+void PrinterVisitor::endVisit ( const JSONIsNullIterator& ) {
577+ thePrinter.startEndVisit();
578+ thePrinter.endEndVisit();
579+}
580+// </JSONIsNullIterator>
581+
582+#endif
583+#ifdef ZORBA_WITH_JSON
584 // <JSONArrayInsertIterator>
585 void PrinterVisitor::beginVisit ( const JSONArrayInsertIterator& a) {
586 thePrinter.startBeginVisit("JSONArrayInsertIterator", ++theId);
587
588=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
589--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-09-13 08:28:50 +0000
590+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-09-14 14:40:27 +0000
591@@ -523,6 +523,11 @@
592 #endif
593
594 #ifdef ZORBA_WITH_JSON
595+ void beginVisit( const JSONIsNullIterator& );
596+ void endVisit ( const JSONIsNullIterator& );
597+#endif
598+
599+#ifdef ZORBA_WITH_JSON
600 void beginVisit( const JSONArrayInsertIterator& );
601 void endVisit ( const JSONArrayInsertIterator& );
602 #endif
603
604=== modified file 'src/store/naive/json_items.cpp'
605--- src/store/naive/json_items.cpp 2012-09-14 01:18:48 +0000
606+++ src/store/naive/json_items.cpp 2012-09-14 14:40:27 +0000
607@@ -38,7 +38,7 @@
608 *******************************************************************************/
609 store::Item* JSONNull::getType() const
610 {
611- return GET_STORE().JDM_NULL_QNAME;
612+ return GET_STORE().JS_NULL_QNAME;
613 }
614
615
616@@ -50,7 +50,7 @@
617 long /* timezone */,
618 const XQPCollator* /* collation */) const
619 {
620- return other->getTypeCode() == store::JDM_NULL;
621+ return other->getTypeCode() == store::JS_NULL;
622 }
623
624
625@@ -204,7 +204,7 @@
626 *******************************************************************************/
627 store::Item* JSONObject::getType() const
628 {
629- return GET_STORE().JDM_OBJECT_QNAME;
630+ return GET_STORE().JS_OBJECT_QNAME;
631 }
632
633
634@@ -732,7 +732,7 @@
635 *******************************************************************************/
636 store::Item* JSONArray::getType() const
637 {
638- return GET_STORE().JDM_ARRAY_QNAME;
639+ return GET_STORE().JS_ARRAY_QNAME;
640 }
641
642
643
644=== modified file 'src/store/naive/json_items.h'
645--- src/store/naive/json_items.h 2012-09-14 01:18:48 +0000
646+++ src/store/naive/json_items.h 2012-09-14 14:40:27 +0000
647@@ -68,7 +68,7 @@
648
649 void getTypedValue(store::Item_t& val, store::Iterator_t& iter) const;
650
651- store::SchemaTypeCode getTypeCode() const { return store::JDM_NULL; }
652+ store::SchemaTypeCode getTypeCode() const { return store::JS_NULL; }
653
654 store::Item* getType() const;
655
656
657=== modified file 'src/store/naive/store.cpp'
658--- src/store/naive/store.cpp 2012-09-11 22:55:05 +0000
659+++ src/store/naive/store.cpp 2012-09-14 14:40:27 +0000
660@@ -86,7 +86,7 @@
661 const char* Store::XS_URI = "http://www.w3.org/2001/XMLSchema";
662 const char* Store::XML_URI = "http://www.w3.org/2001/XML/1998/namespace";
663 const char* Store::ZXSE_URI = "http://www.zorba-xquery.com/zorba/schema-extensions";
664-const char* Store::JDM_URI = "http://www.jsoniq.org/";
665+const char* Store::JS_URI = "http://www.jsoniq.org/types";
666
667 const ulong Store::XML_URI_LEN = sizeof(Store::XML_URI);
668
669@@ -185,9 +185,9 @@
670 theSchemaTypeNames.resize(store::XS_LAST);
671
672 #ifdef ZORBA_WITH_JSON
673- JDM_NULL_QNAME = theQNamePool->insert(JDM_URI, "jdm", "null");
674- JDM_OBJECT_QNAME = theQNamePool->insert(JDM_URI, "jdm", "object");
675- JDM_ARRAY_QNAME = theQNamePool->insert(JDM_URI, "jdm", "array");
676+ JS_NULL_QNAME = theQNamePool->insert(JS_URI, "js", "null");
677+ JS_OBJECT_QNAME = theQNamePool->insert(JS_URI, "js", "object");
678+ JS_ARRAY_QNAME = theQNamePool->insert(JS_URI, "js", "array");
679 #endif
680
681 XS_UNTYPED_QNAME = theQNamePool->insert(ns, "xs", "untyped");
682@@ -323,9 +323,9 @@
683 XS_ANY_SIMPLE_QNAME = NULL;
684
685 #ifdef ZORBA_WITH_JSON
686- JDM_OBJECT_QNAME = NULL;
687- JDM_ARRAY_QNAME = NULL;
688- JDM_NULL_QNAME = NULL;
689+ JS_OBJECT_QNAME = NULL;
690+ JS_ARRAY_QNAME = NULL;
691+ JS_NULL_QNAME = NULL;
692 #endif
693
694 delete theQNamePool;
695
696=== modified file 'src/store/naive/store.h'
697--- src/store/naive/store.h 2012-09-13 08:28:50 +0000
698+++ src/store/naive/store.h 2012-09-14 14:40:27 +0000
699@@ -136,7 +136,7 @@
700 static const char* XS_URI;
701 static const char* XML_URI;
702 static const char* ZXSE_URI;
703- static const char* JDM_URI;
704+ static const char* JS_URI;
705
706 static const ulong XML_URI_LEN;
707
708@@ -159,9 +159,9 @@
709 store::Item_t XS_ANY_SIMPLE_QNAME;
710
711 #ifdef ZORBA_WITH_JSON
712- store::Item_t JDM_OBJECT_QNAME;
713- store::Item_t JDM_ARRAY_QNAME;
714- store::Item_t JDM_NULL_QNAME;
715+ store::Item_t JS_OBJECT_QNAME;
716+ store::Item_t JS_ARRAY_QNAME;
717+ store::Item_t JS_NULL_QNAME;
718 #endif
719
720 protected:
721
722=== modified file 'src/types/casting.cpp'
723--- src/types/casting.cpp 2012-09-11 22:55:05 +0000
724+++ src/types/casting.cpp 2012-09-14 14:40:27 +0000
725@@ -1818,7 +1818,7 @@
726 20, // 42 XS_ANY_URI
727 21, // 43 XS_QNAME
728 22, // 44 XS_NOTATION
729- 23 // 45 JDM_NULL
730+ 23 // 45 JS_NULL
731 };
732
733
734@@ -2159,7 +2159,7 @@
735 sourceTypeCode != store::XS_UNTYPED_ATOMIC)
736 throwTypeException(err::XPTY0004, errorInfo);
737
738- if (targetTypeCode == store::JDM_NULL)
739+ if (targetTypeCode == store::JS_NULL)
740 throwTypeException(err::XPTY0004, errorInfo);
741
742 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
743
744=== modified file 'src/types/root_typemanager.cpp'
745--- src/types/root_typemanager.cpp 2012-09-11 22:55:05 +0000
746+++ src/types/root_typemanager.cpp 2012-09-14 14:40:27 +0000
747@@ -281,9 +281,9 @@
748 XSQNDECL(XS_UNTYPED_QNAME, "untyped");
749
750 #ifdef ZORBA_WITH_JSON
751- GENV_STORE.getItemFactory()->createQName(JDM_NULL_QNAME,
752- static_context::JSONIQ_NS,
753- "",
754+ GENV_STORE.getItemFactory()->createQName(JS_NULL_QNAME,
755+ static_context::JSONIQ_DM_NS,
756+ "jn",
757 "null");
758 #endif
759
760@@ -389,43 +389,43 @@
761 new StructuredItemXQType(this, TypeConstants::QUANT_PLUS, true);
762
763 #ifdef ZORBA_WITH_JSON
764- JDM_NULL_TYPE_ONE = new AtomicXQType(this,
765- store::JDM_NULL,
766+ JS_NULL_TYPE_ONE = new AtomicXQType(this,
767+ store::JS_NULL,
768 TypeConstants::QUANT_ONE,
769 true);
770
771- JDM_NULL_TYPE_QUESTION = new AtomicXQType(this,
772- store::JDM_NULL,
773+ JS_NULL_TYPE_QUESTION = new AtomicXQType(this,
774+ store::JS_NULL,
775 TypeConstants::QUANT_QUESTION,
776 true);
777
778- JDM_NULL_TYPE_STAR = new AtomicXQType(this,
779- store::JDM_NULL,
780+ JS_NULL_TYPE_STAR = new AtomicXQType(this,
781+ store::JS_NULL,
782 TypeConstants::QUANT_STAR,
783 true);
784
785- JDM_NULL_TYPE_PLUS = new AtomicXQType(this,
786- store::JDM_NULL,
787+ JS_NULL_TYPE_PLUS = new AtomicXQType(this,
788+ store::JS_NULL,
789 TypeConstants::QUANT_PLUS,
790 true);
791
792- m_atomic_typecode_qname_map[store::JDM_NULL] = JDM_NULL_QNAME;
793+ m_atomic_typecode_qname_map[store::JS_NULL] = JS_NULL_QNAME;
794
795- tempQN = JDM_NULL_QNAME.getp();
796- tempCode = store::JDM_NULL;
797+ tempQN = JS_NULL_QNAME.getp();
798+ tempCode = store::JS_NULL;
799 m_atomic_qnametype_map.insert(tempQN, tempCode);
800
801- m_atomic_typecode_map[store::JDM_NULL][TypeConstants::QUANT_ONE] =
802- &JDM_NULL_TYPE_ONE;
803+ m_atomic_typecode_map[store::JS_NULL][TypeConstants::QUANT_ONE] =
804+ &JS_NULL_TYPE_ONE;
805
806- m_atomic_typecode_map[store::JDM_NULL][TypeConstants::QUANT_QUESTION] =
807- &JDM_NULL_TYPE_QUESTION;
808-
809- m_atomic_typecode_map[store::JDM_NULL][TypeConstants::QUANT_STAR] =
810- &JDM_NULL_TYPE_STAR;
811-
812- m_atomic_typecode_map[store::JDM_NULL][TypeConstants::QUANT_PLUS] =
813- &JDM_NULL_TYPE_PLUS;
814+ m_atomic_typecode_map[store::JS_NULL][TypeConstants::QUANT_QUESTION] =
815+ &JS_NULL_TYPE_QUESTION;
816+
817+ m_atomic_typecode_map[store::JS_NULL][TypeConstants::QUANT_STAR] =
818+ &JS_NULL_TYPE_STAR;
819+
820+ m_atomic_typecode_map[store::JS_NULL][TypeConstants::QUANT_PLUS] =
821+ &JS_NULL_TYPE_PLUS;
822
823 #define JSON_TYPE_DEFN(basename, kind) \
824 basename##_TYPE_ONE = new JSONXQType(this, \
825@@ -558,7 +558,7 @@
826 DELETE_TYPE(STRUCTURED_ITEM)
827
828 #ifdef ZORBA_WITH_JSON
829- DELETE_TYPE(JDM_NULL)
830+ DELETE_TYPE(JS_NULL)
831
832 DELETE_TYPE(JSON_ITEM)
833 DELETE_TYPE(JSON_OBJECT)
834
835=== modified file 'src/types/root_typemanager.h'
836--- src/types/root_typemanager.h 2012-09-11 22:55:05 +0000
837+++ src/types/root_typemanager.h 2012-09-14 14:40:27 +0000
838@@ -132,11 +132,11 @@
839 *
840 * N, N?, N+, N*, where N is the jdm::null atomic type
841 */
842- store::Item_t JDM_NULL_QNAME;
843- xqtref_t JDM_NULL_TYPE_ONE;
844- xqtref_t JDM_NULL_TYPE_QUESTION;
845- xqtref_t JDM_NULL_TYPE_STAR;
846- xqtref_t JDM_NULL_TYPE_PLUS;
847+ store::Item_t JS_NULL_QNAME;
848+ xqtref_t JS_NULL_TYPE_ONE;
849+ xqtref_t JS_NULL_TYPE_QUESTION;
850+ xqtref_t JS_NULL_TYPE_STAR;
851+ xqtref_t JS_NULL_TYPE_PLUS;
852 #endif
853
854 /**
855
856=== modified file 'src/zorbaserialization/serialize_zorba_types.cpp'
857--- src/zorbaserialization/serialize_zorba_types.cpp 2012-09-11 22:55:05 +0000
858+++ src/zorbaserialization/serialize_zorba_types.cpp 2012-09-14 14:40:27 +0000
859@@ -770,7 +770,7 @@
860 }
861
862 #ifdef ZORBA_WITH_JSON
863- case store::JDM_NULL:
864+ case store::JS_NULL:
865 {
866 break;
867 }
868@@ -1076,7 +1076,7 @@
869 }
870
871 #ifdef ZORBA_WITH_JSON
872- case store::JDM_NULL:
873+ case store::JS_NULL:
874 {
875 store::Item_t lRes;
876 GENV_ITEMFACTORY->createJSONNull(lRes);
877
878=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null02.xml.res'
879--- test/rbkt/ExpQueryResults/zorba/jsoniq/null02.xml.res 2012-01-30 18:37:03 +0000
880+++ test/rbkt/ExpQueryResults/zorba/jsoniq/null02.xml.res 2012-09-14 14:40:27 +0000
881@@ -1,1 +1,1 @@
882-true
883+false
884
885=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null04.xml.res'
886--- test/rbkt/ExpQueryResults/zorba/jsoniq/null04.xml.res 1970-01-01 00:00:00 +0000
887+++ test/rbkt/ExpQueryResults/zorba/jsoniq/null04.xml.res 2012-09-14 14:40:27 +0000
888@@ -0,0 +1,1 @@
889+true
890
891=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null05.xml.res'
892--- test/rbkt/ExpQueryResults/zorba/jsoniq/null05.xml.res 1970-01-01 00:00:00 +0000
893+++ test/rbkt/ExpQueryResults/zorba/jsoniq/null05.xml.res 2012-09-14 14:40:27 +0000
894@@ -0,0 +1,1 @@
895+false
896
897=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null06.xml.res'
898=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null07.xml.res'
899=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null08.xml.res'
900--- test/rbkt/ExpQueryResults/zorba/jsoniq/null08.xml.res 1970-01-01 00:00:00 +0000
901+++ test/rbkt/ExpQueryResults/zorba/jsoniq/null08.xml.res 2012-09-14 14:40:27 +0000
902@@ -0,0 +1,1 @@
903+true true true true true false false false false false
904
905=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/serializer-JNSE0022.xml.res'
906--- test/rbkt/ExpQueryResults/zorba/jsoniq/serializer-JNSE0022.xml.res 2012-09-10 17:47:37 +0000
907+++ test/rbkt/ExpQueryResults/zorba/jsoniq/serializer-JNSE0022.xml.res 2012-09-14 14:40:27 +0000
908@@ -1,1 +1,1 @@
909-html: invalid serialization method for item type (jdm:object) text: invalid serialization method for item type (jdm:object) xml: invalid serialization method for item type (jdm:object) xhtml: invalid serialization method for item type (jdm:object)
910+html: invalid serialization method for item type (js:object) text: invalid serialization method for item type (js:object) xml: invalid serialization method for item type (js:object) xhtml: invalid serialization method for item type (js:object)
911
912=== modified file 'test/rbkt/Queries/zorba/jsoniq/null01.xq'
913--- test/rbkt/Queries/zorba/jsoniq/null01.xq 2012-01-27 23:00:49 +0000
914+++ test/rbkt/Queries/zorba/jsoniq/null01.xq 2012-09-14 14:40:27 +0000
915@@ -1,3 +1,1 @@
916-import module namespace j = "http://www.jsoniq.org/functions";
917-
918-j:null()
919+jn:null()
920
921=== modified file 'test/rbkt/Queries/zorba/jsoniq/null02.xq'
922--- test/rbkt/Queries/zorba/jsoniq/null02.xq 2012-01-30 18:37:03 +0000
923+++ test/rbkt/Queries/zorba/jsoniq/null02.xq 2012-09-14 14:40:27 +0000
924@@ -1,3 +1,1 @@
925-import module namespace j = "http://www.jsoniq.org/functions";
926-
927-j:null() = j:null()
928+jn:null() = jn:null()
929
930=== modified file 'test/rbkt/Queries/zorba/jsoniq/null03.xq'
931--- test/rbkt/Queries/zorba/jsoniq/null03.xq 2012-01-31 04:17:50 +0000
932+++ test/rbkt/Queries/zorba/jsoniq/null03.xq 2012-09-14 14:40:27 +0000
933@@ -1,4 +1,2 @@
934-import module namespace j = "http://www.jsoniq.org/functions";
935-
936-fn:data(j:null())
937+fn:data(jn:null())
938
939
940=== added file 'test/rbkt/Queries/zorba/jsoniq/null04.xq'
941--- test/rbkt/Queries/zorba/jsoniq/null04.xq 1970-01-01 00:00:00 +0000
942+++ test/rbkt/Queries/zorba/jsoniq/null04.xq 2012-09-14 14:40:27 +0000
943@@ -0,0 +1,2 @@
944+jn:is-null(jn:null())
945+
946
947=== added file 'test/rbkt/Queries/zorba/jsoniq/null05.xq'
948--- test/rbkt/Queries/zorba/jsoniq/null05.xq 1970-01-01 00:00:00 +0000
949+++ test/rbkt/Queries/zorba/jsoniq/null05.xq 2012-09-14 14:40:27 +0000
950@@ -0,0 +1,2 @@
951+jn:is-null("null")
952+
953
954=== added file 'test/rbkt/Queries/zorba/jsoniq/null06.xq'
955--- test/rbkt/Queries/zorba/jsoniq/null06.xq 1970-01-01 00:00:00 +0000
956+++ test/rbkt/Queries/zorba/jsoniq/null06.xq 2012-09-14 14:40:27 +0000
957@@ -0,0 +1,3 @@
958+null + 1, null - 1, null * 1, null div 1, null mod 1
959+
960+
961
962=== added file 'test/rbkt/Queries/zorba/jsoniq/null07.xq'
963--- test/rbkt/Queries/zorba/jsoniq/null07.xq 1970-01-01 00:00:00 +0000
964+++ test/rbkt/Queries/zorba/jsoniq/null07.xq 2012-09-14 14:40:27 +0000
965@@ -0,0 +1,1 @@
966+null eq 1, 1 ne null, null le 1, 1 ge null, 1 lt null, null gt 1
967
968=== added file 'test/rbkt/Queries/zorba/jsoniq/null08.xq'
969--- test/rbkt/Queries/zorba/jsoniq/null08.xq 1970-01-01 00:00:00 +0000
970+++ test/rbkt/Queries/zorba/jsoniq/null08.xq 2012-09-14 14:40:27 +0000
971@@ -0,0 +1,10 @@
972+(null, 1, 2, null) = (4, null, 1, 6),
973+(null, 1, 2, null) < (4, null, 1, 6),
974+(null, 1, 2, null) > (4, null, 1, 6),
975+(null, 1, 2, null) <= (4, null, 1, 6),
976+(null, 1, 2, null) >= (4, null, 1, 6),
977+(null, 1, 2) = (3, 4, null),
978+(null, 3, 4) < (1, 2, null),
979+(null, 1, 2) > (3, 4, null),
980+(null, 3, 4) <= (1, 2, null),
981+(null, 1, 2) >= (3, 4, null)

Subscribers

People subscribed via source and target branches