From leo.studer at varioweb.ch Tue Sep 16 03:10:55 2014
From: leo.studer at varioweb.ch (Leo Studer)
Date: Tue, 16 Sep 2014 12:10:55 +0200
Subject: [xquery-talk] Namespace conflict ?
Message-ID: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Hello
I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
for $i in doc('FitnessCenter.xml')//*
return rename node $i as QName('http://www.gym.com', local-name($i))
on the following file:
Jeff
lightgrey
David
lightblue
and get the following error: new name conflicts with existing namespace binding
I thought the function local-name() produces an output without namespace binding? Can anyone explain?
Thanks in advance
Leo
From christian.gruen at gmail.com Tue Sep 16 03:32:49 2014
From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=)
Date: Tue, 16 Sep 2014 12:32:49 +0200
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Message-ID:
Hi Leo,
> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
You are completely right. The problem is that your original document
uses the default namespace "http://www.mygym.com", and your query uses
"http://www.gym.com". In other words, the error is raised because the
namespace binding of your target name conflicts with the existing
namespace binding.
Here is a recursive approach to change the default namespace of a document:
______________________________________
declare function local:update($root as node(), $ns as xs:string) {
if($root instance of element()) then (
element { QName($ns, local-name($root)) } {
$root/@*,
for $node in $root/node()
return local:update($node, $ns)
}
) else (
$root
)
};
let $ns := 'http://www.gym.com'
let $root := doc("FitnessCenter.xml")/*
let $updated := local:update($root, $ns)
return replace node $root with $updated
______________________________________
Hope this helps,
Christian
On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
> Hello
>
> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>
> for $i in doc('FitnessCenter.xml')//*
> return rename node $i as QName('http://www.gym.com', local-name($i))
>
>
> on the following file:
>
>
>
>
> Jeff
> lightgrey
>
>
> David
> lightblue
>
>
>
> and get the following error: new name conflicts with existing namespace binding
>
>
> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>
> Thanks in advance
> Leo
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
From mike at saxonica.com Tue Sep 16 03:38:09 2014
From: mike at saxonica.com (Michael Kay)
Date: Tue, 16 Sep 2014 11:38:09 +0100
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Message-ID: <7FB90345-4838-4D87-8F63-BD466C232580@saxonica.com>
Is the new namespace really the same as the old, or is that a typo?
If the new namespace is different, say 'http://www.gym.com/2', then there's a problem, because an element can't contain both the namespace declarations xmlns='http://www.gym.com/2' and 'http://www.gym.com'.
I have to admit my memory of the detail of XQuery Update is very hazy, I haven't done any work in this area for several years, so I'll have to refresh it, but it would be nice first to have confirmation of whether the question is correct as written.
Michael Kay
Saxonica
mike at saxonica.com
+44 (0) 118 946 5893
On 16 Sep 2014, at 11:10, Leo Studer wrote:
> Hello
>
> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>
> for $i in doc('FitnessCenter.xml')//*
>
> return rename node $i as QName('http://www.gym.com', local-name($i))
>
>
> on the following file:
>
>
>
>
>
>
>
> Jeff
>
> lightgrey
>
>
>
>
>
> David
>
> lightblue
>
>
>
>
>
>
> and get the following error: new name conflicts with existing namespace binding
>
>
> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>
> Thanks in advance
> Leo
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
From mike at saxonica.com Tue Sep 16 05:02:43 2014
From: mike at saxonica.com (Michael Kay)
Date: Tue, 16 Sep 2014 13:02:43 +0100
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To: <7FB90345-4838-4D87-8F63-BD466C232580@saxonica.com>
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
<7FB90345-4838-4D87-8F63-BD466C232580@saxonica.com>
Message-ID: <11A10FC9-5ED5-4A00-8A35-E4E07C4A685F@saxonica.com>
> Is the new namespace really the same as the old, or is that a typo?
>
Sorry, I need to get new specs.
Michael Kay
Saxonica
From leo.studer at varioweb.ch Tue Sep 16 23:24:36 2014
From: leo.studer at varioweb.ch (Leo Studer)
Date: Wed, 17 Sep 2014 08:24:36 +0200
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To:
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Message-ID:
Hi Christian
thank you for your input.
> The problem is that your original document
> uses the default namespace "http://www.mygym.com", and your query uses
> "http://www.gym.com". In other words, the error is raised because the
> namespace binding of your target name conflicts with the existing
> namespace binding.
That I don?t get.
This works
let $i:=(doc("FitnessCenter.xml")//Name)[1]
return rename node $i as QName('http://www.gym.com', "Name?)
with
Jeff
lightgrey
This not
declare namespace gym='http://www.mygym.com';
let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
return rename node $i as QName('http://www.gym.com', "Name?)
with
Jeff
lightgrey
Why should that conflict?
Always
Leo
>
> Here is a recursive approach to change the default namespace of a document:
> ______________________________________
>
> declare function local:update($root as node(), $ns as xs:string) {
> if($root instance of element()) then (
> element { QName($ns, local-name($root)) } {
> $root/@*,
> for $node in $root/node()
> return local:update($node, $ns)
> }
> ) else (
> $root
> )
> };
>
> let $ns := 'http://www.gym.com'
> let $root := doc("FitnessCenter.xml")/*
> let $updated := local:update($root, $ns)
> return replace node $root with $updated
> ______________________________________
>
> Hope this helps,
> Christian
>
>
>
> On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
>> Hello
>>
>> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>>
>> for $i in doc('FitnessCenter.xml')//*
>> return rename node $i as QName('http://www.gym.com', local-name($i))
>>
>>
>> on the following file:
>>
>>
>>
>>
>> Jeff
>> lightgrey
>>
>>
>> David
>> lightblue
>>
>>
>>
>> and get the following error: new name conflicts with existing namespace binding
>>
>>
>> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>>
>> Thanks in advance
>> Leo
>>
>>
>> _______________________________________________
>> talk at x-query.com
>> http://x-query.com/mailman/listinfo/talk
From christian.gruen at gmail.com Wed Sep 17 01:34:09 2014
From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=)
Date: Wed, 17 Sep 2014 10:34:09 +0200
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To:
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Message-ID:
Hi Leo,
the reason is that the XML document in your first example does not
have any namespace; so there won't be any conflicts. Instead, the new
namespace will be assigned to the addressed element.
This is different in the second case. The specification [1] says that
"If the namespace binding of $QName conflicts with any namespace
binding in the namespaces property of $target, a dynamic error is
raised [err:XUDY0023].". This is why an error is raised if a namespace
already exists.
Hope this helps,
Christian
[1] http://www.w3.org/TR/xquery-update-10/#id-rename
>> The problem is that your original document
>> uses the default namespace "http://www.mygym.com", and your query uses
>> "http://www.gym.com". In other words, the error is raised because the
>> namespace binding of your target name conflicts with the existing
>> namespace binding.
>
> That I don't get.
>
> This works
> let $i:=(doc("FitnessCenter.xml")//Name)[1]
>
> return rename node $i as QName('http://www.gym.com', "Name")
> with
>
>
>
>
> Jeff
> lightgrey
>
>
>
> This not
>
> declare namespace gym='http://www.mygym.com';
>
> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>
> return rename node $i as QName('http://www.gym.com', "Name")
> with
>
>
>
>
> Jeff
> lightgrey
>
>
>
>
>
> Why should that conflict?
> Always
> Leo
>
>
>
>
>>
>> Here is a recursive approach to change the default namespace of a document:
>> ______________________________________
>>
>> declare function local:update($root as node(), $ns as xs:string) {
>> if($root instance of element()) then (
>> element { QName($ns, local-name($root)) } {
>> $root/@*,
>> for $node in $root/node()
>> return local:update($node, $ns)
>> }
>> ) else (
>> $root
>> )
>> };
>>
>> let $ns := 'http://www.gym.com'
>> let $root := doc("FitnessCenter.xml")/*
>> let $updated := local:update($root, $ns)
>> return replace node $root with $updated
>> ______________________________________
>>
>> Hope this helps,
>> Christian
>>
>>
>>
>> On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
>>> Hello
>>>
>>> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>>>
>>> for $i in doc('FitnessCenter.xml')//*
>>> return rename node $i as QName('http://www.gym.com', local-name($i))
>>>
>>>
>>> on the following file:
>>>
>>>
>>>
>>>
>>> Jeff
>>> lightgrey
>>>
>>>
>>> David
>>> lightblue
>>>
>>>
>>>
>>> and get the following error: new name conflicts with existing namespace binding
>>>
>>>
>>> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>>>
>>> Thanks in advance
>>> Leo
>>>
>>>
>>> _______________________________________________
>>> talk at x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
From leo.studer at varioweb.ch Wed Sep 17 03:07:27 2014
From: leo.studer at varioweb.ch (Leo Studer)
Date: Wed, 17 Sep 2014 12:07:27 +0200
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To:
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
Message-ID: <2938BA5B-910C-4E69-99CC-29D915049CF6@varioweb.ch>
Christian, thank you for your lines.
> This is different in the second case. The specification [1] says that
> "If the namespace binding of $QName conflicts with any namespace
> binding in the namespaces property of $target, a dynamic error is
> raised [err:XUDY0023].". This is why an error is raised if a namespace
> already exists.
When I prefix the new name, it works, even though the namespace binding is the same.
declare namespace gym='http://www.mygym.com';
let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
return rename node $i as QName('http://www.gym.com', ?gym:Name")
with
Jeff
lightgrey
I cannot see the namespace conflict.
Thanks anyway
Always
Leo
>
> Hope this helps,
> Christian
>
> [1] http://www.w3.org/TR/xquery-update-10/#id-rename
>
>
>
>>> The problem is that your original document
>>> uses the default namespace "http://www.mygym.com", and your query uses
>>> "http://www.gym.com". In other words, the error is raised because the
>>> namespace binding of your target name conflicts with the existing
>>> namespace binding.
>>
>> That I don't get.
>>
>> This works
>> let $i:=(doc("FitnessCenter.xml")//Name)[1]
>>
>> return rename node $i as QName('http://www.gym.com', "Name")
>> with
>>
>>
>>
>>
>> Jeff
>> lightgrey
>>
>>
>>
>> This not
>>
>> declare namespace gym='http://www.mygym.com';
>>
>> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>>
>> return rename node $i as QName('http://www.gym.com', "Name")
>> with
>>
>>
>>
>>
>> Jeff
>> lightgrey
>>
>>
>>
>>
>>
>> Why should that conflict?
>> Always
>> Leo
>>
>>
>>
>>
>>>
>>> Here is a recursive approach to change the default namespace of a document:
>>> ______________________________________
>>>
>>> declare function local:update($root as node(), $ns as xs:string) {
>>> if($root instance of element()) then (
>>> element { QName($ns, local-name($root)) } {
>>> $root/@*,
>>> for $node in $root/node()
>>> return local:update($node, $ns)
>>> }
>>> ) else (
>>> $root
>>> )
>>> };
>>>
>>> let $ns := 'http://www.gym.com'
>>> let $root := doc("FitnessCenter.xml")/*
>>> let $updated := local:update($root, $ns)
>>> return replace node $root with $updated
>>> ______________________________________
>>>
>>> Hope this helps,
>>> Christian
>>>
>>>
>>>
>>> On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
>>>> Hello
>>>>
>>>> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>>>>
>>>> for $i in doc('FitnessCenter.xml')//*
>>>> return rename node $i as QName('http://www.gym.com', local-name($i))
>>>>
>>>>
>>>> on the following file:
>>>>
>>>>
>>>>
>>>>
>>>> Jeff
>>>> lightgrey
>>>>
>>>>
>>>> David
>>>> lightblue
>>>>
>>>>
>>>>
>>>> and get the following error: new name conflicts with existing namespace binding
>>>>
>>>>
>>>> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>>>>
>>>> Thanks in advance
>>>> Leo
>>>>
>>>>
>>>> _______________________________________________
>>>> talk at x-query.com
>>>> http://x-query.com/mailman/listinfo/talk
>>
>>
>> _______________________________________________
>> talk at x-query.com
>> http://x-query.com/mailman/listinfo/talk
From mike at saxonica.com Wed Sep 17 03:15:56 2014
From: mike at saxonica.com (Michael Kay)
Date: Wed, 17 Sep 2014 11:15:56 +0100
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To: <2938BA5B-910C-4E69-99CC-29D915049CF6@varioweb.ch>
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
<2938BA5B-910C-4E69-99CC-29D915049CF6@varioweb.ch>
Message-ID:
> Christian, thank you for your lines.
>
>> This is different in the second case. The specification [1] says that
>> "If the namespace binding of $QName conflicts with any namespace
>> binding in the namespaces property of $target, a dynamic error is
>> raised [err:XUDY0023].". This is why an error is raised if a namespace
>> already exists.
>
> When I prefix the new name, it works, even though the namespace binding is the same.
A namespace binding is a (prefix, uri) pair, so when you prefix the name there is a new (prefix, uri) pair which doesn't confllct with any existing (prefix, uri) pair. Does that clarify?
Michael Kay
Saxonica
>
> declare namespace gym='http://www.mygym.com';
>
> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>
> return rename node $i as QName('http://www.gym.com', ?gym:Name")
> with
>
>
>
>
> Jeff
> lightgrey
>
>
>
> I cannot see the namespace conflict.
> Thanks anyway
> Always
> Leo
>
>
>
>
>>
>> Hope this helps,
>> Christian
>>
>> [1] http://www.w3.org/TR/xquery-update-10/#id-rename
>>
>>
>>
>>>> The problem is that your original document
>>>> uses the default namespace "http://www.mygym.com", and your query uses
>>>> "http://www.gym.com". In other words, the error is raised because the
>>>> namespace binding of your target name conflicts with the existing
>>>> namespace binding.
>>>
>>> That I don't get.
>>>
>>> This works
>>> let $i:=(doc("FitnessCenter.xml")//Name)[1]
>>>
>>> return rename node $i as QName('http://www.gym.com', "Name")
>>> with
>>>
>>>
>>>
>>>
>>> Jeff
>>> lightgrey
>>>
>>>
>>>
>>> This not
>>>
>>> declare namespace gym='http://www.mygym.com';
>>>
>>> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>>>
>>> return rename node $i as QName('http://www.gym.com', "Name")
>>> with
>>>
>>>
>>>
>>>
>>> Jeff
>>> lightgrey
>>>
>>>
>>>
>>>
>>>
>>> Why should that conflict?
>>> Always
>>> Leo
>>>
>>>
>>>
>>>
>>>>
>>>> Here is a recursive approach to change the default namespace of a document:
>>>> ______________________________________
>>>>
>>>> declare function local:update($root as node(), $ns as xs:string) {
>>>> if($root instance of element()) then (
>>>> element { QName($ns, local-name($root)) } {
>>>> $root/@*,
>>>> for $node in $root/node()
>>>> return local:update($node, $ns)
>>>> }
>>>> ) else (
>>>> $root
>>>> )
>>>> };
>>>>
>>>> let $ns := 'http://www.gym.com'
>>>> let $root := doc("FitnessCenter.xml")/*
>>>> let $updated := local:update($root, $ns)
>>>> return replace node $root with $updated
>>>> ______________________________________
>>>>
>>>> Hope this helps,
>>>> Christian
>>>>
>>>>
>>>>
>>>> On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
>>>>> Hello
>>>>>
>>>>> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>>>>>
>>>>> for $i in doc('FitnessCenter.xml')//*
>>>>> return rename node $i as QName('http://www.gym.com', local-name($i))
>>>>>
>>>>>
>>>>> on the following file:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Jeff
>>>>> lightgrey
>>>>>
>>>>>
>>>>> David
>>>>> lightblue
>>>>>
>>>>>
>>>>>
>>>>> and get the following error: new name conflicts with existing namespace binding
>>>>>
>>>>>
>>>>> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>>>>>
>>>>> Thanks in advance
>>>>> Leo
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> talk at x-query.com
>>>>> http://x-query.com/mailman/listinfo/talk
>>>
>>>
>>> _______________________________________________
>>> talk at x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
From leo.studer at varioweb.ch Wed Sep 17 08:19:41 2014
From: leo.studer at varioweb.ch (Leo Studer)
Date: Wed, 17 Sep 2014 17:19:41 +0200
Subject: [xquery-talk] Namespace conflict ?
In-Reply-To:
References: <2FD554CB-5181-45EC-AA27-119B54EE13AB@varioweb.ch>
<2938BA5B-910C-4E69-99CC-29D915049CF6@varioweb.ch>
Message-ID: <19C13E3A-FAEE-488F-9C33-CFE5B17F0B36@varioweb.ch>
Thank you Michael. In this view, changing the default namespace, the pair (??,uri1) to (??, uri2) is a potential conflict, I can see that.
However, adding a default namespace when no namespace is defined - in the (prefix, uri) view, I would see that as changing (??,??) to (??, uri1) - seems quite similar to me...
Don?t worry, I was just intrigued ;-)
Always
Leo
On 17 Sep 2014, at 12:15, Michael Kay wrote:
>
>> Christian, thank you for your lines.
>>
>>> This is different in the second case. The specification [1] says that
>>> "If the namespace binding of $QName conflicts with any namespace
>>> binding in the namespaces property of $target, a dynamic error is
>>> raised [err:XUDY0023].". This is why an error is raised if a namespace
>>> already exists.
>>
>> When I prefix the new name, it works, even though the namespace binding is the same.
>
> A namespace binding is a (prefix, uri) pair, so when you prefix the name there is a new (prefix, uri) pair which doesn't confllct with any existing (prefix, uri) pair. Does that clarify?
>
> Michael Kay
> Saxonica
>
>>
>> declare namespace gym='http://www.mygym.com';
>>
>> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>>
>> return rename node $i as QName('http://www.gym.com', ?gym:Name")
>> with
>>
>>
>>
>>
>> Jeff
>> lightgrey
>>
>>
>>
>> I cannot see the namespace conflict.
>> Thanks anyway
>> Always
>> Leo
>>
>>
>>
>>
>>>
>>> Hope this helps,
>>> Christian
>>>
>>> [1] http://www.w3.org/TR/xquery-update-10/#id-rename
>>>
>>>
>>>
>>>>> The problem is that your original document
>>>>> uses the default namespace "http://www.mygym.com", and your query uses
>>>>> "http://www.gym.com". In other words, the error is raised because the
>>>>> namespace binding of your target name conflicts with the existing
>>>>> namespace binding.
>>>>
>>>> That I don't get.
>>>>
>>>> This works
>>>> let $i:=(doc("FitnessCenter.xml")//Name)[1]
>>>>
>>>> return rename node $i as QName('http://www.gym.com', "Name")
>>>> with
>>>>
>>>>
>>>>
>>>>
>>>> Jeff
>>>> lightgrey
>>>>
>>>>
>>>>
>>>> This not
>>>>
>>>> declare namespace gym='http://www.mygym.com';
>>>>
>>>> let $i:=(doc("FitnessCenter.xml")//gym:Name)[1]
>>>>
>>>> return rename node $i as QName('http://www.gym.com', "Name")
>>>> with
>>>>
>>>>
>>>>
>>>>
>>>> Jeff
>>>> lightgrey
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Why should that conflict?
>>>> Always
>>>> Leo
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> Here is a recursive approach to change the default namespace of a document:
>>>>> ______________________________________
>>>>>
>>>>> declare function local:update($root as node(), $ns as xs:string) {
>>>>> if($root instance of element()) then (
>>>>> element { QName($ns, local-name($root)) } {
>>>>> $root/@*,
>>>>> for $node in $root/node()
>>>>> return local:update($node, $ns)
>>>>> }
>>>>> ) else (
>>>>> $root
>>>>> )
>>>>> };
>>>>>
>>>>> let $ns := 'http://www.gym.com'
>>>>> let $root := doc("FitnessCenter.xml")/*
>>>>> let $updated := local:update($root, $ns)
>>>>> return replace node $root with $updated
>>>>> ______________________________________
>>>>>
>>>>> Hope this helps,
>>>>> Christian
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Sep 16, 2014 at 12:10 PM, Leo Studer wrote:
>>>>>> Hello
>>>>>>
>>>>>> I use the following query with Saxon-EE xQuery 9.5.1.5 in Oxygen.
>>>>>>
>>>>>> for $i in doc('FitnessCenter.xml')//*
>>>>>> return rename node $i as QName('http://www.gym.com', local-name($i))
>>>>>>
>>>>>>
>>>>>> on the following file:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Jeff
>>>>>> lightgrey
>>>>>>
>>>>>>
>>>>>> David
>>>>>> lightblue
>>>>>>
>>>>>>
>>>>>>
>>>>>> and get the following error: new name conflicts with existing namespace binding
>>>>>>
>>>>>>
>>>>>> I thought the function local-name() produces an output without namespace binding? Can anyone explain?
>>>>>>
>>>>>> Thanks in advance
>>>>>> Leo
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> talk at x-query.com
>>>>>> http://x-query.com/mailman/listinfo/talk
>>>>
>>>>
>>>> _______________________________________________
>>>> talk at x-query.com
>>>> http://x-query.com/mailman/listinfo/talk
>>
>>
>> _______________________________________________
>> talk at x-query.com
>> http://x-query.com/mailman/listinfo/talk
>
From ihe.onwuka at gmail.com Sun Sep 28 03:57:53 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 11:57:53 +0100
Subject: [xquery-talk] outer join between 2 sequences
Message-ID:
I have sequence A consisting of the numbers 0 to 4000000 and sequnce B
consisting of about 100k random I numbers within the range of sequence A
and I want the outer join where sequence B is "null".
Should one expect bad performance in sequence B is not sorted and can one
expect reasonable performance if it is?
I am guessing that performance will vary by implemetation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From adam.retter at googlemail.com Sun Sep 28 04:32:42 2014
From: adam.retter at googlemail.com (Adam Retter)
Date: Sun, 28 Sep 2014 12:32:42 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
> I have sequence A consisting of the numbers 0 to 4000000 and sequnce B
> consisting of about 100k random I numbers within the range of sequence A and
> I want the outer join where sequence B is "null".
There is no 'null' in XQuery, so I am not quite sure what you mean
here. If you ware looking for all values that appear in sequence A and
sequence B, then you can do the following -
$a[. = $b]
> Should one expect bad performance in sequence B is not sorted and can one
> expect reasonable performance if it is?
I think that question is very implementation specific. If all of your
data is in RAM, as your dataset is relatively small and these are just
numbers, I would expect performance to be excellent. I am not sure
that sorting will make much of a difference, but it depends on the
implementation and how it initiates the search for a false comparison
in a large sequence.
> I am guessing that performance will vary by implemetation.
Of course!
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
From ihe.onwuka at gmail.com Sun Sep 28 04:42:43 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 12:42:43 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
On Sun, Sep 28, 2014 at 12:32 PM, Adam Retter
wrote:
> > I have sequence A consisting of the numbers 0 to 4000000 and sequnce B
> > consisting of about 100k random I numbers within the range of sequence A
> and
> > I want the outer join where sequence B is "null".
>
> There is no 'null' in XQuery, so I am not quite sure what you mean
> here. If you ware looking for all values that appear in sequence A and
> sequence B, then you can do the following -
>
> $a[. = $b]
>
>
I meant null in the SQL sense of outer join - sorry.
I want to drop the things that are in B from A where both B and A are just
sequences of integers. In other words, don't fetch what I've already got.
>
> > Should one expect bad performance in sequence B is not sorted and can one
> > expect reasonable performance if it is?
>
> I think that question is very implementation specific. If all of your
> data is in RAM, as your dataset is relatively small and these are just
> numbers, I would expect performance to be excellent.
I am not sure
> that sorting will make much of a difference, but it depends on the
> implementation and how it initiates the search for a false comparison
> in a large sequence.
>
>
that's good - the nightmare scenario is a O^n2 algorithm if B is not sorted
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ihe.onwuka at gmail.com Sun Sep 28 04:55:00 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 12:55:00 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
PPS
>
> On Sun, Sep 28, 2014 at 12:32 PM, Adam Retter
> wrote:
>
>> > I have sequence A consisting of the numbers 0 to 4000000 and sequnce B
>> > consisting of about 100k random I numbers within the range of sequence
>> A and
>> > I want the outer join where sequence B is "null".
>>
>> There is no 'null' in XQuery, so I am not quite sure what you mean
>> here. If you ware looking for all values that appear in sequence A and
>> sequence B, then you can do the following -
>>
>> $a[. = $b]
>>
>
Of course that would be $a[not(. = $b)] maybe even $a except $b, I was
asking more on what the performance expectation would be.
Pleased that it reasonable to expect it to be fast.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ihe.onwuka at gmail.com Sun Sep 28 04:56:22 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 12:56:22 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
On Sun, Sep 28, 2014 at 12:42 PM, Ihe Onwuka wrote:
>
>
> On Sun, Sep 28, 2014 at 12:32 PM, Adam Retter
> wrote:
>
>> > I have sequence A consisting of the numbers 0 to 4000000 and sequnce B
>> > consisting of about 100k random I numbers within the range of sequence
>> A and
>> > I want the outer join where sequence B is "null".
>>
>> There is no 'null' in XQuery, so I am not quite sure what you mean
>> here. If you ware looking for all values that appear in sequence A and
>> sequence B, then you can do the following -
>>
>> $a[. = $b]
>>
>>
>
> I meant null in the SQL sense of outer join - sorry.
>
> I want to drop the things that are in B from A where both B and A are just
> sequences of integers. In other words, don't fetch what I've already got.
>
>
Pah... incorrect snippage in the last post.
Of course that would be $a[not(. = $b)] maybe even $a except $b, I was
asking more on what the performance expectation would be.
Pleased that it reasonable to expect it to be fast.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From adam.retter at googlemail.com Sun Sep 28 04:57:19 2014
From: adam.retter at googlemail.com (Adam Retter)
Date: Sun, 28 Sep 2014 12:57:19 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
> I want to drop the things that are in B from A where both B and A are just
> sequences of integers. In other words, don't fetch what I've already got.
(1,2,3)[fn:not(. = (2,4))]
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
From adam.retter at googlemail.com Sun Sep 28 05:29:26 2014
From: adam.retter at googlemail.com (Adam Retter)
Date: Sun, 28 Sep 2014 13:29:26 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
> I think that question is very implementation specific. If all of your
> data is in RAM, as your dataset is relatively small and these are just
> numbers, I would expect performance to be excellent. I am not sure
> that sorting will make much of a difference, but it depends on the
> implementation and how it initiates the search for a false comparison
> in a large sequence.
I retract any previous statements that may have alluded to good
performance. A quick test on Saxon and eXist shows that this is a very
slow problem. I am trying to see if there is not a short-cut that
could be taken, I will come back to you...
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
From adam.retter at googlemail.com Sun Sep 28 06:13:28 2014
From: adam.retter at googlemail.com (Adam Retter)
Date: Sun, 28 Sep 2014 14:13:28 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
So after a bit more coffee and a bit of research it seems to me that
the only way you are going to get this to be fast would be if you used
a hash based looked for one of your sequences. Something like a
HashMap or BloomFilter would do the job, see:
http://stackoverflow.com/questions/4261619/fastest-set-operations-in-the-west
I have made some experimentations with the above in Scala, a HashMap
works nicely here in-terms of performance because it is simple and
available, and in your case with Integers you do not need to worry
about duplicates because the value of a number is it's identity.
So, if you don't want to implement a HashMap or BloomFilter in XQuery,
what is one to do? Well XQuery 3.1 will introduce the Map data-type
and some implementations already have done this. If you understand the
implementation (or even hazard a guess), there is a good chance that
that XQuery map may in-fact under the covers be a HashMap.
I won't say too much more about this as I have been discussing it with
Wolfgang this morning, and I think he will shortly post you a very
fast example when using XQuery 3.1 Maps in eXist...
On 28 September 2014 13:29, Adam Retter wrote:
>> I think that question is very implementation specific. If all of your
>> data is in RAM, as your dataset is relatively small and these are just
>> numbers, I would expect performance to be excellent. I am not sure
>> that sorting will make much of a difference, but it depends on the
>> implementation and how it initiates the search for a false comparison
>> in a large sequence.
>
> I retract any previous statements that may have alluded to good
> performance. A quick test on Saxon and eXist shows that this is a very
> slow problem. I am trying to see if there is not a short-cut that
> could be taken, I will come back to you...
>
> --
> Adam Retter
>
> skype: adam.retter
> tweet: adamretter
> http://www.adamretter.org.uk
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
From ihe.onwuka at gmail.com Sun Sep 28 08:51:04 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 16:51:04 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To:
References:
Message-ID:
On Sun, Sep 28, 2014 at 2:13 PM, Adam Retter
wrote:
> So after a bit more coffee and a bit of research it seems to me that
> the only way you are going to get this to be fast would be if you used
> a hash based looked for one of your sequences. Something like a
> HashMap or BloomFilter would do the job, see:
>
> http://stackoverflow.com/questions/4261619/fastest-set-operations-in-the-west
>
>
Hmmmmm well I have already committed myself before your retraction and the
thing is running now so am just going to leave it.
This is only the tip of the problem because each integer that survives
selection generates an HTTP request that either returns a 404 or leads to
an HTTP Put into eXist. So if I was really in a hurry I'd have to start
looking at mapReducing the keys. I'm not even sure that is the answer as
all the mapreduce jobs would be pounding the same server (mind you the
site may load balance to mitigate that).
Another alternative solution is to just export sequence B into SQLite,
index both sequences (now they are tables) and do it in SQL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ihe.onwuka at gmail.com Sun Sep 28 08:52:19 2014
From: ihe.onwuka at gmail.com (Ihe Onwuka)
Date: Sun, 28 Sep 2014 16:52:19 +0100
Subject: [xquery-talk] outer join between 2 sequences
In-Reply-To: <25A8DA47-E362-427A-8FA8-2E5EBC43E916@exist-db.org>
References:
<25A8DA47-E362-427A-8FA8-2E5EBC43E916@exist-db.org>
Message-ID:
On Sun, Sep 28, 2014 at 2:25 PM, wrote:
> I won't say too much more about this as I have been discussing it with
> Wolfgang this morning, and I think he will shortly post you a very
> fast example when using XQuery 3.1 Maps in eXist?
>
>
> Well, Michael already posted something along those lines, but here?s my
> solution based on the public 3.1 draft:
>
> xquery version "3.0";
>
> let $a := 1 to 1000000
> let $b := map:new((1 to 100) ! map:entry(xs:int(util:random() * 100000),
> 0))
> return
> $a[map:contains($b, .)]
>
> Wolfgang
>
Would this not be $a[not(map:contains($b, .))] since I want the ones for
which there is no matching sequence B.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: