Archive for the ‘MODS’ Category

Session Solutions

March 12, 2008

So I came up with two possible solutions to my sessions problem, I’m sure there are others as well.

1) I could store all the xqueries that build my metadata admin interface in eXist with restricted read permissions so that uses would be presented with a login from the server when they arrive at the page, this would initiate the REST session, which would presumably perpetuate as long as the window was active (and thus hopefully by-pass the random logout issue.)

I haven’t actually tried this one, I just assume it would work. I don’t particularly like the solution because I don’t store most of my xqueries in eXist. However, I haven’t ruled it out.

2) Solution 2 is the one I worked on all day yesterday. First I’ve gone back to submitting the data via a POST which sends the data to an xquery, this query then uses the xmldb:store() function to save the data to eXist. This xquery also checks to see if there is a current session using session:exists(), if not it will send back “Not logged in!” if there is a current session the xquery will attempt to save the record to the database, if successful the xmldb:store() function returns the path to the resource, if it fails it returns an empty string.

My XForm now uses an event observer to check if the submit action was successful, if not it will warn the user that they are either not logged in, or have insufficient privileges to edit the resource and toggles them to a login form located at the top of their current page. Users can then login, a separate event is fired that changes or creates a new session and the user can save the data in the form, all without refreshing or leaving the form.

After much tweaking this seems to work. The nice thing is that having the login on the form saves the user from losing the data that they have been working on.

Here are what the additions the form look like:

Two new instances, the first to check what sort of error the xquery sends back if it is not successful:

<xforms:instance id="submitError">
  <dummy xmlns="">
    <submit/>
  </dummy>
</xforms:instance>

The second to hold the login information:

<xforms:instance id="login">
  <dummy xmlns="">
    <user/>
    <pass/>
  </dummy>
</xforms:instance>

Additions to the submission action:

<xforms:submission id="submit" method="post" ref="instance('metadata')"
 replace="text" instance="submitError" action="xqueryGoesHere.xql">
   <xforms:action ev:event="xforms-submit-done" ev:observer="submit">
     <xforms:message level="modal">Item Saved!</xforms:message>
     <xforms:refresh/>
   </xforms:action>
   <xforms:action ev:event="xforms-submit-error" ev:observer="submit">
     <xforms:message level="modal" 
       ref="instance('submitError')/child::*[. = '']">You do not have permission 
       to edit this resource! Please log in.</xforms:message>
     <xforms:message level="modal"  
       ref="instance('submitError')/child::*[. = 'Not logged in!']">You are no longer 
       logged in! Please log in.</xforms:message>
     <xforms:toggle case="case-login"/>
     <xforms:refresh/>
   </xforms:action>
</xforms:submission>

I’ve then added a xforms:switch to the top of the MODS form that toggles between a login form and summary information about the resource. As you can see in the submission, if there is an error, the top part of the form will toggle to display a login form for the users, case-login. Once the user logs in with the new name and password, they click login which fires this submission action:

<xforms:submission id="do-login" method="get" replace="instance" 
 instance="login" separator="&" ref="instance('login')" action="login.xql">
  <xforms:action ev:event="xforms-submit-done" ev:observer="do-login">
    <xforms:message level="modal">You are now logged in. Please re-save your data.
    </xforms:message>
    <xforms:toggle case="ready"/>
    <xforms:refresh/>
  </xforms:action>
  <xforms:action ev:event="xforms-submit-error" ev:observer="do-login">
    <xforms:message level="modal">Incorrect login information</xforms:message>
    <xforms:toggle case="case-login"/>
    <xforms:refresh/>
  </xforms:action>
</xforms:submission>

The login.xql looks very similar to this example from the eXist website. If the login is successful the form toggles from the login info to the MODS form info. The user is then prompted to re-save their data as the new user.

I’m still a little nervous putting the catalogers back to work with these forms because I haven’t been able to replicate some of the problems they had reported, but  I’m hoping even if they do get logged out this new form will allow them to log back in without losing any data. I’ve also finally made it possible to page from one record to the next in the queue, maybe that will buy me a little extra goodwill.

Advertisements

MODS for everyone

February 18, 2008

When I started working on the CDI project almost 2 years ago there were no easy solutions for integrating the creation and editing of complex metadata into a project workflow. Most DAMS (Digital Asset Management Systems) came with the ability to create Dublin Core, or some form of modified Dublin Core, but the creation of MODS was not supported.

Today there are a plethora of people working on MODS editor solutions. Here are just a few:

  1. The University of Tennessee Libraries – The University of Tennessee has released their MODS workbook as open source, it is a web based form that I believe is javascript based.
  2. Peter Binkley at the University of Alberta – Peter has just announced his MODS editor is complete, or very nearly so and is built using the Cocoon Forms Framework and and you can try it out here.
  3. Michael Park at Brown University – Mike has been working on a MODS editor using Orbeon Forms.
    **edited to add links from our recent presentation:
    Code and documentation: http://dl.lib.brown.edu/its/software/metadata/
    Example: http://riker.services.brown.edu:8080/repo/mods/demo.html
  4. Parmit Chilana formerly at Princeton University – Wrote a MODS editor using Orbeon, I’m not sure who has taken over now that she has moved on.
  5. Clay Redding at the Library of Congress
  6. Me – I just got permission to release our metadata editor as open source from the UVM powers-that-be. The forms need some cleaning up, but I’m posting my demo forms here, and will be slowly adding the code for the entire metadata editing interface, including our forms for posting data to Solr. I’ve also had some time to refine the MODS editor we are using in production, there are two versions, the simple version – used by the copy catalogers – and the full version for editing the full record.
    **links from my recent presentation:
    Code: http://code.google.com/p/xforms4lib/
    Examples:

Its great to see so much development happening in this area, it always seemed crazy to me that we had so many library metadata standards but but no way for our users to create these records. I still prefer the XForms solution to most of the other solutions I’ve seen, just because XForms seems to me the most logical and simple (in spite of all the trouble I’ve had with it) method for creating and editing XML data.

Now, if only someone would build a decent METS editor.