{"id":13752414,"url":"https://github.com/csvspecs/csv-meta","last_synced_at":"2025-05-09T19:32:05.789Z","repository":{"id":75995134,"uuid":"154871167","full_name":"csvspecs/csv-meta","owner":"csvspecs","description":"CSV (Inline) Meta Data Formats - CSV in CSV, Attribute-Relation \"Classic\", Attribute-Relation \"Inline\", Front Matter in YAML and More","archived":false,"fork":false,"pushed_at":"2018-10-26T19:46:53.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T09:03:55.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csvspecs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-26T17:36:06.000Z","updated_at":"2021-12-17T07:47:38.000Z","dependencies_parsed_at":"2024-01-17T15:02:46.696Z","dependency_job_id":"eca01868-550b-4cde-9cbd-5a56366f6785","html_url":"https://github.com/csvspecs/csv-meta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-meta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-meta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-meta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-meta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csvspecs","download_url":"https://codeload.github.com/csvspecs/csv-meta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224880776,"owners_count":17385367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T09:01:05.443Z","updated_at":"2024-11-16T05:30:30.978Z","avatar_url":"https://github.com/csvspecs.png","language":null,"readme":"# CSV (Inline) Meta Data Formats\n\n\n[CSV in CSV](#csv-in-csv) •\n[Attribute-Relation \"Classic\"](#attribute-relation-classic) •\n[Attribute-Relation \"Inline\"](#attribute-relation-inline) •\n[Front Matter in YAML](#front-matter-in-yaml)\n\n\n## CSV in CSV\n\nUse CSV meta data in CSV :-). How? \n\nThe CSV in CSV Meta Data Block Rule No 1.:  If the first record / line\nstarts with `Col,Name` or `Name,Type` than it's a meta data block\nuntil the next blank line.\n\n\nExample:\n\n```\n##########################\n# try with some comments\n#   and blank lines even before header\n\nName,    Type\nBrewery\nCity\nName\nAbv,     Float\n\n\nAndechser Klosterbrauerei,Andechs,Doppelbock Dunkel,7%\nAugustiner Bräu München,München,Edelstoff,5.6%\n\nBayerische Staatsbrauerei Weihenstephan,  Freising,  Hefe Weissbier,   5.4%\nBrauerei Spezial,                         Bamberg,   Rauchbier Märzen, 5.1%\nHacker-Pschorr Bräu,                      München,   Münchner Dunkel,  5.0%\nStaatliches Hofbräuhaus München,          München,   Hofbräu Oktoberfestbier, 6.3%\n```\n\nNote: If you don't specify a data type (the default is String).\nYou can add optional fields as you like to the meta data block.\n\n\n\n\n## Attribute-Relation \"Classic\"\n\nUse the ARFF (attribute-relation file format)-like alternative style\nwith `%` for comments and `@`-directives\nfor \"meta data\" in the header (before any records):\n\n```\n%%%%%%%%%%%%%%%%%%\n% try with some comments\n%   and blank lines even before @-directives in header\n\n@RELATION Beer\n\n@ATTRIBUTE Brewery\n@ATTRIBUTE City\n@ATTRIBUTE Name\n@ATTRIBUTE Abv  Float\n\n@DATA\nAndechser Klosterbrauerei,Andechs,Doppelbock Dunkel,7%\nAugustiner Bräu München,München,Edelstoff,5.6%\n\nBayerische Staatsbrauerei Weihenstephan,  Freising,  Hefe Weissbier,   5.4%\nBrauerei Spezial,                         Bamberg,   Rauchbier Märzen, 5.1%\nHacker-Pschorr Bräu,                      München,   Münchner Dunkel,  5.0%\nStaatliches Hofbräuhaus München,          München,   Hofbräu Oktoberfestbier, 6.3%\n```\n\n\n## Attribute-Relation \"Inline\"\n\nUse the ARFF (attribute-relation file format)-like alternative style with  `@`-directives\ninside comments (for easier backwards compatibility with old readers)\nfor \"meta data\" in the header (before any records):\n\n```\n##########################\n# try with some comments\n#   and blank lines even before @-directives in header\n#\n# @RELATION Beer\n#\n# @ATTRIBUTE Brewery\n# @ATTRIBUTE City\n# @ATTRIBUTE Name\n# @ATTRIBUTE Abv  Float\n\nAndechser Klosterbrauerei,Andechs,Doppelbock Dunkel,7%\nAugustiner Bräu München,München,Edelstoff,5.6%\n\nBayerische Staatsbrauerei Weihenstephan,  Freising,  Hefe Weissbier,   5.4%\nBrauerei Spezial,                         Bamberg,   Rauchbier Märzen, 5.1%\nHacker-Pschorr Bräu,                      München,   Münchner Dunkel,  5.0%\nStaatliches Hofbräuhaus München,          München,   Hofbräu Oktoberfestbier, 6.3%\n```\n\n## Front Matter in YAML\n\nUse a front matter meta data block in YAML.\nThe front matter must start with `---` before the first record (in the header)\nand ends with `---`.\n\n```\n##########################\n# try with some comments\n#   and blank lines even before front matter block\n\n---\nfields:\n- name: Brewery\n- name: City\n- name: Name\n- name: Abv\n  type: Float\n---\n\nAndechser Klosterbrauerei,Andechs,Doppelbock Dunkel,7%\nAugustiner Bräu München,München,Edelstoff,5.6%\n\nBayerische Staatsbrauerei Weihenstephan,  Freising,  Hefe Weissbier,   5.4%\nBrauerei Spezial,                         Bamberg,   Rauchbier Märzen, 5.1%\nHacker-Pschorr Bräu,                      München,   Münchner Dunkel,  5.0%\nStaatliches Hofbräuhaus München,          München,   Hofbräu Oktoberfestbier, 6.3%\n```\n\n\n\n## Examples\n\n\n### `tree-ops.csv` in Metadata Vocabulary for Tabular Data by W3C\n\nLet's use the Tree Operations example from\n[Metadata Vocabulary for Tabular Data](https://www.w3.org/TR/tabular-metadata/)\nby the World Wide Web Consortium (W3C)\nand compare CSV meta data formats.\nThe tabular data in `tree-ops.csv`:\n\n```\nGID,On Street,Species,Trim Cycle,Inventory Date\n1,ADDISON AV,Celtis australis,Large Tree Routine Prune,10/18/2010\n2,EMERSON ST,Liquidambar styraciflua,Large Tree Routine Prune,6/2/2010\n```\n\nAnd the meta data recommended (proposed) by the W3C in its own (external) file:\n\n`tree-ops.csv-metadata.json`:\n\n``` json\n{\n  \"@context\": [\"http://www.w3.org/ns/csvw\", {\"@language\": \"en\"}],\n  \"url\": \"tree-ops.csv\",\n  \"dc:title\": \"Tree Operations\",\n  \"dcat:keyword\": [\"tree\", \"street\", \"maintenance\"],\n  \"dc:publisher\": {\n    \"schema:name\": \"Example Municipality\",\n    \"schema:url\": {\"@id\": \"http://example.org\"}\n  },\n  \"dc:license\": {\"@id\": \"http://opendefinition.org/licenses/cc-by/\"},\n  \"dc:modified\": {\"@value\": \"2010-12-31\", \"@type\": \"xsd:date\"},\n  \"tableSchema\": {\n    \"columns\": [{\n      \"name\": \"GID\",\n      \"titles\": [\"GID\", \"Generic Identifier\"],\n      \"dc:description\": \"An identifier for the operation on a tree.\",\n      \"datatype\": \"string\",\n      \"required\": true\n    }, {\n      \"name\": \"on_street\",\n      \"titles\": \"On Street\",\n      \"dc:description\": \"The street that the tree is on.\",\n      \"datatype\": \"string\"\n    }, {\n      \"name\": \"species\",\n      \"titles\": \"Species\",\n      \"dc:description\": \"The species of the tree.\",\n      \"datatype\": \"string\"\n    }, {\n      \"name\": \"trim_cycle\",\n      \"titles\": \"Trim Cycle\",\n      \"dc:description\": \"The operation performed on the tree.\",\n      \"datatype\": \"string\"\n    }, {\n      \"name\": \"inventory_date\",\n      \"titles\": \"Inventory Date\",\n      \"dc:description\": \"The date of the operation that was performed.\",\n      \"datatype\": {\"base\": \"date\", \"format\": \"M/d/yyyy\"}\n    }],\n    \"primaryKey\": \"GID\",\n    \"aboutUrl\": \"#gid-{GID}\"\n  }\n}\n```\n\n\nThat's obviously not for humans to read but for machines to process.\n\n\nLet's start with a CSV in CSV (inline) meta data version:\n\n```\n######################################\n# title:     Tree Operations\n# keyword:   tree, street, maintenance\n# publisher: Example Municipality\n# license:   CC BY\n# update:    2010-12-31\n\nName,            Type,    Required,  Primary, Format,   Titles,                   Description\nGID,             string,  true,      true,            , GID | Generic Identifier, An identifier for the operation on a tree.  \non_street,       string,      ,          ,            , On Street,                The street that the tree is on.       \nspecies,         string,      ,          ,            , Species,                  The species of the tree.\ntrim_cycle,      string,      ,          ,            , Trim Cycle,               The operation performed on the tree. \ninventory_date,  date,        ,          ,    M/d/yyyy, Inventory Date,           The date of the operation that was performed.\n\n\nGID, On Street,  Species,                 Trim Cycle,               Inventory Date\n1,   ADDISON AV, Celtis australis,        Large Tree Routine Prune, 10/18/2010\n2,   EMERSON ST, Liquidambar styraciflua, Large Tree Routine Prune, 6/2/2010\n```\n\n\nOr lets use two meta data blocks (for easier reading):\n\n```\n######################################\n# title:     Tree Operations\n# keyword:   tree, street, maintenance\n# publisher: Example Municipality\n# license:   CC BY\n# update:    2010-12-31\n\nName,            Type,    Required,  Primary, Format   \nGID,             string,  true,      true              \non_street,       string                    \nspecies,         string            \ntrim_cycle,      string\ninventory_date,  date,    ,          , M/d/yyyy\n\nName,            Titles,                   Description\nGID,             GID | Generic Identifier, An identifier for the operation on a tree. \non_street,       On Street,                The street that the tree is on.\nspecies,         Species,                  The species of the tree.\ntrim_cycle,      Trim Cycle,               The operation performed on the tree. \ninventory_date,  Inventory Date,           The date of the operation that was performed.\n\nGID, On Street,  Species,                 Trim Cycle,               Inventory Date\n1,   ADDISON AV, Celtis australis,        Large Tree Routine Prune, 10/18/2010\n2,   EMERSON ST, Liquidambar styraciflua, Large Tree Routine Prune, 6/2/2010\n```\n\nVoila! It's starting to get readable.\n\n\nOr how about a version with front matter in YAML:\n\n```\n---\n######################################\n# title:     Tree Operations\n# keyword:   tree, street, maintenance\n# publisher: Example Municipality\n# license:   CC BY\n# update:    2010-12-31\n\nfields:\n- name:     GID\n  type:     string\n  required: true     \n  primary:  true            \n  titles:   [GID, Generic Identifier]\n  description: An identifier for the operation on a tree.  \n\n- name:     on_street\n  type:     string\n  titles:   [On Street]\n  description: The street that the tree is on.       \n\n- name:     species\n  type:     string\n  titles:   [Species]                  \n  description: The species of the tree.\n\n- name:      trim_cycle\n  type:      string      \n  titles:    [Trim Cycle]\n  description: The operation performed on the tree. \n\n- name:      inventory_date\n  type:      date\n  format:    M/d/yyyy\n  titles:    [Inventory Date]\n  description:  The date of the operation that was performed.\n---\n\nGID, On Street,  Species,                 Trim Cycle,               Inventory Date\n1,   ADDISON AV, Celtis australis,        Large Tree Routine Prune, 10/18/2010\n2,   EMERSON ST, Liquidambar styraciflua, Large Tree Routine Prune, 6/2/2010\n```\n\n\n\n\n\n\n\n\n\n\n## License\n\nThe CSV Meta formats are dedicated to the public domain.\n\n\n\n## Request for Comments (RFC)\n\nPlease post your comments to the [wwwmake forum](http://groups.google.com/group/wwwmake).\nThanks!\n\n","funding_links":[],"categories":["CSV Family"],"sub_categories":["Related"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsvspecs%2Fcsv-meta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsvspecs%2Fcsv-meta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsvspecs%2Fcsv-meta/lists"}