Schemas
Schema of a Lemma
If we look at LemmaData as a single JSON object, it looks like this:
lemma: {
id: int
nama: str
konsep: [
{
id: int
keterangan: str
tertib: *int
golongan: {
id: str
nama: str
keterangan: str
}
cakupan: [
*{
cakupan: {
id: int
nama: str
keterangan: *str
}
} ...
]
kata_asing: [
*{
kata_asing: {
id: int
nama: str
bahasa: str
}
} ...
]
} ...
]
}
* at the beginning of the type represents optional values and [{} ...] represents a list of objects.
CakupanData
Bases: FromPeeweeDatabase
Object and JSONable representation of models.Cakupan
| keys | value type |
|---|---|
| id | int |
| nama | str |
| keterangan | str (optional) |
Source code in samudra/schemas.py
FromPeeweeDatabase
Bases: BaseModel
The base class of all the schemas which enables the inheriting objects to be able to understand and validate peewee Models
Source code in samudra/schemas.py
GolonganKataData
Bases: FromPeeweeDatabase
Object and JSONable representation of models.GolonganKata
| keys | value type |
|---|---|
| id | str |
| nama | str |
| keterangan | str |
Source code in samudra/schemas.py
KataAsingData
Bases: FromPeeweeDatabase
Object and JSONable representation of models.KataAsing
| keys | value type |
|---|---|
| id | int |
| nama | str |
| bahasa | str |
Source code in samudra/schemas.py
KonsepData
Bases: FromPeeweeDatabase
Object and JSONable representation of models.Konsep.
Important
Because of the way the models have been set up, to get a single cakupan from konsep (Self) would be like so:
cakupan twice but in fact we are first selecting a list of intermediate tables defined by models.BaseAttachmentDataTable.
We then index into it (or iterate to get all) to reveal a data from models.Cakupan table.
The same can be said to find kata_asing.
## Schema of a Lemma gives a clearer picture of the data structure.
| keys | value type |
|---|---|
| id | int |
| keterangan | str |
| tertib | int (Optional) |
| golongan | GolonganKataData |
| cakupan | List[KonsepToCakupanConnector] |
| kata_asing | List[KonsepToKataAsingConnector] |
Source code in samudra/schemas.py
KonsepToCakupanConnector
Bases: FromPeeweeDatabase
Object and JSONable representation of models.CakupanXKonsep with the exception that it is a one way connection.
Note
The connection has to be set up one way to avoid circular dependencies
| keys | value type |
|---|---|
| cakupan | CakupanData |
Source code in samudra/schemas.py
KonsepToKataAsingConnector
Bases: FromPeeweeDatabase
Object and JSONable representation of models.KataAsingXKonsep with the exception that it is a one way connection.
Note
The connection has to be set up one way to avoid circular dependencies
| keys | value type |
|---|---|
| kata_asing | KataAsingData |
Source code in samudra/schemas.py
LemmaData
Bases: FromPeeweeDatabase
Object and JSONable representation of models.Lemma
| keys | value type |
|---|---|
| id | int |
| nama | str |
| konsep | List[KonsepData] |