# Overview To ensure the database is organized, standardized, and easy to understand, we have designed a **schema** to define how many types of nodes exist, what properties each type has, and how these nodes can be connected to create relationships. We designed the Politigraph schema based on [Popolo - International open government data specifications](https://www.popoloproject.com/) with adaptations for the context of Thailand. The **schema** consists of: 1. **Object**: Types of actual data nodes, specifying the properties present in each node type. 2. **Interface**: Basic requirements for objects to extend. 3. **Union**: Sets of possible types. 4. **Relationship**: Possible relationships between different node types. Feel free to select entities to read the descriptions. _The interactive schema diagram is not available in plain text. The complete GraphQL schema is at https://politigraph.wevis.info/schema.graphql_ ## Node For example, we have these people with first-name starting with _"Nat"_ represented with nodes type of **`Person`**. These nodes will only have property and relationship that satisfy **`Person`** **schema** (they don't need to have optional properties, so querying those will have value of _null_) ```graphql query People($where: PersonWhere) { people(where: $where) { id prefix name_en image birth_date educations previous_occupations } } ``` Variables: ```json { "where": { "firstname_en": { "startsWith": "Nat" } } } ``` [Run this query in the playground](https://politigraph.wevis.info/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAAoIQAOANggBQAkA7gBb4Lqn4DOESA6qzwIAlEWAAdJESIVy1OizYcmgkWMnTpASzAbNFIQDMtADz3SkAQ0QB9ZOaJa4lgOYIHAIy14UzG2EsUdylNBDAYKECtXi4HAwQAN2iYLhtoWAoomL0AX0kckAAaEATLPC1LDxouDBAJEPEQRSFGjnrNIkbjPC4UK1t7DHUQjsbespQuPi1fVs6QADlAxoc8kLWCnKA) ## Relationship Relationship in **schema** will have a name with arrow direction for human interpretation such as `Post--IN--> Organization` meaning **`Post`** is "in" an **`Organization`** But in the query process, either nodes at the both end can be queried from each other. For example, **`Post`** has property `organizations` and **`Organization`** has property `posts` that refer to each other node of this relationship. ```graphql query Organizations($where: OrganizationWhere, $postsWhere2: PostWhere) { organizations(where: $where) { id name_en posts(where: $postsWhere2) { id label role organizations { id name } } } } ``` Variables: ```json { "where": { "id": { "eq": "คณะรัฐมนตรี-64" } }, "postsWhere2": { "role": { "eq": "นายกรัฐมนตรี" } } } ``` [Run this query in the playground](https://politigraph.wevis.info/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAPJ4DmAhkgJYBelKNESAzgBQAkA7gBb4J0pCtXqNmSAOr88CADRFOABwisUraQIBMQgAqqUm2QEoiwADpIiRCCNoMmLDnwFCeMhKYtXrRGmEtfIiRKRAB9ZEDfFTVnDzcY9SMELS8ooP903wAbSgAjBGys6zwIbIRimzsxRzYzSutMnyDrEMRKgF8srp8ejpA5EAA3SjwafPLWDBBva3MQF1l5oVnfecyMeua1kAQsZaJ5wBA4QGQ4QAY4QGI4QEY4QAQ4QEI4QEw4QFQ4C8BWOABaADYAFnnuqI6cii80SGg8WgOqzmIFK5UhlXmewO8wegCY4QBEcIBAOGu92ebz+2x61j6IA6QA)