Overview

To verify that IIIF manifests are written in JSON-LD, I tried converting them to other formats, so this is a memo of that process.

We hope this serves as a useful reference for understanding the relationship between RDF and file formats such as JSON-LD and Turtle, as well as their relationship with IIIF manifest files described in JSON-LD.

Target

For this exercise, we will use the following manifest file published on the NDL Digital Collection.

https://dl.ndl.go.jp/api/iiif/3437686/manifest.json

Conversion

We use the EASY RDF Converter.

https://www.easyrdf.org/converter

As shown below, specify the IIIF manifest file URL, select JSON-LD as the Input Format, and Turtle as the Output Format.

The result was converted as follows.

@prefix ns0: <http://iiif.io/api/presentation/2#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix exif: <http://www.w3.org/2003/12/exif/ns#> .
@prefix dc11: <http://purl.org/dc/elements/1.1/> .
@prefix ns1: <http://rdfs.org/sioc/services#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://dl.ndl.go.jp/api/iiif/3437686/manifest.json>
  a <http://iiif.io/api/presentation/2#Manifest> ;
  ns0:attributionLabel "国立国会図書館 National Diet Library, JAPAN"^^xsd:string ;
  ns0:hasRanges (
   <https://dl.ndl.go.jp/api/iiif/3437686/range/1>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/2>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/3>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/4>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/5>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/6>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/7>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/8>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/9>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/10>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/11>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/12>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/13>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/14>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/15>
   <https://dl.ndl.go.jp/api/iiif/3437686/range/16>
 ) ;
  ns0:hasSequences ( _:genid18 ) ;
  ns0:metadataLabels (
   _:genid20
   _:genid22
   _:genid24
   _:genid26
   _:genid28
   _:genid30
   _:genid32
   _:genid34
   _:genid36
   _:genid38
   _:genid40
 ) ;
  dc:rights <https://dl.ndl.go.jp/ja/iiif_license.html> ;
  rdfs:label "校異源氏物語. 巻一"^^xsd:string ;
  rdfs:seeAlso <https://dl.ndl.go.jp/api/oaipmh?verb=GetRecord&metadataPrefix=dcndl_porta&identifier=oai:dl.ndl.go.jp:info:ndljp/pid/3437686> ;
  foaf:logo <https://dl.ndl.go.jp/img/logo/ndldc/iiif-logo.png> .

<https://dl.ndl.go.jp/api/iiif/3437686/range/1>
  a ns0:Range ;
  ns0:hasCanvases ( <https://dl.ndl.go.jp/api/iiif/3437686/canvas/3> ) ;
  rdfs:label "校異源氏物語 卷一"^^xsd:string .

<https://dl.ndl.go.jp/api/iiif/3437686/canvas/3>
  a ns0:Canvas ;
  ns0:hasImageAnnotations ( _:genid43 ) ;
  rdfs:label "3"^^xsd:string ;
  exif:height 4706 ;
  exif:width 6890 .

<https://dl.ndl.go.jp/api/iiif/3437686/range/2>
  a ns0:Range ;
  ns0:hasCanvases ( <https://dl.ndl.go.jp/api/iiif/3437686/canvas/19> ) ;
  rdfs:label "目次"^^xsd:string .

<https://dl.ndl.go.jp/api/iiif/3437686/canvas/19>
  a ns0:Canvas ;
  ns0:hasImageAnnotations ( _:genid46 ) ;
  rdfs:label "19"^^xsd:string ;
  exif:height 4706 ;
  exif:width 6890 .
...

Let’s also convert to RDF/XML.

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ns0="http://iiif.io/api/presentation/2#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:dc11="http://purl.org/dc/elements/1.1/"
         xmlns:dc="http://purl.org/dc/terms/"
         xmlns:oa="http://www.w3.org/ns/oa#"
         xmlns:ns1="http://rdfs.org/sioc/services#"
         xmlns:doap="http://usefulinc.com/ns/doap#"
         xmlns:exif="http://www.w3.org/2003/12/exif/ns#">

  <rdf:Description rdf:about="https://dl.ndl.go.jp/api/iiif/3437686/manifest.json">
    <rdf:type rdf:resource="http://iiif.io/api/presentation/2#Manifest"/>
    <ns0:attributionLabel rdf:datatype="http://www.w3.org/2001/XMLSchema#string">国立国会図書館 National Diet Library, JAPAN</ns0:attributionLabel>
    <ns0:hasRanges>
      <rdf:Description>
        <rdf:first>
          <ns0:Range rdf:about="https://dl.ndl.go.jp/api/iiif/3437686/range/1">
            <ns0:hasCanvases>
              <rdf:Description>
                <rdf:first rdf:resource="https://dl.ndl.go.jp/api/iiif/3437686/canvas/3"/>
                <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
              </rdf:Description>
            </ns0:hasCanvases>

            <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">校異源氏物語 卷一</rdfs:label>
          </ns0:Range>
        </rdf:first>
...

Since JSON-LD is one of the output formats for RDF data, we can see that conversion to other formats can be performed mechanically.

@context in IIIF Manifests

JSON-LD files typically have an @context property. In the case of the IIIF manifest file being examined, it is described as follows.

{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@type": "sc:Manifest",
"@id": "https://dl.ndl.go.jp/api/iiif/3437686/manifest.json",
"label": "校異源氏物語. 巻一",
"metadata": [],
"license": "https://dl.ndl.go.jp/ja/iiif_license.html",
...
}

Let’s examine the contents of the URL specified in the @context property.

http://iiif.io/api/presentation/2/context.json

The following JSON is displayed, where for example, the license property has @type as @id and @id as dcterms:rights.

{
    "@context": [
        {
            "sc": "http://iiif.io/api/presentation/2#",
            ...
            "dcterms": "http://purl.org/dc/terms/",
            ...
            "as": "http://www.w3.org/ns/activitystreams#",
            "license": {
                "@type": "@id",
                "@id": "dcterms:rights"
            },
...
}

This means that the description "license": "https://dl.ndl.go.jp/ja/iiif_license.html" in the IIIF manifest file indicates that the property is dcterms:rights, and the value https://dl.ndl.go.jp/ja/iiif_license.html should be treated as a resource.

Looking at the earlier Turtle output, we can confirm that it was converted accordingly.

@prefix dc: <http://purl.org/dc/terms/> .
...

<https://dl.ndl.go.jp/api/iiif/3437686/manifest.json>
  a <http://iiif.io/api/presentation/2#Manifest> ;
  ns0:attributionLabel "国立国会図書館 National Diet Library, JAPAN"^^xsd:string ;
  ...
  dc:rights <https://dl.ndl.go.jp/ja/iiif_license.html> ;

Note that the prefix dc in the output refers to http://purl.org/dc/terms/, which matches the definition in the IIIF manifest’s @context. This confirms that the conversion to Turtle format was performed correctly.

Summary

We hope this serves as a useful reference for understanding the relationship between RDF and file formats such as JSON-LD and Turtle, as well as their relationship with IIIF manifest files described in JSON-LD.