provided_interface_implementation

datastore grammar version 103

  1. The minimal implementation
  2. Context identification path
  3. Node type mapping
  4. Command mapping expressions
  5. Property mapping expressions
    1. Texts, numbers and files
    2. Collections
    3. Groups and stategroups
  6. Navigation expressions
  7. Expressions for mapping safety

The minimal implementation


Every provided interface implementation contains at least

root = root /* context path goes here */ ( /* node type mapping */ )
'variable assignment': [ root = root ] component 'optional variable assignment'
'application root node': component 'interface context id path'
'root': component 'node type mapping'

Context identification path


This path can be used for expressing the context node for an interface (the interface root).

'interface context id path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'collection entry' {
					'collection': [ . ] reference
					'id': [ [ @, ] ] reference
				}
				'group' {
					'group': [ . ] reference
				}
				'state' {
					'state group': [ . ] reference
					'state': [ ? ] reference
				}
			)
			'variable assignment': component 'optional variable assignment'
			'tail': component 'interface context id path'
		}
	)
}

Node type mapping


'node type mapping' { [ (, ) ]
	'attributes': dictionary {
		'type': [ : ] stategroup (
			'command' { [ command ]
				'implementation': component 'command mapping'
			}
			'property' {
				'type': stategroup (
					'collection' { [ collection ]
						'type': stategroup (
							'empty' { [ = empty ] }
							'dynamic' {
								'key constraint': stategroup (
									'no' { [ = ]
										'key constructor': component 'key constructor'
									}
									'yes' { [ ->, = ]
										'referencer': group {
											'head': component 'singular imp node path'
											'collection': [ . ] reference
										}
									}
								)
								'has branch': stategroup = node-switch .'branches' (
									| nodes = 'yes' { 'first' = first }
									| none  = 'no'
								)
								'branches': [ (, ) ] dictionary {
									'has successor': stategroup = node-switch successor (
										| node = 'yes' { 'successor' = successor }
										| none = 'no'
									)
									/* 'tail' is a referencer extension for collections with key constraint */
									'tail': component 'conditional descendant imp node path'
									'expression': [ = ] component 'collection expression'
									'node': component 'node type mapping'
								}
							}
						)
					}
					'group' { [ group ]
						'expression': [ = ] component 'group expression'
						'node': component 'node type mapping'
					}
					'number' { [ number ]
						'expression': [ = ] component 'number expression'
					}
					'state group' { [ stategroup ]
						'expression': [ = ] component 'state expression'
					}
					'text' { [ text ]
						'has constraint': stategroup (
							'no' {
								'expression': [ = ] component 'text expression'
							}
							'yes' {
								'head': [ -> ] component 'singular imp node path'
								'collection': [ ., [] ] reference
								'tail': component 'conditional descendant imp node path'
								'branch': [ = from ] reference
								'expression': [ [, ] ] component 'singular node path'
							}
						)
					}
					'file' { [ file ]
						'expression': [ = ] component 'file expression'
					}
				)
			}
		)
	}
}

Command mapping expressions


'command mapping' { [ => ]
	'path': [ execute ] component 'singular node path'
	'command': [ . ] reference
	'parameter mapping': component 'parameter mapping'
}
'parameter mapping' { [ (, ) ]
	'properties': dictionary {
		'type': [ : ] stategroup (
			'group' { [ group = ]
				'group': [ @ . ] reference
				'mapping': component 'parameter mapping'
			}
			'collection' { [ collection ]
				'collection': [ = map @ . ] reference
				'mapping': component 'parameter mapping'
			}
			'number' { [ number ]
				'number': [ = @ . ] reference
			}
			'text' { [ text ]
				'type': [ = ] stategroup (
					'parameter' {
						'text': [ @ . ] reference
					}
					'variable' {
						'path': component 'context node path'
					}
				)
			}
			'file' { [ file ]
				'file': [ = @ . ] reference
			}
			'state group' { [ stategroup ]
				'type': [ = ] stategroup (
					'state' {
						'state': reference
						'mapping': component 'parameter mapping'
					}
					'state switch' { [ switch @ ]
						'state group': [ . ] reference
						'states': [ (, ) ] dictionary { [ | ]
							'target state': [ => ] reference
							'mapping': component 'parameter mapping'
						}
					}
					'branch switch' { [ switch ]
						'path': group {
							'head': component 'parametrized singular imp node path'
							'collection': [ . ] reference
							'reference': [ [ @ >, ] ] reference
						}
						'branches': [ (, ) ] dictionary { [ | ]
							'state mapping context variable': stategroup (
								'current variable' { }
								'branch context variable' { [ bind $ ] }
							)
							'state': [ => ] reference
							'mapping': component 'parameter mapping'
						}
					}
				)
			}
		)
	}
}

Property mapping expressions


Texts, numbers and files

'text expression' {
	'path': component 'singular node path'
	'text': [ . ] reference
}
'number expression' {
	'type': stategroup (
		'unary' {
			'type': stategroup (
				'absolute value' { [ abs ] }
				'sign inversion' { [ - ] }
			)
			'expression': component 'number expression'
		}
		'dynamic' { // use value exp instead
			'path': component 'singular node path'
			'number': [ . ] reference
		}
	)
}
'file expression' {
	'path': component 'singular node path'
	'file': [ . ] reference
}

Collections

'key separator' {
	'separator': [ join ] stategroup (
		'dot' { [ . ] }
		'dash' { [ - ] }
		'colon' { [ : ] }
		'greater than' { [ > ] }
		'space' { [ space ] }
	)
}
'key constructor' {
	'branch concatenation': stategroup (
		'yes' {
			'type': stategroup (
				'prepend' { [ prepend-branch ] }
				'append' { [ append-branch ] }
			)
		}
		'no' { }
	)
	'key separator': stategroup (
		'yes' {
			'key separator': component 'key separator'
		}
		'no' { }
	)
}
'collection expression' {
	'head': component 'context node path'
	'tail': component 'collection expression tail'
}
'collection expression tail' {
	'has steps': stategroup (
		'no' {
			'filter': component 'filter expression'
		}
		'yes' {
			'type': stategroup (
				'singular' {
					'step': component 'node step'
				}
				'plural' {
					'step': component 'plural descendant node step'
				}
			)
			'variable assignment': component 'optional variable assignment'
			'tail': component 'collection expression tail'
		}
	)
}
'filter expression' {
	'has rules': stategroup = node-switch .'rules' (
		| nodes = 'yes' { 'first' = first }
		| none  = 'no'
	)
	'rules': dictionary { [ where ]
		'has successor': stategroup = node-switch successor (
			| node = 'yes' { 'successor' = successor }
			| none = 'no'
		)
		'node path': [ -> ] component 'conditional node path'
		'type': stategroup (
			'existence' { }
			'equality' {
				'expected node path': [ is (, ) ] component 'conditional node path'
			}
		)
	}
}

Groups and stategroups

'group expression' {
	'type': stategroup (
		'none' { }
		'bound' {
			'path': component 'singular node path'
			'variable assignment': component 'variable assignment'
		}
	)
}
'state expression' {
	'type': stategroup (
		'state' {
			'state': reference
			'node': component 'node type mapping'
		}
		'state switch' { [ switch ]
			'path': component 'singular node path'
			'state group': [ . ] reference
			'states': [ (, ) ] dictionary { [ | ]
				'variable assignment': component 'optional variable assignment'
				'target state': [ = ] reference
				'node': component 'node type mapping'
			}
		}
	)
}

'optional variable assignment' {
	'has assignment': stategroup (
		'no' { }
		'yes' {
			'assignment': component 'variable assignment'
		}
	)
}
'variable assignment' { [ as $ ] }
'ancestor variable path' {
	'has steps': stategroup (
		'no' { }
		'yes' { [ $^ ]
			'tail': component 'ancestor variable path'
		}
	)
}
'context node path' {
	'type': stategroup (
		'root' { [ root ] }
		'variable' {
			'head': component 'ancestor variable path'
			'type': stategroup (
				'variable' { [ $ ] }
				'rule' {
					'rule': [ .& ] reference
				}
			)
		}
	)
}
'node path tail' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'step': component 'node step'
			'tail': component 'node path tail'
		}
	)
}
'dependency step' {
	'type': stategroup (
		'reference' {
			'text': [ > ] reference
		}
		'reference rule' {
			'text': [ . ] reference
			'rule': [ & ] reference
		}
		'state rule' {
			'rule': [ .& ] reference
		}
	)
}
'node step' {
	'type': stategroup (
		'group' { [ . ]
			'group': reference
		}
		'dependency' {
			'dependency': component 'dependency step'
		}
		'state' {
			'state group': [ . ] reference
			'state': [ ? ] reference
		}
		'collection entry' {
			'collection': [ . ] reference
			'key': [ [, ] ] group {
				'key source': stategroup (
					'key reference' {
						/* The node that the entry key value should point to. */
						/* NOTE: currently, only the key value (text) is matched. */
						'node path': component 'conditional node path'
					}
					// 'context key' {
					// 	'context key': [ @ ] reference
					// }
				)
			}
		}
	)
}
'singular node path' {
	'head': component 'context node path'
	'tail': component 'node path tail'
}
'conditional node path' {
	'head': component 'context node path'
	'tail': component 'node path tail'
}
'plural descendant node step' {
	'collection': [ ., * ] reference
}

Expressions for mapping safety


'conditional descendant branch imp node path' {
	'type': stategroup (
		'static' { [ ? ] }
		'dynamic' {
			'state': [ ? ] reference
		}
	)
}
'conditional descendant imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'state' { [ . ]
					'state group': reference
					'path': component 'conditional descendant branch imp node path'
				}
				'group' { [ . ]
					'group': reference
				}
			)
			'tail': component 'conditional descendant imp node path'
		}
	)
}
'singular imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'parent' { [ ^ ] }
				'group' { [ . ]
					'group': reference
				}
				'reference' { [ > ]
					'reference': reference
				}
			)
			'tail': component 'singular imp node path'
		}
	)
}
'ancestor parameter path' {
	'has steps': stategroup (
		'no' { }
		'yes' { [ ^ ]
			'tail': component 'ancestor parameter path'
		}
	)
}
'parametrized singular imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'collection entry' {
					'collection': [ . ] reference
					'key': [ [, ] ] group {
						'path': [ @ ] component 'ancestor parameter path'
						'reference': [ > ] reference
					}
				}
				'group' {
					'group': [ . ] reference
				}
			)
			'tail': component 'parametrized singular imp node path'
		}
	)
}