In the previous post on developing with MarkLogic Server, I had got as far as using the simple 'Load' tab in the admin console web page to load FpML 4.7 XML Schemas into MarkLogic. In this post, I want to discuss how you view the contents of the database. As I mentioned earlier, databases can be all too easy a place to lose data, and that is because the tools focus more in specific queries than they do on general browsing. While it may not be possible to just "browse" a database containing a huge number of documents (i.e. a huge amount of data), a development setup often has much less content, and being able to browse the documents (in the manner of browsing files in a file system) is a very useful thing to be able to do.
A good place to start is by downloading the 'CQ' application from the MarkLogic developer site. This allows you to run XQueries on a MarkLogic database, but it also allows you to view what files are in your database. Note that while 'CQ' is a tool I would always recommend installing for development purposes, it isn't a tool you should leave installed on a live production system.
- Download 'CQ' from 'http://developer.marklogic.com/code/cq'. Assuming you are running MarkLogic Server
4.1, download '
- We will install 'CQ' into the existing '
Docs' database that is part of the default MarkLogic Server setup. This database uses a filesystem directory. Go to your MarkLogic Server installation directory, and find the '
- Extract the 'CQ' ZIP file into the '
Docs' directory, preserving the directory structure. This should create a '
cq' directory inside the '
It's that easy, 'CQ' is now installed. Let's test it. First, note what the URL is for your
admin console. It will be port 8001; my admin console URLs start with
http://localhost:8001/'. You probably won't have '
as by default MarkLogic uses the machine name. Make a note of your admin console domain
name, and then use that domain to replace 'localhost' in this URL: 'http://localhost:8000/cq/'. You should now see the
Just above the 'Query results' section is a 'content-source' drop-down list. Select 'FpML-Schemas' as the content source, and the click the 'explore' link near the top of the page.
You should see results for 37 files appear in the lower section of the page. The exact URIs will depend on where the FpML XML Schemas were on your file system when you loaded them.
So, now you have a basic way to examine what documents are in your database. You can also browse the documents by running an XQuery in 'CQ'. In the list of 'Queries' at the right of the window, click on number 1 and replace the query with
Make sure that the content source is 'FpML-Schemas', then press the 'TEXT' button. The URIs for all of the documents in the 'FpML-Schemas' database are listed.
Another way to browse the documents in your database is to create a WebDAV server for your database in MarkLogic Server. That will be the subject of the next post in this series.