Skip to content

dublinCore metadata object: use @nest and fix language map #280

@lueck

Description

@lueck

There are some problems regarding the dublinCore metadata object.

Here's snippet from the first example for the navigation endpoint:

  {
    "identifier": "C1",
    "@type": "CitableUnit",
    "level": 1,
    "parent": null,
    "citeType": "Chapter",
    "dublinCore": {
      "title": [{
        "lang": "en",
        "value": "Chapter 1: Jonathan Harker's Journal"
      }]
    }
  }

And this is the context as far as related to the dublinCore metadata object.

{
  "@context": {
    "dts": "https://w3id.org/dts/api#",
    "dct": "http://purl.org/dc/terms/",

    /* ... */
	  
    "dublinCore": {
      "@id": "dts:dublinCore",
      "@context": {
        "@vocab": "http://purl.org/dc/terms/"
      }
    },

	/* ... */
	  
    "title": "dits:title",
    
	/* ... */
	  
  }
}

Here is, what we get when we expand the JSON-LD on the basis of the current context (again only the relevant part):

            {
                "https://w3id.org/dts/api#identifier": [
                    {
                        "@value": "C1"
                    }
                ],
                "@type": [
                    "https://w3id.org/dts/api#CitableUnit"
                ],
                "https://w3id.org/dts/api#level": [
                    {
                        "@value": 1
                    }
                ],
                "https://w3id.org/dts/api#citeType": [
                    {
                        "@value": "Chapter"
                    }
                ],
                "https://w3id.org/dts/api#dublinCore": [
                    {
                        "dits:title": [
                            {
                                "http://purl.org/dc/terms/lang": [
                                    {
                                        "@value": "en"
                                    }
                                ],
                                "http://purl.org/dc/terms/value": [
                                    {
                                        "@value": "Chapter 1: Jonathan Harker's Journal"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }

There several problems here, two of them are obvious, two are related to JSON-LD patterns and to the ontology level:

  1. There's a typo in dits:title. It obviously should be dct:title or http://purl.org/dc/terms/title fully extended.
  2. language and value should not be from the dcterm ontology, which does not provide them at all, but simply RDF: rdf:value, rdf:language. In JSON-LD it would be:
    "http://purl.org/dc/terms/title": [
        {
     	   "@language": "en",
     	   "@value": "Chapter 1: Jonathan Harker's Journal"
        }
    ]
  3. For internationalization, the JSON-LD 1.1 specs provide some patterns. The most suitable IMO would be the so-called language map. See example 71 of the specs. However, using it, would require changing the JSON API. To continue with the JSON structure as it is the examples, the title field would have to be framed like this:
    "title": { "@id": "dct:title", "@container": "@set", "@context": { "value": "@value", "lang": "@language" } },
  4. I completely agree with the idea of grouping dc-metadata into a metadata object and put it into a dublinCore property. This makes a clear JSON API. However, when we look at the gragh, which is represented in the JSON-LD objects, the dublincore metadata are asserted not to the citeable unit but to a bnode. Let's look at the N-Triples:
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/dts/api#CitableUnit> .
_:b0 <https://w3id.org/dts/api#citeType> "Chapter" .
_:b0 <https://w3id.org/dts/api#dublinCore> _:b1 .
_:b0 <https://w3id.org/dts/api#identifier> "C1" .
_:b0 <https://w3id.org/dts/api#level> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b1 <dits:title> _:b2 .

_:b2 <http://purl.org/dc/terms/lang> "en" .
_:b2 <http://purl.org/dc/terms/value> "Chapter 1: Jonathan Harker's Journal" .

I guess, that's not really what we want. At least, I would expect that the title is attributed to the citable unit object, which is a resource in the dc sense.

The @nest keyword in JSON-LD 1.1 allows us to keep our clearly structured JSON API and provide sensible linked open data in the meantime:

{
  "@context": {
    "dts": "https://w3id.org/dts/api#",
    "dct": "http://purl.org/dc/terms/",

    /* ... */
	  
    "dublinCore": "@nest",

	/* ... */
	  
    "title": { "@id": "dct:title", "@container": "@set", "@context": { "value": "@value", "lang": "@language" } },
    
	/* ... */
	  
  }
}

This is the graph, we get with the fixed context (only relevant parts):

_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/dts/api#CitableUnit> .
_:b0 <http://purl.org/dc/terms/title> "Chapter 1: Jonathan Harker's Journal"@en .
_:b0 <https://w3id.org/dts/api#citeType> "Chapter" .
_:b0 <https://w3id.org/dts/api#identifier> "C1" .
_:b0 <https://w3id.org/dts/api#level> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions