Hi, null is a literal type and I wanted to say anyone creating a json object would want to use boolean as a literal that is as true and false and not as a function: true() & false(). If it cannot be a literal in xquery, I guess we could leave it as it is :-).
Thank you. Yours sincerely, Riyafa On Jun 11, 2016 10:49 PM, "Till Westmann" <[email protected]> wrote: > Hi Riyafa, > > I’m not completely sure what we are talking about. There are 2 options: > > a) The construction of a data model instance in XQuery/JSONiq using the > functions (the fn: namespace should be implicit): > > { > "boolean1": true(), > "boolean2": false() > } > > This is an XQuery expression. > > b) The serialization of a data model instance to a string (for output): > > { > "boolean1": true, > "boolean2": false > } > > This is a sequence of characters that is returned by the query > processor/serializer. > > These are very close, but not the same and AFAIK that’s correct. To be able > to process a) we need to get the XQuery parser right (and I think that > should already be the case) and to be able to produce b) we need to get the > XMLSerializer right (and I don’t know if that’s already correct). > > Does this make sense? > Which one are you concerned about? > > Cheers, > Till > > P.S. We have a similar situation for "null" and "js:null()". > > > On 11 Jun 2016, at 16:35, Riyafa Abdul Hameed wrote: > > Hi, >> >> The object should be of the form: >> >> >> >> { >> "boolean1": true, >> >> "boolean2": false >> } >> >> and not >> >> { >> "boolean1": fn:true, >> >> "boolean2": fn:false >> } >> >> Any suggestions? >> >> Thank you. >> >> Yours sincerely, >> Riyafa >> >> >> On 11 June 2016 at 20:02, Till Westmann <[email protected]> wrote: >> >> In XQuery there are no boolean literals, but there are built-in >>> functions fn:true() and fn:false(). You could those for the tests. >>> >>> Cheers, >>> Till >>> >>> On 11 Jun 2016, at 16:15, Riyafa Abdul Hameed wrote: >>> >>> Hi, >>> >>>> >>>> As I came to know now, boolean is not a LiteralType in the current >>>> implementation. Am I to add it as a LiteralType and as a Literal() in >>>> grammar.jj as well? Boolean is not read in the grammar.jj file also. >>>> >>>> Thank you. >>>> >>>> Yours sincerely, >>>> Riyafa >>>> >>>> On 11 June 2016 at 19:40, Riyafa Abdul Hameed <[email protected]> >>>> wrote: >>>> >>>> Hi, >>>> >>>>> >>>>> I came across this issue when attempting to write test cases: I tried >>>>> using boolean values in my object and it throws an exception. Also it >>>>> throws the same exception when I try with only true or false values: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> *java.lang.ArrayIndexOutOfBoundsException: -7 at >>>>> >>>>> >>>>> >>>>> org.apache.hyracks.dataflow.common.util.IntSerDeUtils.getInt(IntSerDeUtils.java:25) >>>>> at >>>>> org.apache.hyracks.dataflow.common.comm.io >>>>> .FrameTupleAccessor.getFieldStartOffset(FrameTupleAccessor.java:94) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference.getFieldStart(FrameTupleReference.java:55) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.evaluators.TupleFieldEvaluatorFactory$1.evaluate(TupleFieldEvaluatorFactory.java:42) >>>>> at >>>>> >>>>> >>>>> org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator.evaluate(AbstractTaggedValueArgumentScalarEvaluator.java:47) >>>>> at >>>>> >>>>> >>>>> org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluator.init(AbstractTaggedValueArgumentUnnestingEvaluator.java:47) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.std.UnnestRuntimeFactory$1.nextFrame(UnnestRuntimeFactory.java:126) >>>>> at >>>>> org.apache.hyracks.dataflow.common.comm.io >>>>> .AbstractFrameAppender.flush(AbstractFrameAppender.java:83) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.std.EmptyTupleSourceRuntimeFactory$1.open(EmptyTupleSourceRuntimeFactory.java:55) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$1.initialize(AlgebricksMetaOperatorDescriptor.java:108) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:85) >>>>> at org.apache.hyracks.control.nc.Task.run(Task.java:255) at >>>>> >>>>> >>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) >>>>> at >>>>> >>>>> >>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) >>>>> at java.lang.Thread.run(Thread.java:745)Jun 11, 2016 6:23:46 PM >>>>> org.apache.hyracks.control.common.work.WorkQueue$WorkerThread runINFO: >>>>> Executing: NotifyTaskFailureJun 11, 2016 6:23:46 PM >>>>> org.apache.hyracks.control.common.work.WorkQueue$WorkerThread runINFO: >>>>> Executing: TaskFailure: [JID:0:TAID:TID:ANID:ODID:1:0:0:0:nc1]Jun 11, >>>>> 2016 >>>>> 6:23:46 PM org.apache.hyracks.control.cc >>>>> .partitions.PartitionMatchMaker >>>>> removeUncommittedPartitionsINFO: Removing uncommitted partitions: >>>>> []org.apache.hyracks.api.exceptions.HyracksDataException: >>>>> java.lang.ArrayIndexOutOfBoundsException: -7 at >>>>> >>>>> >>>>> org.apache.hyracks.control.common.utils.ExceptionUtils.setNodeIds(ExceptionUtils.java:45) >>>>> at org.apache.hyracks.control.nc.Task.run(Task.java:312) at >>>>> >>>>> >>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) >>>>> at >>>>> >>>>> >>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) >>>>> at java.lang.Thread.run(Thread.java:745)Caused by: >>>>> java.lang.ArrayIndexOutOfBoundsException: -7 at >>>>> >>>>> >>>>> org.apache.hyracks.dataflow.common.util.IntSerDeUtils.getInt(IntSerDeUtils.java:25) >>>>> at >>>>> org.apache.hyracks.dataflow.common.comm.io >>>>> .FrameTupleAccessor.getFieldStartOffset(FrameTupleAccessor.java:94) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference.getFieldStart(FrameTupleReference.java:55) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.evaluators.TupleFieldEvaluatorFactory$1.evaluate(TupleFieldEvaluatorFactory.java:42) >>>>> at >>>>> >>>>> >>>>> org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator.evaluate(AbstractTaggedValueArgumentScalarEvaluator.java:47) >>>>> at >>>>> >>>>> >>>>> org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluator.init(AbstractTaggedValueArgumentUnnestingEvaluator.java:47) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.std.UnnestRuntimeFactory$1.nextFrame(UnnestRuntimeFactory.java:126) >>>>> at >>>>> org.apache.hyracks.dataflow.common.comm.io >>>>> .AbstractFrameAppender.flush(AbstractFrameAppender.java:83) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.std.EmptyTupleSourceRuntimeFactory$1.open(EmptyTupleSourceRuntimeFactory.java:55) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$1.initialize(AlgebricksMetaOperatorDescriptor.java:108) >>>>> at >>>>> >>>>> >>>>> org.apache.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:85) >>>>> at org.apache.hyracks.control.nc.Task.run(Task.java:255)* >>>>> >>>>> >>>>> I am not sure why this is thrown. Any help would be appreciated. Or >>>>> should >>>>> I try to fix the issue. >>>>> >>>>> Thank you. >>>>> >>>>> Yours sincerely, >>>>> Riyafa >>>>> >>>>> -- >>>>> Riyafa Abdul Hameed >>>>> Undergraduate, University of Moratuwa >>>>> >>>>> Email: [email protected] >>>>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/> >>>>> <http://facebook.com/riyafa.ahf> <http://lk.linkedin.com/in/riyafa> >>>>> <http://twitter.com/Riyafa1> >>>>> >>>>> >>>>> >>>> >>>> -- >>>> Riyafa Abdul Hameed >>>> Undergraduate, University of Moratuwa >>>> >>>> Email: [email protected] >>>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/> >>>> <http://facebook.com/riyafa.ahf> <http://lk.linkedin.com/in/riyafa> >>>> <http://twitter.com/Riyafa1> >>>> >>>> >>> >> >> -- >> Riyafa Abdul Hameed >> Undergraduate, University of Moratuwa >> >> Email: [email protected] >> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/> >> <http://facebook.com/riyafa.ahf> <http://lk.linkedin.com/in/riyafa> >> <http://twitter.com/Riyafa1> >> >
