Skip to content

Commit

Permalink
schemas (#7): ISO 639-3
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed May 8, 2021
1 parent e04abf8 commit f7f97df
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ systema/node_modules/
systema/package-lock.json
openapitools.json
.gqlconfig
.graphqlrc.yaml

## openapi-generator-cli
# api/BR/portais-ckan-brasil/por/html
# openapi-generator-cli
api/*/*/*/html
api/*/*/*/html2
api/*/*/*/mysql-schema
api/*/*/*/graphql-schema

# Our custom index page per project per language
# @see systema/programma/openapi-exportandum.sh
Expand Down
File renamed without changes.
Empty file.
7 changes: 7 additions & 0 deletions schema/iso/iso639-3/eng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# schema/iso/iso639-3/eng
- https://iso639-3.sil.org/code_tables/download_tables
- https://github.com/EticaAI/HXL-Data-Science-file-formats/tree/main/ontologia
- https://github.com/EticaAI/HXL-Data-Science-file-formats/blob/main/ontologia/codicem/codicem.linguam.hxl.csv

TODO:
- https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3-macrolanguages.tab
98 changes: 98 additions & 0 deletions schema/iso/iso639-3/eng/iso639-3.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This is a draft!
# Extracted from iso639-3.json + https://matheusr42.github.io/json-to-graphql-schema-online/
# Needs revision (but cleary generated names are ugly)

# TODO: use as reference https://github.com/apollographql/starwars-server/tree/main/data
# and do it manually

type {
description: String
type: [String]
}

type PatternProperties {
^_:
}

type Comment {
description: String
type: String
maxLengh: Int
}

type RefName {
description: String
type: String
maxLengh: Int
}

type Type {
description: String
type: String
length: Int
enum: [String]
}

type Scope {
description: String
type: String
length: Int
enum: [String]
}

type Part1 {
description: String
type: String
length: Int
example: String
}

type Part2T {
description: String
type: String
length: Int
example: String
}

type Part2B {
description: String
type: String
length: Int
example: String
}

type Id {
description: String
type: String
length: Int
example: String
}

type Properties {
Comment: Comment
Ref_Name: RefName
Type: Type
Scope: Scope
Part1: Part1
Part2T: Part2T
Part2B: Part2B
Id: Id
}

type AutogeneratedMainType {
$schema: String
$id: String
title: String
description: String
$comment: String
type: String
additionalProperties: Boolean
patternProperties: PatternProperties
properties: Properties
required: [String]
}

# Types with identical fields:
# Comment RefName
# Type Scope
# Part1 Part2T Part2B Id
73 changes: 73 additions & 0 deletions schema/iso/iso639-3/eng/iso639-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hapi.etica.ai/schema/iso/iso639-3/eng/iso639-3.json",
"title": "ISO 639-3 Code Set",
"description": "Codes for the representation of names of languages – Part 3: Alpha-3 code for comprehensive coverage of languages",
"$comment": "See https://iso639-3.sil.org/code_tables/download_tables \n https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab \n https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_table_definition.txt",
"type": "object",
"required": [
"Id",
"Scope",
"Type",
"Ref_Name"
],
"properties": {
"Id": {
"description": "The three-letter 639-3 identifier",
"type": "string",
"length": 3,
"example": "por"
},
"Part2B": {
"description": "Equivalent 639-2 identifier of the bibliographic applications code set, if there is one",
"type": "string",
"length": 3,
"example": "por"
},
"Part2T": {
"description": "Equivalent 639-2 identifier of the terminology applications code set, if there is one",
"type": "string",
"length": 3,
"example": "por"
},
"Part1": {
"description": "Equivalent 639-1 identifier, if there is one",
"type": "string",
"length": 2,
"example": "pt"
},
"Scope": {
"description": "I(ndividual), M(acrolanguage), S(pecial)",
"type": "string",
"length": 1,
"enum": [
"I",
"M",
"S"
]
},
"Type": {
"description": "A(ncient), C(onstructed), E(xtinct), H(istorical), L(iving), S(pecial)",
"type": "string",
"length": 1,
"enum": [
"A",
"C",
"E",
"H",
"L",
"S"
]
},
"Ref_Name": {
"description": "Reference language name",
"type": "string",
"maxLengh": 150
},
"Comment": {
"description": "Comment relating to one or more of the columns",
"type": "string",
"maxLengh": 150
}
}
}
46 changes: 46 additions & 0 deletions schema/iso/iso639-3/eng/iso639-3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--- This SQL schema was extracted excatly as is documented on
--- https://iso639-3.sil.org/code_tables/download_tables (date: 2021-05-08)
--- so was not inferred.

--- https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_table_definition.txt

CREATE TABLE [ISO_639-3] (
Id char(3) NOT NULL, -- The three-letter 639-3 identifier
Part2B char(3) NULL, -- Equivalent 639-2 identifier of the bibliographic applications
-- code set, if there is one
Part2T char(3) NULL, -- Equivalent 639-2 identifier of the terminology applications code
-- set, if there is one
Part1 char(2) NULL, -- Equivalent 639-1 identifier, if there is one
Scope char(1) NOT NULL, -- I(ndividual), M(acrolanguage), S(pecial)
Type char(1) NOT NULL, -- A(ncient), C(onstructed),
-- E(xtinct), H(istorical), L(iving), S(pecial)
Ref_Name varchar(150) NOT NULL, -- Reference language name
Comment varchar(150) NULL) -- Comment relating to one or more of the columns


--- https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_names_table_definition.txt
CREATE TABLE [ISO_639-3_Names] (
Id char(3) NOT NULL, -- The three-letter 639-3 identifier
Print_Name varchar(75) NOT NULL, -- One of the names associated with this identifier
Inverted_Name varchar(75) NOT NULL) -- The inverted form of this Print_Name form

--- https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_macrolanguages_table_definition.txt
CREATE TABLE [ISO_639-3_Macrolanguages] (
M_Id char(3) NOT NULL, -- The identifier for a macrolanguage
I_Id char(3) NOT NULL, -- The identifier for an individual language
-- that is a member of the macrolanguage
I_Status char(1) NOT NULL) -- A (active) or R (retired) indicating the
-- status of the individual code element


--- https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_retirements_table_definition.txt
CREATE TABLE [ISO_639-3_Retirements] (
Id char(3) NOT NULL, -- The three-letter 639-3 identifier
Ref_Name varchar(150) NOT NULL, -- reference name of language
Ret_Reason char(1) NOT NULL, -- code for retirement: C (change), D (duplicate),
-- N (non-existent), S (split), M (merge)
Change_To char(3) NULL, -- in the cases of C, D, and M, the identifier
-- to which all instances of this Id should be changed
Ret_Remedy varchar(300) NULL, -- The instructions for updating an instance
-- of the retired (split) identifier
Effective date NOT NULL) -- The date the retirement became effective
47 changes: 47 additions & 0 deletions schema/iso/iso639-3/eng/iso639-3_macrolanguages.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a draft!
# Extracted from iso639-3_macrolanguages + https://matheusr42.github.io/json-to-graphql-schema-online/
# Needs revision (but cleary generated names are ugly)

# TODO: use as reference https://github.com/apollographql/starwars-server/tree/main/data
# and do it manually

type IStatus {
description: String
type: String
length: Int
enum: [String]
}

type IId {
description: String
type: String
length: Int
example: String
}

type MId {
description: String
type: String
length: Int
example: String
}

type Properties {
I_Status: IStatus
I_Id: IId
M_Id: MId
}

type AutogeneratedMainType {
$schema: String
$id: String
title: String
description: String
$comment: String
type: String
properties: Properties
required: [String]
}

# Types with identical fields:
# IId MId
37 changes: 37 additions & 0 deletions schema/iso/iso639-3/eng/iso639-3_macrolanguages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hapi.etica.ai/schema/iso/iso639-3/eng/iso639-3_macrolanguages.json",
"title": "ISO 639-3 Macrolanguage Mappings",
"description": "Codes for the representation of names of languages – Part 3: Alpha-3 code for comprehensive coverage of languages",
"$comment": "See https://iso639-3.sil.org/code_tables/download_tables \n https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3-macrolanguages.tab \n https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_macrolanguages_table_definition.txt",
"type": "object",
"required": [
"M_Id",
"I_Id",
"I_Status"
],
"properties": {
"M_Id": {
"description": "The identifier for a macrolanguage",
"type": "string",
"length": 3,
"example": "ara"
},
"I_Id": {
"description": "The identifier for an individual language that is a member of the macrolanguage",
"type": "string",
"length": 3,
"example": "arb"
},
"I_Status": {
"description": "A (active) or R (retired) indicating the status of the individual code element",
"type": "string",
"length": 1,
"enum": [
"A",
"R",
"S"
]
}
}
}

0 comments on commit f7f97df

Please sign in to comment.