mff-uk / dataspecer

https://dataspecer.com
MIT License
22 stars 7 forks source link

Text datatype not a valid JSON-LD language map #85

Open jakubklimek opened 2 years ago

jakubklimek commented 2 years ago

Text should be translated as a JSON-LD language map according to the FOS in JSON Schema. Not string.

Actually, it should be similar to https://ofn.gov.cz/základní-datové-typy/2020-07-01/schémata/text.json for 0..1 and 1..1 and https://ofn.gov.cz/základní-datové-typy/2020-07-01/schémata/více-textů.json for 0.. and 1...

skodapetr commented 2 years ago

First we should implement a way how to propagate constants into the generators. For now we can hardcode the values, but it is not clear which one.

As the FOS link allow for

"cs": [
            "Český název",
            "Jiný český název"
        ],

however, that is not valid using given json-schema. So before any change, we should be clear what is the expected output.

jakubklimek commented 2 years ago

Here, for multiple occurrences, we have https://ofn.gov.cz/základní-datové-typy/2020-07-01/schémata/více-textů.json. The reason is that we want the result to be a valid JSON-LD language map, which is not a simple array of language maps with one item. Instead of:

{
  "@context": {
    "test": {
      "@id": "urn:test",
      "@container": "@language"
    }
  },
  "test": [
    {"cs": "abcd", "en": "xyz"},
    {"cs": "1234"}
  ]
}

we therefore need

{
  "@context": {
    "test": {
      "@id": "urn:test",
      "@container": "@language"
    }
  },
  "test": {
    "cs": ["abcd", "1234"],
    "en": "xyz"
  }
}

if there should be multiple values allowed.

skodapetr commented 2 years ago

The first example is unfortunately much better and also easier to use.

Anyway, can you please clarify what should be the output for: name: Text 1:1 and name: Text 0:*

jakubklimek commented 2 years ago

0..1 and 1..1 https://ofn.gov.cz/základní-datové-typy/2020-07-01/schémata/text.json 0.. and 1.. https://ofn.gov.cz/základní-datové-typy/2020-07-01/schémata/více-textů.json