Friday, 15 May 2009

RDF + UI + Fedora for object metadata (RDF) editing

Just a walkthrough of something I am trying to implement at the moment:


For the Web UI:

Using jQuery and 3 plugins: jEditable, autocomplete and rdfquery.

Needed middleware controls from the Web App:
  1. create new session (specifically, a delta of the RDF expressed in iand's ChangeSet schema ) POST /{object-id}/{RDF}/session/new -> HTTP 201 - session url (includes object id root)
  2. POST triples to /{session-url}/update to add to the 'add' and/or 'delete' portions
  3. A POST to /{session-url}/commit or just DELETE /{session-url}
And all objects typed by rdf:type (multitypes allowed)


  1. Template grabs RDF info from object, and then displays it in the typical manner (substituting labels for uris when relevant), but also encodes the values with RDFa.
  2. If the user is auth'd to edit, each of these values has a css class added so that the inline editing for jeditable can act on it.
  3. It then reads for the given type of object the cardinality of the fields present (eg from an OWL markup for the class) and also the other predicates that can be applied to this object. For multivalued predicates, an 'add another' type link is appended below. For unused predicates, its up to the template to suggest these - currently, all the objects in the repo can have type specific templates, but for this example, I am considering generics.
  4. For predicates which have usefully typed ranges, ie foaf:knows in our system points to a URI, rather than a string - autocomplete is used to hook into our or maybe anothers index of known labels for uris to suggest correct values. For example, if an author was going to indicate their affiliation to a department here at oxford (BRII project) it would be handy if a correct list of department labels was used. A choice from the list would view as the label, but represent the URI in the page.
  5. When the user clicks on it to change the value, a session is created if none exists stamped with the start time of the edit and the last modified date of the RDF datastream, along with details of the editor, etc.
  6. rdfquery is used to pull the triple from the RDFa in the edited field. When the user submits a change, the rdfa triple is posted to the session url as a 'delete' triple and the new one is encoded as an 'add' triple.
  7. A simple addition would just post to the session with no 'delete' parameter.
  8. The UI should then reflect that the session is live and should be committed when the user is happy with the changes.
  • On commit, the session would save the changeset to the object being edited, and update the RDF file in question. (so we keep rdfquery would then update the RDFa in the page to the new values, upon a 200/204 reply.
  • On cancel, the values would be restored, and the session deleted.
Commit Notes:
If the lastmodified date on the datastream is different from the one marked on the session (ie possible conflict), the page information is updated to the most recent and the session is reapplied in the browser, highlighting the conflicts, and a warning given to the user.

I am thinking of increasing the feedback using a messaging system, while keeping the same optimistic edit model - you can see the status of an item, and that someone else has a session open on it. The degree to the feedback is something I am still thinking about - should the UI highlight or even reflect the values that the other user(s) is editing in realtime? is that useful?

1 comment:

Anonymous said...

Interesting workflow. I am currently also using Jquery (plugins) to develop forms for easy semantic web data entry, but less ambitious.

I use "static" forms with SPARQL to feed the autocomplete plugin and RDFAlchemy+Pylons to convert to triples and store the data. A Pylons-session is mapped to a named graph to provide provenance.

Do blog about your progress (If you find the time).