JIO Metadata Draft

What is metadata?

The word "metadata" means "data about data". Metadata articulates a context for objects of interest -- "resources" such as MP3 files, library books, or satellite images -- in the form of "resource descriptions". As a tradition, resource description dates back to the earliest archives and library catalogs. The modern "metadata" field that gave rise to Dublin Core and other recent standards emerged with the Web revolution of the mid-1990s. http://dublincore.org/metadata-basics/

Why use metadata?

Uploading a document to several servers can be very tricky, because the document has to be saved in a place where it can be easily found with basic searches in all storages (For instance: ERP5, XWiki and Mioga2 have their own way to save documents and to get them). So we must use metadata for interoperability reasons. Interoperability is the ability of diverse systems and organizations to work together.

How to format metadata with JIO

See below XML and its JSON equivalent:

<dc:title>My Title</dc:title>
=
{"title":"My Title"}


<dc:contributor>Me</dc:contributor>
<dc:contributor>And You</dc:contributor>
=
{"contributor":["Me", "And You"]}


<dc:identifier scheme="DCTERMS.URI">http://my/resource</dc:identifier>
<dc:identifier>Xaoe41PAPNIWz</dc:identifier>
=
{"identifier": [
  {"scheme": "DCTERMS.URI", "content": "http://my/resource"},
  "Xaoe41PAPNIWz"
]}

List of metadata to use

Identification

Intellectual property

Content

Examples

Posting a webpage for JIO

jio.put({
  "_id"         : "...",
  "identifier"  : "http://domain/jio_home_page",
  "format"      : ["text/html", "52 kB"],
  "date"        : new Date(),
  "type"        : "Text",
  "creator"     : ["Nexedi", "Tristan Cavelier", "Sven Franck"],
  "title"       : "JIO Home Page",
  "subject"     : ["JIO", "basics"],
  "description" : "Simple guide to show the basics of JIO",
  "category"    : ["resilience/jio", "webpage"],
  "language"    : "en"
}, callbacks); // send content as attachment

Posting JIO library

jio.put({
  "_id"         : "...",
  "identifier"  : "jio.js",
  "date"        : "2013-02-15",
  "format"      : "application/javascript",
  "type"        : "Software",
  "creator"     : ["Tristan Cavelier", "Sven Franck"],
  "publisher"   : "Nexedi",
  "rights"      :
    "https://www.j-io.org/documentation/jio-documentation/#copyright-and-license",
  "title"       : "Javascript Input/Output",
  "subject"     : "JIO",
  "category"    : ["resilience/javascript", "javascript/library/io"]
  "description" : "jIO is a client-side JavaScript library to manage " +
                  "documents across multiple storages."
}, callbacks); // send content as attachment

Posting a webpage for interoperability levels

jio.put({
  "_id"         : "...",
  "identifier"  : "http://dublincore.org/documents/interoperability-levels/",
  "date"        : "2009-05-01",
  "format"      : "text/html",
  "type"        : "Text",
  "creator"     : ["Mikael Nilsson", "Thomas Baker", "Pete Johnston"],
  "publisher"   : "Dublin Core Metadata Initiative",
  "title"       : "Interoperability Levels for Dublin Core Metadata",
  "description" : "This document discusses the design choices involved " +
                  "in designing applications for different types of " +
                  "interoperability. [...]",
  "language"    : "en"
}, callbacks); // send content as attachment

Posting an image

jio.put({
  "_id"         : "...",
  "identifier"  : "new_york_city_at_night",
  "format"      : ["image/jpeg", "7.2 MB", "8192 x 4096 pixels"],
  "date"        : "1999",
  "type"        : "Image",
  "creator"     : "Mr. Someone",
  "title"       : "New York City at Night",
  "subject"     : ["New York"],
  "description" : "A photo of New York City taken just after midnight",
  "coverage"    : ["New York", "1996-1997"]
}, callbacks); // send content as attachment

Posting a book

jio.put({
  "_id"         : "...",
  "identifier"  : {"scheme": "DCTERMS.URI", "content": "urn:ISBN:0385424728"},
  "format"      : "application/pdf",
  "date"        : {"scheme": "DCTERMS.W3CDTF", "content": getW3CDate()}, // see tools below
  "creator"     : "Original Author(s)",
  "publisher"   : "Me",
  "title"       : {"lang": "en", "content": "..."},
  "description" : {"lang": "en", "Summary: ..."},
  "language"    : {"scheme": "DCTERMS.RFC4646", "content": "en-GB"}
}, callbakcs); // send content as attachment

Posting a video

jio.put({
  "_id"         : "...",
  "identifier"  : "my_video",
  "format"      : ["video/ogg", "130 MB", "1080p", "20 seconds"],
  "date"        : getW3CDate(), // see tools below
  "type"        : "Video",
  "creator"     : "Me",
  "title"       : "My life",
  "description" : "A video about my life"
}, callbacks); // send content as attachment

Posting a job announcement

jio.post({
  "format"      : "text/html",
  "date"        : "2013-02-14T14:44Z",
  "type"        : "Text",
  "creator"     : "James Douglas",
  "publisher"   : "Morgan Healey Ltd",
  "title"       : "E-Commerce Product Manager",
  "subject"     : "Job Announcement",
  "description" : "...",
  "language"    : "en-GB",
  "source"      : "James@morganhealey.com",
  "relation"    : ["Totaljobs"],
  "coverage"    : "London, South East",
  "job_type"    : "Permanent",
  "salary"      : "£45,000 per annum"
}, callbacks); // send content as attachment
// result: http://www.totaljobs.com/JobSeeking/E-Commerce-Product-Manager_job55787655

Getting a list of document created by someone

With complex query:

jio.allDocs({"query": "creator: \"someone\""}, callbacks);

Getting all documents about JIO in the resilience project

With complex query:

jio.allDocs({"query": "subject: \"JIO\" AND category: \"resilience\""}, callbacks);

Tools

W3C Date function

/**
 * Tool to get the date in W3C date format
 * - "2011-12-13T14:15:16+01:00" with use_utc = false (by default)
 * - "2011-12-13T13:15:16Z" with use_utc = true
 *
 * @param  {Boolean} use_utc Use UTC format
 * @return {String} The date in W3C date format
 */
function getW3CDate(use_utc) {
  var d = new Date(), offset;
  if (use_utc === true) {
    return d.toISOString();
  }
  offset = - d.getTimezoneOffset();
  return (
    d.getFullYear() + "-" +
      (d.getMonth() + 1) + "-" +
      d.getDate() + "T" +
      d.getHours() + ":" +
      d.getMinutes() + ":" +
      d.getSeconds() + "." +
      d.getMilliseconds() +
      (offset < 0 ? "-" : "+") +
      (offset / 60) + ":" +
      (offset % 60)
  ).replace(/[0-9]+/g, function (found) {
    if (found.length < 2) {
      return '0' + found;
    }
    return found;
  });
}

Sources