query

auto-webclient grammar version xindi.1

'query type': stategroup (
	'collection' {
		'context node path': [ on ] component 'id path'
		'collection path': [ from ] component 'collection selector'
		'properties': [ select ] dictionary {
			'has next': stategroup = node-switch successor (
				| node = 'yes' { 'next' = successor }
				| none = 'no'
			)
			'type': [ : ] stategroup (
				'collection' { [ collection ]
					'value': component 'collection expression'
					'format': component 'collection format'
				}
				'number' { [ number ]
					'value': component 'number expression'
					'format': component 'number format'
				}
				'text' { [ text ]
					'value': component 'text expression'
					'format': component 'text format'
				}
				'stategroup' { [ state ]
					'value': component 'stategroup expression'
					'format': component 'state format'
				}
			)
		}
		'has first': stategroup = node-switch .'properties' (
			| nodes = 'yes' { 'first' = first }
			| none  = 'no'
		)
		'filters': [ where ] group {
			'todo filter': stategroup (
				'yes' { [ has-todo ]
					'path': component 'node path'
				}
				'no' { }
			)
			'filters': set {
				'path': [ - ] component 'node path'
				'type': stategroup (
					'property' {
						'property': [ . ] reference
						'type': stategroup (
							'number' {
								'expression': component 'number filter expression'
							}
							'state group' { [ in ]
								'states to include': [ (, ) ] dictionary { [ ? ] }
							}
						)
					}
					'node' {
						'type': stategroup (
							'existence' {
								'operator': stategroup (
									'exists' { [ exists ] }
									'not exists' { [ not exists ] }
								)
							}
							'containment' {
								'operator': stategroup (
									'in' { [ in ] }
									'not in' { [ not in ] }
								)
								'references': [ (, ) ] component 'reference filter list'
							}
						)
					}
				)
			}
		}
		'record limit': [ limit ] component 'number value'
	}
	'graph' {
		'context selection': [ on ] component 'id path'
		'entry points': group {
			'collection selection': [ from ] component 'collection selector'
			'attribute': [ > ] reference
			'graph': [ flatten ] reference
		}
		'query': group {
			'collection selection': [ from ] component 'collection selector'
			'properties': [ select ] dictionary {
				'has next': stategroup = node-switch successor (
					| node = 'yes' { 'next' = successor }
					| none = 'no'
				)
				'path': [ = ] component 'node path'
				'type': stategroup (
					'number' { [ # ]
						'number': reference
						'format': component 'number format'
					}
					'text' { [ . ]
						'text': reference
						'format': component 'text format'
					}
					'stategroup' { [ ? ]
						'state group': reference
						'format': component 'state format'
					}
				)
			}
			'has first': stategroup = node-switch .'properties' (
				| nodes = 'yes' { 'first' = first }
				| none  = 'no'
			)
		}
	}
)
'id path' {
	'has step': stategroup (
		'yes' {
			'type': stategroup (
				'group' {
					'attribute': [ . ] reference
				}
				'collection entry' { [ . ]
					'attribute': reference
					'entry id': [ [, ] ] component 'text value'
				}
				'state' {
					'attribute': [ . ] reference
					'state': [ ? ] reference
				}
			)
			'tail': component 'id path'
		}
		'no' { }
	)
}
'node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'parent' { [ ^ ] }
				'state rule' { [ .& ]
					'rule': reference
				}
				'reference rule' {
					'property': [ . ] reference
					'rule': [ & ] reference
				}
				'reference' {
					'text': [ > ] reference
				}
				'group' {
					'group': [ + ] reference
				}
				'collection entry' {
					'collection': [ . ] reference
					'entry key': [ [, ] ] text
				}
				'state' {
					'state group': [ . ] reference
					'state': [ ? ] reference
				}
			)
			'tail': component 'node path'
		}
	)
}
'entity descendant selector' {
	'has step': stategroup (
		'yes' {
			'type': stategroup (
				'group' {
					'attribute': [ + ] reference
				}
				'state' {
					'attribute': [ ? ] reference
					'state': [ | ] reference
				}
			)
			'tail': component 'entity descendant selector'
		}
		'no' { }
	)
}
'collection selector' {
	'has step': stategroup (
		'yes' {
			'head': component 'entity descendant selector'
			'attribute': [ . ] reference
			'tail': component 'collection selector'
		}
		'no' { }
	)
}
'collection expression' {
	'type': stategroup (
		'property' {
			'node selection': component 'node path'
			'attribute': [ . ] reference
			'property': [ (, ) ] component 'text expression'
		}
	)
}
'collection format' {
	'type': stategroup (
		'join' { [ join ]
			'separator': [ with ] component 'text value'
		}
	)
}
'number value' {
	'type': stategroup (
		'dynamic' {
			'parameter': [ & ] reference
		}
		'static' {
			'value': integer
		}
	)
}
'number expression' {
	'type': stategroup (
		'value' {
			'value': component 'number value'
		}
		'property' {
			'node selection': component 'node path'
			'attribute': [ : ] reference
		}
	)
}
'number format' {
	'type': [ as ] stategroup (
		'number' { [ number ] }
		'date' { [ date ] }
		'time' { [ time ] }
		'datetime' { [ datetime ] }
		'decimal' { [ decimal ]
			'shift': integer
		}
	)
}
'text value' {
	'type': stategroup (
		'dynamic' {
			'parameter': [ & ] reference
		}
		'static' {
			'value': text
		}
	)
}
'text expression' {
	'type': stategroup (
		'value' {
			'value': component 'text value'
		}
		'property' {
			'node selection': component 'node path'
			'attribute': [ : ] reference
		}
	)
}
'text format' {
	'type': [ as ] stategroup (
		'text' { [ text ] }
	)
}
'stategroup expression' {
	'node selection': component 'node path'
	'attribute': [ : ] reference
}
'state format' {
	'type': [ as ] stategroup (
		'text' { [ text ] }
	)
}
'number filter expression' {
	'operator': stategroup (
		'range' {
			'greater than': stategroup (
				'yes' { [ > ]
					'criterium': component 'number value'
				}
				'no' { }
			)
			'less than': stategroup (
				'yes' { [ < ]
					'criterium': component 'number value'
				}
				'no' { }
			)
		}
		'equals' { [ == ]
			'criterium': component 'number value'
		}
	)
}
'reference filter list' {
	'context': stategroup (
		'root' { [ root ] }
		'query context' { }
	)
	'referenced node': component 'id path'
	'has alternative': stategroup (
		'yes' {
			'alternative': [ , ] component 'reference filter list'
		}
		'no' { }
	)
}