[MonetDB-users] New

Hello,
I am new to MonetDB. I have performed successful queries on the database without adding the document to the database first. Now, I am adding the document first and attempting to query it. After shredding a document, I am unsure about how to query that document. (such as what command to use) In the documentation, it states as an example to type doc("HelloWorld.xml")/doc/greet. but where??
First of all, thanks for using MonetDB/XQuery! You can query your document both in Mserver and using MapiClient. In Mserver, you can use the command "xquery" to execute an xquery (don't forget to use "print" to get the output on the screan): MonetDB>xquery("xml", "doc(\"HelloWorld.xml\")/doc/greet").print(); [ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<XQueryResult>\n<greet kind=\"informal\">Hi </greet><greet kind=\"casual\">Hello </greet>\n</XQueryResult>\n" ] As you can see, the output is quite difficult to read. To get more readable output, you can use MapiClient, like this: $echo "doc(\"HelloWorld.xml\")/doc/greet" | MapiClient -lx <greet kind="informal">Hi </greet>, <greet kind="casual">Hello </greet> Or save your query in a file with the extension ".xq" for later use: $echo "doc(\"HelloWorld.xml\")/doc/greet" > greet.xq | MapiClient -lx greet.xq <greet kind="informal">Hi </greet>, <greet kind="casual">Hello </greet> Regards, Jennie

Hi all, On Mon, Aug 08, 2005 at 09:31:07AM +0200, Ying Zhang wrote: [...]
In Mserver, you can use the command "xquery" to execute an xquery (don't forget to use "print" to get the output on the screan):
MonetDB>xquery("xml", "doc(\"HelloWorld.xml\")/doc/greet").print(); [ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<XQueryResult>\n<greet kind=\"informal\">Hi </greet><greet kind=\"casual\">Hello </greet>\n</XQueryResult>\n" ] [...]
Please note, the ".print()" is only necessary if you are using the development version as of MonetDB/XQuery 0.9.3 (with MonetDB 4.9.3), since "xquery()" now returns the result as a string. To get a better readable output, please use ".printf()" instead of ".print()". In the released version of MonetDB/XQuery (0.8.0 & 0.8.2), the ".print()" is not required, as "xquery()" prints the result to stdout. Stefan -- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
participants (3)
-
rita kelly
-
Stefan Manegold
-
Ying Zhang