Hi, What's the diff between Database and collection? I think there are same in baseX, am I right? 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
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
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
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
Christian The very first definition of the term database in the wiki is clarifying my question perfectly.
Thanks
Jan
On 8 November 2011 10:33, Christian Grün christian.gruen@gmail.com 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
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
Hi Edward,
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.
questions like this are welcome; they often help us to improve our documentation. Do you think that the current Wiki information gives you all the relevant information you need?
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?
XQuery itself has no database semantics, and the implementation of the doc() and collection() are mostly implementation defined, which is why the base-uri() returns confusing information if documents in databases are addressed. To explicitly open documents in a database, I recommend to use db:open(), or db:list() to retrieve all resources within a database [1].
Hope this helps, Christian
Hi, I set up a baseX db server on 192.168.11.11 by basexserver.bat But failed to connect it with following codes: org.basex.api.xqj.BXQDataSource xqs = new org.basex.api.xqj.BXQDataSource(); xqs.setProperty("user", "admin"); xqs.setProperty("password", "passwd"); xqs.setProperty("serverName", "192.168.11.11"); xqs.setProperty("port", "1984"); // Build a connection to the specified driver. XQConnection conn = xqs.getConnection(); // Prepare the expression with the document and the query. XQPreparedExpression expr = conn.prepareExpression(QUERY);
It seems that xqj of basex only access to it's embbed basex db, right? If not please tell me how to.
Thanks, Edward
Hi Edward,
It seems that xqj of basex only access to it's embbed basex db, right? If not please tell me how to.
True, the client/server architecture is not supported; please see here as well:
http://docs.basex.org/wiki/Code_Examples
Christian
Hi Christian, Thanks for your answer.
Best wishes, Edward
On 2011/11/10 1:21, Christian Grün Wrote:
Hi Edward,
It seems that xqj of basex only access to it's embbed basex db, right? If not please tell me how to.
True, the client/server architecture is not supported; please see here as well:
http://docs.basex.org/wiki/Code_Examples
Christian
basex-talk@mailman.uni-konstanz.de