incubator-vxquery-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinayak Borkar <vbo...@yahoo.com>
Subject Re: VXQuery Query Plans for Functions on String Values
Date Thu, 07 Jun 2012 17:00:55 GMT
fn:concat and op:concatenate are indeed different.

The first is a function that accepts two strings as argument and creates 
a *string* that is a string-concatenation of the two strings.

op:concatenate on the other hand is used to create a sequence of items.

Say A and B are two strings. Then:

fn:string-join(op:concatenate(A, B)) == fn:concat(A, B)

The string-join creates the new string that is a concatenation of string 
A and string B. The op:concatenate only creates a sequence containing 
two items, A and B.


Vinayak

On 6/6/12 9:04 PM, Eldon Carman wrote:
> Below are example queries and their plans. The first two are just
> string literals. The remaining queries are examples from the "XQuery
> 1.0 and XPath 2.0 Functions and Operators (Second Edition)" webpage
> (http://www.w3.org/TR/xquery-operators/#func-string-join) for the "7.4
> Functions on String Values". The list of query plans are fairly
> straight forward after looking at the math functions.
>
> Questions
> - In the plans, two similar activities happen with two different
> commands: a function concat and an operator concatenate. Is the
> difference on the output returned from concat and concatenate? A
> string or sequence, respectively.
> - Can a sequence be used as a string? In "string-join" concatenate is
> used to pass in a string.
>
>
> String Queries
> --------------
>
> "a"
>
> assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(a)] -- |UNPARTITIONED|
>    empty-tuple-source -- |UNPARTITIONED|
>
> "abc"
>
> assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(abc)] -- |UNPARTITIONED|
>    empty-tuple-source -- |UNPARTITIONED|
>
> concat('un', 'grateful')
>
> assign [$$3]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}concat,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}anyAtomicType
> QUANT_QUESTION)], function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$2],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}anyAtomicType
> QUANT_QUESTION)]]] -- |UNPARTITIONED|
>    assign [$$2]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(grateful)] -- |UNPARTITIONED|
>      assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(un)] -- |UNPARTITIONED|
>        empty-tuple-source -- |UNPARTITIONED|
>
> string-join(('Now', 'is', 'the', 'time', '...'), ' ')
>
> assign [$$8]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}string-join,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$6],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_STAR)],
> function-call: vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$7],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_ONE)]]] --
> |UNPARTITIONED|
>    assign [$$7]<- [{http://www.w3.org/2001/XMLSchema}string QUANT_ONE(
> )] -- |UNPARTITIONED|
>      assign [$$6]<- [function-call:
> vxquery:{urn:org.apache.vxquery.operators}concatenate, Args:[$$1, $$2,
> $$3, $$4, $$5]] -- |UNPARTITIONED|
>        assign [$$5]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(...)] -- |UNPARTITIONED|
>          assign [$$4]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(time)] -- |UNPARTITIONED|
>            assign [$$3]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(the)] -- |UNPARTITIONED|
>              assign [$$2]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(is)] -- |UNPARTITIONED|
>                assign [$$1]<-
> [{http://www.w3.org/2001/XMLSchema}string QUANT_ONE(Now)] --
> |UNPARTITIONED|
>                  empty-tuple-source -- |UNPARTITIONED|
>
> substring("motor car", 6)
>
> assign [$$3]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}substring,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_QUESTION)],
> function-call: vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$2],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}double QUANT_ONE)]]] --
> |UNPARTITIONED|
>    assign [$$2]<- [{http://www.w3.org/2001/XMLSchema}integer
> QUANT_ONE(6)] -- |UNPARTITIONED|
>      assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(motor car)] -- |UNPARTITIONED|
>        empty-tuple-source -- |UNPARTITIONED|
>
> substring("metadata", 4, 3)
>
> assign [$$4]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}substring,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_QUESTION)],
> function-call: vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$2],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}double QUANT_ONE)],
> function-call: vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$3],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}double QUANT_ONE)]]] --
> |UNPARTITIONED|
>    assign [$$3]<- [{http://www.w3.org/2001/XMLSchema}integer
> QUANT_ONE(3)] -- |UNPARTITIONED|
>      assign [$$2]<- [{http://www.w3.org/2001/XMLSchema}integer
> QUANT_ONE(4)] -- |UNPARTITIONED|
>        assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(metadata)] -- |UNPARTITIONED|
>          empty-tuple-source -- |UNPARTITIONED|
>
> string-length("Harp not on that string, madam; that is past.")
>
> assign [$$2]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}string-length,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_QUESTION)]]]
> -- |UNPARTITIONED|
>    assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(Harp not on that string, madam; that is past.)] --
> |UNPARTITIONED|
>      empty-tuple-source -- |UNPARTITIONED|
>
> upper-case("abCd0")
>
> assign [$$2]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}upper-case,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_QUESTION)]]]
> -- |UNPARTITIONED|
>    assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(abCd0)] -- |UNPARTITIONED|
>      empty-tuple-source -- |UNPARTITIONED|
>
> lower-case("ABc!D")
>
> assign [$$2]<- [function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}lower-case,
> Args:[function-call:
> vxquery:{urn:org.apache.vxquery.operators-ext}promote,
> Args:[function-call:
> vxquery:{http://www.w3.org/2005/xpath-functions}data, Args:[$$1],
> {http://www.w3.org/2001/XMLSchema-extensions}type
> QUANT_ONE({http://www.w3.org/2001/XMLSchema}string QUANT_QUESTION)]]]
> -- |UNPARTITIONED|
>    assign [$$1]<- [{http://www.w3.org/2001/XMLSchema}string
> QUANT_ONE(ABc!D)] -- |UNPARTITIONED|
>      empty-tuple-source -- |UNPARTITIONED|
>


Mime
View raw message