-
-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Is it possible to describe a node in the schema whose children change based on a value?
e.g. I have a single node named event which changes contents based on the first value which is a specific enumeration:
event Event1 "<date>" {
child_TypeA_Event1 "data-id"
child_TypeB_Event1 "data-id"
child_TypeB_Event1 "data-id"
child_TypeC_Event1 "data-id"
shared_node_name1 "some contents, such as notes about the event" // optional
}
event Event2 "<date>" {
child_TypeA_Event2 "<id>"
}
event Event3 "<date>" {
child_TypeA_Event3And4 "<id>"
child_TypeA_Event3And4 "<id>"
shared_node_name2 "some location the event took place at" // optional
}
event Event4 "<date>" {
child_TypeA_Event3And4 "<id>"
child_TypeA_Event3And4 "<id>"
shared_node_name2 "some location the event took place at" // optional
shared_node_name1 "some contents, such as notes about the event" // optional
}I know how to describe each child group individually, and saw the definitions section of the schema, but haven't figured out how to best use definitions to share value schemas between nodes and differentiate the children of a node based on the data of a value enum.
To be very specific about my use-case, I'm tinkering with a new genealogical data format (outlined below). While I could have separate node types, I'd prefer to have all events under the same node name and use a secondary identifier to identify the enum value.
Data Format Example
node event description="An event involving one or more persons" {
value description="The event type" {
type string
min 1
max 1
enum birth death marriage divorce
}
value description="The date of the event" {
type string
format date
min 1
max 1
}
// birth
/*
event birth (date)"<DATE>" {
// the persons birthed, can be multiple
offspring <PERSON ID>
// a dna donor, biological parent or sperm/egg donor
donor <PERSON ID>
donor <PERSON ID>
carrier <PERSON ID> // the person who carried the pregnancy
location "<LOCATION>" // optional, the location the event took place at
notes "<TEXT>" // optional, some notes about the event
}
*/
children {
node offspring description="A person who was born" {
min 1
value description="The id of a person" {
type string
min 1
max 1
}
}
node donor description="A person who donated genetic material to the pregnancy (either organically or by science)" {
min 2
max 2
value description="The id of the person" {
type string
min 1
max 1
}
}
node carrier description="The person who carried the pregnancy (either as a biological parent or as a surrogate)" {
min 1
max 1
value description="The id of a person" {
type string
min 1
max 1
}
}
node location description="The location the event took place at" {
max 1
value description="The location description" {
type string
min 1
max 1
}
}
node notes description="Any notes about the event" {
max 1
value description="The note text" {
type string
min 1
max 1
}
}
}
// death
/*
event death (date)"<DATE>" {
person "<PERSON ID>"
location "<LOCATION>" // optional, the location the event took place at
notes "<TEXT>" // optional, some notes about the event
}
*/
children {
node person description="The person who died" {
min 1
max 1
value description="The id of a person" {
type string
min 1
max 1
}
}
node location description="The location the event took place at" {
max 1
value description="The location description" {
type string
min 1
max 1
}
}
node notes description="Any notes about the event" {
max 1
value description="The note text" {
type string
min 1
max 1
}
}
}
// marriage
/*
event marriage (date)"<DATE>" {
person "<PERSON ID>"
person "<PERSON ID>"
location "<LOCATION>" // optional, the location the event took place at
notes "<TEXT>" // optional, some notes about the event
}
*/
children {
node person description="The persons who got married" {
min 2
max 2
value description="The id of a person" {
type string
min 1
max 1
}
}
node location description="The location the event took place at" {
max 1
value description="The location description" {
type string
min 1
max 1
}
}
node notes description="Any notes about the event" {
max 1
value description="The note text" {
type string
min 1
max 1
}
}
}
// divorce
/*
event divorce (date)"<DATE>" {
person "<PERSON ID>"
person "<PERSON ID>"
location "<LOCATION>" // optional, the location the event took place at
notes "<TEXT>" // optional, some notes about the event
}
*/
children {
node person description="The persons who were married" {
min 2
max 2
value description="The id of a person" {
type string
min 1
max 1
}
}
node location description="The location the event took place at" {
max 1
value description="The location description" {
type string
min 1
max 1
}
}
node notes description="Any notes about the event" {
max 1
value description="The note text" {
type string
min 1
max 1
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels