ways to insert and query for documents
Friday, 7 May 2010 · 4 messages
RP
Robby Pelssers7 May 2010 17:12 #
Hi all,
I was wondering if BaseX also supports the concept of having collections in the database.
The reason why I need collections is that I have xml files with the same identifier. My customer exports product information for different states (workflow | work in progress | released) to the file system currently but we would like to export everything to an xml database.
So I'd like to create 3 separate collections for the 3 states and being able to query for product 'X' in state 'Y'. Is this possible?
Robby Pelssers
AW
Andreas Weiler7 May 2010 17:24 #
Dear Robby Pelssers,
of course BaseX supports the concept of collections.
You can add all three documents to one collection.
Start with creating an empty collection: create coll states and then continue with adding the documents: add workflow.xml add workInProgress.xml
add released.xml
or do it all in one by calling: basex -c "create coll states; add workflow.xml; add workInProgress.xml; add released.xml".
Now you can use XQuery for getting your results.
I hope this helps,
dont hesitate to ask for more.
Kind regards,
Andreas (BaseX Team)
Quoted text · Robby Pelssers · 16 lines
Robby Pelssers schrieb: > Hi all, > > I was wondering if BaseX also supports the concept of having collections in the database. > > The reason why I need collections is that I have xml files with the same identifier. My customer exports product information for different states (workflow | work in progress | released) to the file system currently but we would like to export everything to an xml database. > > So I'd like to create 3 separate collections for the 3 states and being able to query for product 'X' in state 'Y'. Is this possible? > > Robby Pelssers > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
RP
Robby Pelssers7 May 2010 17:44 #
Hi Andreas,
Thx for the quick answer...
But I'm not 100% sure we're on the same line here.
If I try to explain the structure on the file system it would be
${repository}
- released
- products
-product1
product1.xml
some images
-product2
product2.xml
-...
- packages
-package1
Package1.xml
Some images
-package2
Package2.xml
...
- wip
- products
-product1
product1.xml
some images
-product2
product2.xml
-...
- packages
-package1
Package1.xml
Some images
-package2
Package2.xml
...
- workflow
- products
-product1
product1.xml
some images
-product2
product2.xml
-...
- packages
-package1
Package1.xml
Some images
-package2
Package2.xml
...
So from your mail I understand I could first create 3 collections
- create coll released
- create coll wip
- create coll workflow
And then probably change dir into the released collection and create a collection for 'products' and 'packages'.
I was actually looking into the documentation (tab REST) and wondering if a client could insert a product by using a fully qualified path for addressing the correct collection.
Cheers,
Robby
Quoted text · Andreas Weiler · 38 lines
-----Original Message----- From: Andreas Weiler [mailto:andreas.weiler at uni-konstanz.de] Sent: Friday, May 07, 2010 5:24 PM To: Robby Pelssers Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] ways to insert and query for documents Dear Robby Pelssers, of course BaseX supports the concept of collections. You can add all three documents to one collection. Start with creating an empty collection: create coll states and then continue with adding the documents: add workflow.xml add workInProgress.xml add released.xml or do it all in one by calling: basex -c "create coll states; add workflow.xml; add workInProgress.xml; add released.xml". Now you can use XQuery for getting your results. I hope this helps, dont hesitate to ask for more. Kind regards, Andreas (BaseX Team) Robby Pelssers schrieb: > Hi all, > > I was wondering if BaseX also supports the concept of having collections in the database. > > The reason why I need collections is that I have xml files with the same identifier. My customer exports product information for different states (workflow | work in progress | released) to the file system currently but we would like to export everything to an xml database. > > So I'd like to create 3 separate collections for the 3 states and being able to query for product 'X' in state 'Y'. Is this possible? > > Robby Pelssers > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
AW
Andreas Weiler7 May 2010 18:17 #
Dear Robby,
the collection concept doesnt support to store collections in collections, so
i recommend that you create one database for each folder of your files: create db released (from folder released)
create db wip (from folder released)
create db workflow (from folder workflow)
Then you can get the Product 'X' of State 'Y' like the following: xquery doc('Y')//X
I hope this helps,
dont hesitate to ask for more.
Kind regards,
Andreas (BaseX Team)
Quoted text · Robby Pelssers · 131 lines
Robby Pelssers schrieb: > Hi Andreas, > > Thx for the quick answer... > > > But I'm not 100% sure we're on the same line here. > > If I try to explain the structure on the file system it would be > > > ${repository} > - released > - products > -product1 > product1.xml > some images > -product2 > product2.xml > -... > > - packages > -package1 > Package1.xml > Some images > -package2 > Package2.xml > ... > > - wip > - products > -product1 > product1.xml > some images > -product2 > product2.xml > -... > > - packages > -package1 > Package1.xml > Some images > -package2 > Package2.xml > ... > > - workflow > - products > -product1 > product1.xml > some images > -product2 > product2.xml > -... > > - packages > -package1 > Package1.xml > Some images > -package2 > Package2.xml > ... > > > So from your mail I understand I could first create 3 collections > > - create coll released > - create coll wip > - create coll workflow > > > And then probably change dir into the released collection and create a collection for 'products' and 'packages'. > > I was actually looking into the documentation (tab REST) and wondering if a client could insert a product by using a fully qualified path for addressing the correct collection. > > Cheers, > Robby > > > -----Original Message----- > From: Andreas Weiler [mailto:andreas.weiler at uni-konstanz.de] > Sent: Friday, May 07, 2010 5:24 PM > To: Robby Pelssers > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] ways to insert and query for documents > > Dear Robby Pelssers, > > of course BaseX supports the concept of collections. > You can add all three documents to one collection. > Start with creating an empty collection: create coll states > and then continue with adding the documents: add workflow.xml > add > workInProgress.xml > add > released.xml > > or do it all in one by calling: basex -c "create coll states; add > workflow.xml; add workInProgress.xml; add released.xml". > Now you can use XQuery for getting your results. > > I hope this helps, > dont hesitate to ask for more. > > Kind regards, > Andreas (BaseX Team) > > Robby Pelssers schrieb: > >> Hi all, >> >> I was wondering if BaseX also supports the concept of having collections in the database. >> >> The reason why I need collections is that I have xml files with the same identifier. My customer exports product information for different states (workflow | work in progress | released) to the file system currently but we would like to export everything to an xml database. >> >> So I'd like to create 3 separate collections for the 3 states and being able to query for product 'X' in state 'Y'. Is this possible? >> >> Robby Pelssers >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery