w3c / csvw

Documents produced by the CSV on the Web Working Group
Other
162 stars 57 forks source link

Per-metadata, named custom datatype #837

Open gwax opened 8 years ago

gwax commented 8 years ago

Suppose we have a custom datatype that we want to use in multiple tables, repeating the custom datatype description for each use is repetitive and risks errors. The datatype could be given a name and placed outside table scope to be reused across entries. For example:

{
  "@context": "http://www.w3.org/ns/csvw",
  "datatypes": [
    {
      "name": "uuid",
      "base": "string",
      "format": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
    }
  ],
  "tables": [
    {
      "url": "table.csv",
      "tableSchema": {
        "columns": [
          {"titles": "table_uuid", "datatype": "uuid"}
        ]
      }
    }
  ]
}
gkellogg commented 5 years ago

It's a great idea which a future WG might take up if the standard gets re-visited.

djwf commented 5 years ago

Got it, thanks. I posted that before I realized that the WG had finished its work, and deleted it after I realized that but before you responded. For those visiting, my question was whether this had been implemented or not.

Thanks!