KorAP / Krill

:mag: A Corpus Data Retrieval Index using Lucene for Look-Ups
BSD 2-Clause "Simplified" License
16 stars 3 forks source link

Support assets / attachements to meta data fields #49

Closed Akron closed 5 years ago

Akron commented 5 years ago

To link texts to separate resources (external or internal), it is required to store arbitrary data in meta data fields including arbitrary descriptions in a conventional way, to give clients retrieving the data some hints about how to handle the data. To make it easy and to introduce some advanced formalisms of KoralQuery, I would argue the field should be indexed and returned as a koral:field with type:attachement, as exemplified in Krawfish. The key can be an arbitrary name field, like "Wikipedia-Link", the value needs to follow the data uri scheme.

{
  "@type":"koral:field",
  "key":"Wikipedia",
  "value":"data:application/x.korap-link,https://de.wikipedia.org/wiki/Beispiel",
  "type":"type:attachement"
},
{
  "@type":"koral:field",
  "key":"Reference",
  "value":"data:text/plain,This is a reference string",
  "type":"type:attachement"
}

This makes it possible to store arbitrary data like text or images (base64 encoded) as well as references in the value. It may seem unintuitive to use the data uri scheme for hyperlinks, as they already are scheme prefixed. The reason we use data for all attachements and the new application/x.korap-link media type is that data uris support parameters, that can be used to describe the resource and give the KoralQuery consumer a hint how to handle the resource. E.g. for links that will be embedded in Kalamar, the parameter can give a link title to view instead of the URI. Or if Kalamar has a plugin to embed images, a parameter can give hints about title tags of the image. data:image/png;title=Palimpsest;base64,...

Akron commented 5 years ago

Added in https://github.com/KorAP/Krill/commit/8bb3bc3e346b613b78b995f06f0ad9f2ddc5f7e7 .