DivePlus / diveplus

Placeholder repo
Apache License 2.0
0 stars 0 forks source link

Metadata array #16

Open c-martinez opened 7 years ago

c-martinez commented 7 years ago
c-martinez commented 7 years ago

This issue refers to the search endpoint.

Currently, metadata is returned in this format:

"metadataarray": [
  "http://www.w3.org/2000/01/rdf-schema#label ANP Nieuwsbericht - 07-06-1950 - 83", 
  " http://www.w3.org/2000/01/rdf-schema#label ANP Nieuwsbericht - 07-06-1950 - 83", 
  " http://purl.org/dc/terms/title ANP Nieuwsbericht - 07-06-1950 - 83", 
  ...
  " http://purl.org/collections/nl/dive/inCollection http://purl.org/collections/nl/dive/KBNewsBulletinsCollection"
]

Swagger spec suggests MetaData to have three properties (id, key, value), but I would suggest to have only key - value pairs, as the ID will always be the ID of the entity, therefore the id of the entity already present in the entity object:

"metadataarray": [
    {
        "value": "ANP Nieuwsbericht - 07-06-1950 - 83", 
        "key": "http://www.w3.org/2000/01/rdf-schema#label"
    }, 
    {
        "value": "ANP Nieuwsbericht - 07-06-1950 - 83", 
        "key": "http://www.w3.org/2000/01/rdf-schema#label"
    }, 
...
    {
        "value": "http://purl.org/collections/nl/dive/KBNewsBulletinsCollection", 
        "key": "http://purl.org/collections/nl/dive/inCollection"
    }
]
whelmich commented 7 years ago

The intention was to have an id field (e.g. http://www.w3.org/2000/01/rdf-schema#label) a key field (e.g. Label). The label is used in the UI to make the metadata list more readable (fieldname label would be more clear I think :).

For the linked data urls, the key is just part of the id after the last "/". If you prefer I can easily process this in the UI (already doing so), so in that case your proposed format of only key and value will do! However this way we'll loose any data specific label one may display.

Alternatively, the metadata may be just a JSON object. That could even be nicer and more flexible? e.g.

{ 
 "key1": "value1",
 "key2": "value2", 
 "dupkey1": ["dupval1","dupval2"] 
}