Skip to content

Configuring Memento

mielvds edited this page May 4, 2016 · 8 revisions

The Linked Data Fragments server supports the Memento Protocol. If your Linked Data source evolve over time and has multiple versions, it makes access and query across the various versions straightforward. To enable the Memento Protocol, follow the guide below.

Add Memento datasources

Any data source can be configured as a Memento resource, meaning it represents a prior version of an existing data source. This is done by adding a memento property to any datasource in your config file. This property has an interval property, containing an array of start and end timestamps in which this memento was valid. Each timestamp must be in ISO 8601 format.

For example, the datasources dbpedia_2015 and dbpedia_2014 are mementos of DBpedia valid in 2014 and 2015:

"datasources": {
  "dbpedia_2015": {
    "title":       "DBpedia v2015",
    "description": "DBpedia v2015 with an HDT back-end",
    "type":        "HdtDatasource",
    "settings":    {
      "file": "/data1/dbpedia/cdata_2015.hdt"
    },
    "memento": {
      "interval": ["2014-09-14T11:59:59Z", "2015-04-15T00:00:00Z"]
    }
  },
  "dbpedia_2014": {
    "title":       "DBpedia v2014",
    "description": "DBpedia v2014 with an HDT back-end",
    "type":        "HdtDatasource",
    "settings":    {
      "file": "/data1/dbpedia/cdata_2014.hdt"
    },
    "memento": {
      "interval": ["2013-06-15T11:59:59Z", "2014-09-15T00:00:00Z"]
    }
  }

Add an Original Resource

You can promote a data source to serve Original Resources by attaching it to a Timegate. This indicates to the LDF server that there are mementos available to this datasource. Simply add timegate: true to the datasource configuration. The LDF server will then use the information provided in the timegates section (see below) to build the appropriate Memento responses.

For example, the following datasource named dbpedia is the current version or in Memento terms, the Original.

"dbpedia": {
    "title":       "DBpedia 2015",
    "description": "DBpedia 2015 with an HDT back-end",
    "type":        "HdtDatasource",
    "settings":    {
      "file": "/data1/dbpedia/cdata_2015.hdt"
    },
    "timegate": true
  },

Add a timegate

To connect an Original Resource to its Mementos, you need to configure a Timegate. Therefore, add a new section called timegates. This section contains a subsection mementos, which lists all the versions (aka Mementos) per datasource. The LDF server uses this information to connect a particular datasource with its versions, and also to build the appropriate Memento URL for the versions. The route where the Timegates are located can be customised by setting baseURL.

For example, the timegates section below links 2 versions dbpedia_2014 and dbpedia_2015 with the datasource dbpedia:

"timegates": {
  "baseURL": "/timegate/",
  "mementos": {
    "dbpedia": {
      "versions": [
        "dbpedia_2015",
        "dbpedia_2014"
      ]
    }
  }
}

If the Original Resource is hosted externally, you can specify the originalBaseURL to reconstruct its URL.

"timegates": {
  "baseURL": "/timegate/",
  "mementos": {
    "dbpedia": {
      "originalBaseURL": "http://fragments.dbpedia.org/2015/en",
      "versions": [
        "dbpedia_2015",
        "dbpedia_2014"
      ]
    }
  }
}

Example: DBpedia TPF archive

The Memento DBpedia LDF Server supports about 10 versions of DBpedia starting from 2007. A Memento Client like Memento for Chrome can be used to navigate the versions in a browser. The command line utility, cUrl, can also be used to see Memento in action. The following example queries the Memento LDF TimeGate to retrieve a Memento of the English DBpedia page around 15 March 2015.

$ curl -IL -H "Accept-Datetime: Wed, 15 Apr 2015 00:00:00 GMT" http://dbpedia.mementodepot.org/timegate/http://dbpedia.org/page/English

HTTP/1.1 302 Found
Date: Tue, 15 Mar 2016 21:07:08 GMT
Location: http://dbpedia.mementodepot.org/memento/20150415000000/http://dbpedia.org/page/English
Vary: accept-datetime
Link: <http://dbpedia.org/page/English>; rel="original",<http://dbpedia.mementodepot.org/timemap/link/http://dbpedia.org/page/English>; rel="timemap"; type="application/link-format",<http://dbpedia.mementodepot.org/memento/20150415000000/http://dbpedia.org/page/English>; rel="memento"; datetime="Wed, 15 Apr 2015 00:00:00 GMT"

HTTP/1.1 200 OK
Date: Tue, 15 Mar 2016 21:07:08 GMT
Content-Type: text/html
Link: <http://dbpedia.org/page/English>; rel="original", <http://dbpedia.mementodepot.org/memento/20150415000000/http://dbpedia.org/page/English>; rel="memento"; datetime="Wed, 15 Apr 2015 00:00:00 GMT", <http://dbpedia.mementodepot.org/timegate/http://dbpedia.org/page/English>; rel="timegate", <http://dbpedia.mementodepot.org/timemap/link/http://dbpedia.org/page/English>; rel="timemap"
Memento-Datetime: Wed, 15 Apr 2015 00:00:00 GMT
Clone this wiki locally