You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Kevin Ross <Ke...@iVerticalLeap.com> on 2002/06/12 04:22:50 UTC

[Bug] Collection.removeResource( resource ) does not work when resource is derived from XPathQueryService

Test Case:  An xpath query is issued to retrieve document resources that
need to be removed.
 
collection.removeResource( resource ) does not work when resource is
derived from the XPathQueryService.  It looks as if the reason may be
because the resource.getId() is null when coming from the
XPathQueryService.  
 
What could be the problem?
 
Kevin Ross
 
---------------------------------------------------------
Here is the ResourceSet retrieved via the XPathQueryService.  Notice the
results below which have valid documentIds.
 
// ResourceSet retrieved via XPathQueryService
<?xml version="1.0" encoding="UTF-8"?>
<xapi:resourceSet
xapi:collectionURI="xmldb:xindice:///db/profile/person"
xmlns:xapi="http://www.xmldb.org/xapi/ResourceSet">
            <xapi:resource
xapi:documentID="68ff584058c71fdd000000ee5607171f">
                        <person id="82808080808080808080808080808180"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./person.xsd"
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/profile/person" src:key="68ff584058c71fdd000000ee5607171f">
                                    <name
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">
                                                <first
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Kevin</first>
                                                <middle
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query"/>
                                                <last
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Ross</last>
                                    </name>
                        </person>
            </xapi:resource>
            <xapi:resource
xapi:documentID="68ff584058c71fdd000000ee560787e6">
                        <person id="82808080808080808080808080808280"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./person.xsd"
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/profile/person" src:key="68ff584058c71fdd000000ee560787e6">
                                    <name
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">
                                                <first
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Joe</first>
                                                <middle
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query"/>
                                                <last
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Smith</last>
                                    </name>
                        </person>
            </xapi:resource>
</xapi:resourceSet>

RE: [Bug] Collection.removeResource( resource ) does not work when resource is derived from XPathQueryService

Posted by Kevin Ross <Ke...@iVerticalLeap.com>.
This doesn't make any sense from an API perspective.
 
1.	To remove a resource, I need a Resource object.
2.	I can get a list of Resource objects via the XUpdateQueryService
 
If the Resource object from the query service isn't 'real', then why is
it a Resource object?  And if I can't use that Resource object for
removal via the Collection.removeResource( Resource),   then why on
earth does it exist?
 
Thanks for your pointer Vanessa, I'll find that message and use the
workaround until this is resolved.
 
Kevin
 
-----Original Message-----
From: Vanessa Williams [mailto:v.williams@acm.org] 
Sent: Wednesday, June 12, 2002 11:18 AM
To: xindice-dev@xml.apache.org
Subject: Re: [Bug] Collection.removeResource( resource ) does not
workwhen resource is derived from XPathQueryService
 
As far as I understand it (which isn't very far!) this is the expected
behaviour. Why it is this way isn't clear to me, though. If you look in
the archives a few days back I posted a question about this behaviour,
including a code snippet for how I got around it. It might help you if
you just need to get your problem solved quickly.

Cheers,

Vanessa

Kevin Ross wrote:
Test Case:  An xpath query is issued to retrieve document resources that
need to be removed.



collection.removeResource( resource ) does not work when resource is
derived from the XPathQueryService.  It looks as if the reason may be
because the resource.getId() is null when coming from the
XPathQueryService.  



What could be the problem?



Kevin Ross



---------------------------------------------------------

Here is the ResourceSet retrieved via the XPathQueryService.  Notice the
results below which have valid documentIds.



// ResourceSet retrieved via XPathQueryService

<?xml version="1.0" encoding="UTF-8"?>

<xapi:resourceSet
xapi:collectionURI="xmldb:xindice:///db/profile/person"
xmlns:xapi="http://www.xmldb.org/xapi/ResourceSet">

           <xapi:resource
xapi:documentID="68ff584058c71fdd000000ee5607171f">

                       <person id="82808080808080808080808080808180"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./person.xsd"
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/profile/person" src:key="68ff584058c71fdd000000ee5607171f">

                                   <name
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">

                                               <first
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Kevin</first>

                                               <middle
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query"/>

                                               <last
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Ross</last>

                                   </name>

                       </person>

           </xapi:resource>

           <xapi:resource
xapi:documentID="68ff584058c71fdd000000ee560787e6">

                       <person id="82808080808080808080808080808280"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./person.xsd"
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/profile/person" src:key="68ff584058c71fdd000000ee560787e6">

                                   <name
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">

                                               <first
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Joe</first>

                                               <middle
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query"/>

                                               <last
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:src="http://xml.apache.org/xindice/Query">Smith</last>

                                   </name>

                       </person>

           </xapi:resource>

</xapi:resourceSet>
 

Re: [Bug] Collection.removeResource( resource ) does not work when resource is derived from XPathQueryService

Posted by Vanessa Williams <v....@acm.org>.
As far as I understand it (which isn¹t very far!) this is the expected
behaviour. Why it is this way isn¹t clear to me, though. If you look in the
archives a few days back I posted a question about this behaviour, including
a code snippet for how I got around it. It might help you if you just need
to get your problem solved quickly.

Cheers,

Vanessa

Kevin Ross wrote:

> Test Case:  An xpath query is issued to retrieve document resources that need
> to be removed.
> 
>  
> 
> collection.removeResource( resource ) does not work when resource is derived
> from the XPathQueryService.  It looks as if the reason may be because the
> resource.getId() is null when coming from the XPathQueryService.
> 
>  
> 
> What could be the problem?
> 
>  
> 
> Kevin Ross
> 
>  
> 
> ---------------------------------------------------------
> 
> Here is the ResourceSet retrieved via the XPathQueryService.  Notice the
> results below which have valid documentIds.
> 
>  
> 
> // ResourceSet retrieved via XPathQueryService
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <xapi:resourceSet xapi:collectionURI="xmldb:xindice:///db/profile/person"
> xmlns:xapi="http://www.xmldb.org/xapi/ResourceSet">
> 
>             <xapi:resource xapi:documentID="68ff584058c71fdd000000ee5607171f">
> 
>                         <person id="82808080808080808080808080808180"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="./person.xsd"
> xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/profile/person"
> src:key="68ff584058c71fdd000000ee5607171f">
> 
>                                     <name
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">
> 
>                                                 <first
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">Kevin</first>
> 
>                                                 <middle
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query"/>
> 
>                                                 <last
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">Ross</last>
> 
>                                     </name>
> 
>                         </person>
> 
>             </xapi:resource>
> 
>             <xapi:resource xapi:documentID="68ff584058c71fdd000000ee560787e6">
> 
>                         <person id="82808080808080808080808080808280"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="./person.xsd"
> xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/profile/person"
> src:key="68ff584058c71fdd000000ee560787e6">
> 
>                                     <name
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">
> 
>                                                 <first
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">Joe</first>
> 
>                                                 <middle
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query"/>
> 
>                                                 <last
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:src="http://xml.apache.org/xindice/Query">Smith</last>
> 
>                                     </name>
> 
>                         </person>
> 
>             </xapi:resource>
> 
> </xapi:resourceSet>
>