Go to XML/SQL-XML and enter a SQL to XML statement in the SQLX or SQL-XML Query text-area:
SELECT "product".ProductID AS "id", "product".ProductName AS "name" FROM "Demo"."demo"."Products" as "product" FOR XML AUTO ELEMENT
Type the root XML element name into the Root Element field. The results of the query will be contained within this root element.
Type the full path and resource name where you want your XML resource to reside under WebDAV in the WebDAV Resource path for the result field. Collection(s) described in the full path must already exist.
You may use the Browse button next to the WebDAV Resource path for the result field to navigate existing WebDAV collections (folders) or resources to store the result of query.
From the "Stored Queries" tab if you choose a resource that already exists as a query in WebDAV resource, after click the "Edit" link, the form will automatically acquire the details from the query.
If an XSLT transformation should be performed on retrieval time then you may either type the location of the stylesheet in the Stylesheet field or press the Browse button next to it to search for a valid XSLT stylesheet from the WebDAV repository.
Provide the appropriate WebDAV owner and group of stored result using the drop downs provided.
Select appropriate permissions for the stored result.
The query can be set to update itself at specific intervals of time or execute every time the resource is retrieved. If Persist XML is checked the query will be executed on Update every 10 minutes by default.
Press the Execute button to execute the statement and store as a WebDAV resource. Use Reset to clear the form
If you want to build a schema definition for the result then press the Create XML Schema radio-button.
Virtuoso can provide the generated XML output with a full DTD for the data. Press Create External DTD to enable this option for the query.
Go to XML / XQuery /Xquery Basic.
XQuery Document Search applies the XPATH expression to every realized XML contained within the Query Scope to qualify search hit results. Note that this does not include XML Views unless persistent.
Figure6.93.XPATH Query of DAV
Choose the Scope of Query from within the WebDAV repository. You may define the scope as either No Context, DAV Resource (file), DAV Collection (folder), External Document URL, External Collection URL or Database Table. Use the Browse button to browse the contents of WebDAV to make a selection. The query will then be confined to the selected resource or collection and its children. Then Click the button "Next" in order to continue.
Figure6.94.XPATH Query of DAV
Enter that XPATH query expression into the text area that you wish to interrogate your WebDAV XML documents with. e.g. //* or //title
The Root Element field allows you specify the name of the root element to contain document element matches for each document found. This aids stylesheet design.
Choose an Output Style Sheet by either typing its URL or using Browse to select an XSL resource from WebDAV. You only need to specify a style sheet if you want to transform your XML results using XSLT.
Click the button "Next" in order to continue.
Choose an Store into location by either typing its URL or using Browse to select a DAV resource from WebDAV
Set Permissions for the output result. Check "r" for read rights for Group and Users in order to view later the saved xml file.
You may want to Replace the existing resource by checking the shown check-box with this label.
Choose Output Type that you wish to obtain. Persist XML should be selected with Update interval im minutes or if you want to be created as XML Template, fill in the "Create as XML Template Description" field.
Click the button "Save".
Figure6.95.XPATH Query of DAV
Figure6.96.XPATH Query of DAV
If for location you have chosen /DAV/xmlsql/xquery.xml, you can view the saved file accessing the url: http://host:port/DAV/xmlsql/xquery.xml
Figure6.97.XPATH Query of DAV