Skip to content

Commit

Permalink
schemas (#7): ISO 15924, JSON Schema, criada
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed May 9, 2021
1 parent 99192d9 commit b452e68
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 78 deletions.
7 changes: 7 additions & 0 deletions schema/graphql.schema.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// TODO: I'm not sure if is possible to "merge colletion of Schemas" without
// actually have to use javascript on then, something that obviously
// not portable (Emerson Rocha, 2021-05-09 12:54 UTC)

import 'schema/iso/iso639-3/eng/iso639-3.graphql'

// https://www.graphql-tools.com/docs/schema-loading/
6 changes: 6 additions & 0 deletions schema/iso/iso15924/eng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# schema/iso/iso15924/eng

- <https://www.unicode.org/iso15924/codelists.html>
- Normative plain-text version (UTF-8)
- https://www.unicode.org/iso15924/iso15924-text.html
- https://www.unicode.org/iso15924/iso15924.txt
51 changes: 51 additions & 0 deletions schema/iso/iso15924/eng/iso15924.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hapi.etica.ai/schema/iso/iso15924/eng/iso15924.json",
"title": "ISO 15924",
"description": "ISO 15924: Codes for the representation of names of scripts",
"$comment": "https://www.unicode.org/iso15924/codelists.html, https://www.unicode.org/iso15924/iso15924.txt",
"type": "object",
"properties": {
"Code": {
"description": "Code",
"type": "string",
"length": 4,
"example": "Arab"
},
"Nº": {
"description": "",
"type": "string",
"length": 3,
"example": "160"
},
"English Name": {
"description": "English Name",
"type": "string",
"example": "por",
"$comment": "TODO: investigate maximum length"
},
"Nom français": {
"description": "Nom français",
"type": "string",
"example": "arabe",
"$comment": "TODO: investigate maximum length"
},
"PVA": {
"description": "The Property Value Alias is defined as part of the Unicode Standard and is provided informatively in the tables here to show how entries in the ISO 15924 code table relate to script names defined in Unicode.",
"type": "string",
"example": "Arabic",
"$comment": "TODO: investigate maximum length"
},
"Unicode Version": {
"description": "Unicode Version",
"example": "1.1",
"type": "number"
},
"Date": {
"description": "Date",
"type": "string",
"format": "date",
"example": "2004-05-01"
}
}
}
97 changes: 67 additions & 30 deletions schema/iso/iso639-3/eng/iso639-3.graphql
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
# 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

# Status: working-draft (2021-05-09)

type Query {
ISO639_3: [XZ_ISO_639_3]
XZ_ISO_639_3: [XZ_ISO_639_3]
XZ_ISO_639_3_macrolanguage: [XZ_ISO_639_3_macrolanguage]
}

# XZ_ISO_639_3 is (...)
# # What is ISO 639-3?
#
# ISO 639-3 is a set of codes that defines three-letter identifiers for all
# known human languages. At the core of ISO 639-3 are the individual
# languages already accounted for in ISO 639-2. The large number of living
# languages in the initial inventory of ISO 639-3 beyond those already
# included in ISO 639-2 was derived primarily from Ethnologue (15th edition).
# Additional extinct, ancient, historic, and constructed languages were
# obtained from the Linguist List.
#
# See <https://iso639-3.sil.org/>
#
# # What is XZ_ISO_639_3 ?
# Is an implementation of ISO 639-3 on GraphQL done by community volunteers
# initially cooordinated by HXL-CPLP (<https://hxl.etica.ai>).
#
# This specific interface is based on the database dump of ISO_639-3 from
# https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso639-3_table_definition.txt
# on 2021-05-09.
#
# # Usage of these schemas
# The volunteers of HXL-CPLP dedicate it's work to public domain.
#
# Check with ISO 639-3 Registration Authority, SIL International,
# Additional license and terms of use.
interface XZ_ISO_639_3 {
# The three-letter 639-3 identifier
Id: Id!
Expand Down Expand Up @@ -39,27 +58,26 @@ interface XZ_ISO_639_3 {
Comment: Comment
}

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

# type ISO639_3 {
# # $schema: String
# # $id: String
# title: String
# description: String
# # $comment: String
# type: String
# properties: Properties
# required: [String]
# }
# # What is XZ_ISO_639_3 ?
# Is an implementation of ISO 639-3 on GraphQL done by community volunteers
# initially cooordinated by HXL-CPLP (<https://hxl.etica.ai>).
#
# This specific interface is based on the database dump of
# ISO_639-3_Macrolanguages from
# <https://iso639-3.sil.org/code_tables/download_tables> on 2021-05-09.
#
interface XZ_ISO_639_3_macrolanguage {
# The identifier for a macrolanguage
M_Id: M_Id!

# The identifier for an individual language that is a member of the
# macrolanguage
I_Id: I_Id!

# A (active) or R (retired) indicating the status of the individual
# code element
I_Status: I_Status!
}

type Comment {
description: String
Expand Down Expand Up @@ -115,7 +133,26 @@ type Id {
example: String
}

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

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

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



Expand Down
2 changes: 1 addition & 1 deletion schema/iso/iso639-3/eng/iso639-3.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$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",
"title": "ISO 639-3",
"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",
Expand Down
47 changes: 0 additions & 47 deletions schema/iso/iso639-3/eng/iso639-3_macrolanguages.graphql

This file was deleted.

2 changes: 2 additions & 0 deletions systema/programma/graphql-exportandum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# Error: ✗ Must provide schema definition with query type or a type named Query.

graphdoc --schema-file schema/iso/iso639-3/eng/iso639-3.graphql --output schema/iso/iso639-3/eng/graphql-doc --force
graphdoc --schema-file schema/graphql.schema.js --output schema/iso/iso639-3/eng/graphql-doc --force
graphdoc --schema-file schema/graphql.schema.mjs --output schema/iso/iso639-3/eng/graphql-doc --force


exit 0

0 comments on commit b452e68

Please sign in to comment.