Database Reference
In-Depth Information
Designing an Application's Collection Structure and Importing Data
When you write an application in eXist (or anywhere else), you need a place to store
your code and the accompanying data. Now, in eXist you can design any collection
structure you like, but it is customary to store applications underneath the /db/apps
collection. So, that is where we're going to put our 101 application.
In this example, we'll consider our data, the plays, static (immuta‐
ble) data. However, most applications also have dynamic data (data
your application creates, updates, uploads, etc.). There is a debate
as to whether (a subcollection of) /db/apps/<yourapp> is a good
location for this data. Some application designers argue that you
should be consistent and keep everything in one place. But storing
your dynamic data somewhere else (e.g., in /db/data/<yourapp> )
has benefits of its own. For instance, you can more easily update
your application's code without losing the accumulated dynamic
data. We won't worry about this in our 101 course, but make sure
to give it some thought if you're going to build a real application.
You could use the Java Admin Client again to create the necessary collections and
import the plays (there's an Import Files button in the toolbar), but let's check out
another useful tool. Close the Java Admin Client, open a web browser, and follow
these steps:
1. Browse to the dashboard ( http://localhost:8080/exist/ ).
2. Log in as admin (click on “Not logged in” in the upper-left corner).
3. Click on the Collections tile.
4. Navigate to /db/apps .
5. Create a fresh /db/apps/exist101 collection (the New Collection command is in
the toolbar).
6. Navigate into the /db/apps/exist101 collection and create the /db/apps/exist101/
data collection .
7. Navigate to the /db/apps/exist101/data collection and click “Upload resources” in
the toolbar.
8. Upload the plays we just downloaded into the collection.
The collection browser should now look like Figure 3-2 .
Search WWH ::




Custom Search