bring fn:analyze-string

Bug #1192246 reported by Matthias Brantner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Committed
High
Paul J. Lucas

Bug Description

We need to create an additional function corresponding to fn:analyze-string that returns or take objects as parameters.

Those functions should also go into the JSONiq spec.

I want to use analyze-string to tokenize csv lines.

(The JSONiq version of fn:serialize has been split off into bug #1229485.)

Related branches

Changed in zorba:
importance: Undecided → High
Chris Hillery (ceejatec)
Changed in zorba:
assignee: Matthias Brantner (matthias-brantner) → Paul J. Lucas (paul-lucas)
importance: High → Medium
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

You should put them into the JSONiq spec first so I know what keys you want.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Re: [Bug 1192246] Re: bring fn:analyze-string and fn:serialize to jsoniq

Let's do the other way round since Ghislain is busy. Could you please
come up with a natural XML-JSON mapping for the return values
and options?

On Aug 12, 2013, at 7:21 AM, "Paul J. Lucas" <email address hidden> wrote:

> You should put them into the JSONiq spec first so I know what keys you
> want.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1192246
>
> Title:
> bring fn:analyze-string and fn:serialize to jsoniq
>
> Status in Zorba - NoSQL Query Processor:
> New
>
> Bug description:
> We need to create additional functions corresponding to fn:analyze-
> string and fn:serialize that return or take objects as parameters.
>
> Those functions should also go into the JSONiq spec.
>
> I want to use analyze-string to tokenize csv lines.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zorba/+bug/1192246/+subscriptions

Chris Hillery (ceejatec)
Changed in zorba:
importance: Medium → High
status: New → Confirmed
Revision history for this message
Paul J. Lucas (paul-lucas) wrote : Re: bring fn:analyze-string and fn:serialize to jsoniq

What module do these functions live in?

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Re: [Bug 1192246] Re: bring fn:analyze-string and fn:serialize to jsoniq

Can you put analyze-string in the string module and serialized into the jsoniq namespace.

Sent from my iPad

On Aug 13, 2013, at 20:24, "Paul J. Lucas" <email address hidden> wrote:

> What module do these functions live in?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1192246
>
> Title:
> bring fn:analyze-string and fn:serialize to jsoniq
>
> Status in Zorba - NoSQL Query Processor:
> Confirmed
>
> Bug description:
> We need to create additional functions corresponding to fn:analyze-
> string and fn:serialize that return or take objects as parameters.
>
> Those functions should also go into the JSONiq spec.
>
> I want to use analyze-string to tokenize csv lines.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zorba/+bug/1192246/+subscriptions

Changed in zorba:
status: Confirmed → In Progress
Revision history for this message
Paul J. Lucas (paul-lucas) wrote : Re: bring fn:analyze-string and fn:serialize to jsoniq

What do you think about the following JSON?

j:analyze-string('Tom Jim John',"Jim")

[
  { "non-match" : "Tom " },
  { "match" : "Jim" },
  { "non-match" : " John" }
]

j:analyze-string('Tom Jim John',"(Jim)")

[
  { "non-match" : "Tom " },
  { "match" : [ 1, "Jim" ] }
  { "non-match" : " John" }
]

jn:analyze-string('Tom Jim John',"((Jim) John)")

[
  { "non-match" : "Tom " }
  { "match" : [ 1, [ 2, "Jim" ], " John" ] }
]

* Results are arrays of objects.
* Every object has exactly 1 key of either "match" or "non-match".
* An object's value is either a string (no grouping) or an array (grouping).
* For grouping arrays, the first element is the group number.
* The second element is either the group string or a sub-group array.
* If the second element is a sub-group array, then the last element is the group string.
* Sub-group arrays can nest indefinitely.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Re: [Bug 1192246] Re: bring fn:analyze-string and fn:serialize to jsoniq

I'm not sure about the group number. Maybe we could model that using an object.

On Aug 15, 2013, at 9:02 PM, "Paul J. Lucas" <email address hidden> wrote:

> What do you think about the following JSON?
>
> j:analyze-string('Tom Jim John',"Jim")
>
> [
> { "non-match" : "Tom " },
> { "match" : "Jim" },
> { "non-match" : " John" }
> ]
>
> j:analyze-string('Tom Jim John',"(Jim)")
>
> [
> { "non-match" : "Tom " },
> { "match" : [ 1, "Jim" ] }
> { "non-match" : " John" }
> ]
>
> jn:analyze-string('Tom Jim John',"((Jim) John)")
>
> [
> { "non-match" : "Tom " }
> { "match" : [ 1, [ 2, "Jim" ], " John" ] }
> ]
>
> * Results are arrays of objects.
> * Every object has exactly 1 key of either "match" or "non-match".
> * An object's value is either a string (no grouping) or an array (grouping).
> * For grouping arrays, the first element is the group number.
> * The second element is either the group string or a sub-group array.
> * If the second element is a sub-group array, then the last element is the group string.
> * Sub-group arrays can nest indefinitely.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1192246
>
> Title:
> bring fn:analyze-string and fn:serialize to jsoniq
>
> Status in Zorba - NoSQL Query Processor:
> In Progress
>
> Bug description:
> We need to create additional functions corresponding to fn:analyze-
> string and fn:serialize that return or take objects as parameters.
>
> Those functions should also go into the JSONiq spec.
>
> I want to use analyze-string to tokenize csv lines.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zorba/+bug/1192246/+subscriptions

Revision history for this message
Paul J. Lucas (paul-lucas) wrote : Re: bring fn:analyze-string and fn:serialize to jsoniq

So it would be a 2-key object:

  { "group" : 1, "match" : "Jim" }

But it's not obvious to me how to write the result for the last example above.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

BTW: Which file is "the string module"? Same for where jn:serialize should live -- which file?

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Re: [Bug 1192246] bring fn:analyze-string and fn:serialize to jsoniq

> BTW: Which file is "the string module"?
modules/atomic/string.xq

> Same for where jn:serialize
> should live -- which file?
modules/org/jsoniq/www/functions.xq

>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1192246
>
> Title:
> bring fn:analyze-string and fn:serialize to jsoniq
>
> Status in Zorba - NoSQL Query Processor:
> In Progress
>
> Bug description:
> We need to create additional functions corresponding to fn:analyze-
> string and fn:serialize that return or take objects as parameters.
>
> Those functions should also go into the JSONiq spec.
>
> I want to use analyze-string to tokenize csv lines.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zorba/+bug/1192246/+subscriptions

summary: - bring fn:analyze-string and fn:serialize to jsoniq
+ bring fn:analyze-string
description: updated
Changed in zorba:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.