Hi all,
    May be my question about the diff bewteen database and collection make many people confused.
I post this question because I was confused by the structure of baseX's database.
    And I'm litle clear about the structure.

    And another question: base-uri() return the string value based on Input Path of database. and the base-uri was different if I loaded same data from different folder. why the base-uri() does not return it's path in the database? And is there any function to query document in database by base-uri value?
    And what does the input path used for?


database cqp and fong was created with CREATE DATABASE [name] [input], but edward with CREATE DATABASE [name].

Thanks for your replying, And hope BaseX become more and more popular.

Edward


on 2011/11/8 17:33, Christian Grün Wrote:
Hi Jan, hi all,

I forgot to post my last (and short) answer to Edward to the list.. We
have created a small entry in our Wiki that is supposed to answer
questions around databases in BaseX:

  http://docs.basex.org/wiki/Databases

In BaseX, a single database contains an arbitrary number of resources,
addressed by their unique database path. Resources can either be XML
documents or raw files (binaries). As sets of XML documents are also
called collections, a BaseX database may either contain a single
collection. When new collections are added to the database, they will
be represented in the same directory hierarchy.

We have recently added new functions to simplify the access to
resources within databases:

-- The db:open() function returns documents that are found in a database
-- fn:collection() either returns documents of a database or of the
specified location
-- fn:doc() returns a single document, or opens a database for this
specific document. In the latter case, the database may only contain
the one addressed document.

I hope this answers some more questions; you are welcome to ask for
more (..or edit the Wiki entry in question if you feel that it's
incomplee ;).

Christian
___________________________

On Tue, Nov 8, 2011 at 10:21 AM, Jan Vlčinský (CAD)
<jan.vlcinsky@cad-programs.com> wrote:
What a great question and answer.
Additional question: what is relation between the only document in the
database, and collection of documents, stored in that database.
Is it like this?: database contains one document, this document is/defines
collection of documents.
Am I correct?
Jan Vlčinský

On 8 November 2011 10:07, Michael Seiferle
<michael.seiferle@uni-konstanz.de> wrote:
Hi Edward,
thanks for you email.
Am 08.11.2011 um 05:40 schrieb Edward Fong:

Hi,
   What's the diff between Database and collection? I think there are same
in baseX, am I right?

close, a database contains one document node, while a collection is
allowed to contain several document nodes.
You can easily create a collection by creating a database from a source
directory, by running the following command.
CREATE db collection-test /path/to/xml-directory
To query individual file inside that collection you can use the following:
for $doc in collection('test/input.xml')
return base-uri($doc)
To query each file inside your collection run the following:
for $doc in collection('test')
return base-uri($doc)

Where 'test' is the name of the collection and '/input.xml' is the path to
the document inside this collection.
I hope this helps, feel free to ask for more information as needed.
Kind regards
Michael

And how to query by a document name?
Following are steps of my testing:
1: loaded some xml files form a directory: d:\data\org-*.xml
2: query by doc('org-100525.xml')  and got File or directory "D:/Program
Files (x86)/BaseX701/bin/org-100525.xml" not found message.
3: because after loaded xml, directory: d:\data\org-*.xml was removed. I
can't query by doc('d:\data\org-100525.xml')

Thanks,
Edward

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk