query

auto-webclient grammar version voyager.2

'query type': stategroup (
	'collection' { [ collection: ]
		'context selection': component 'node selector'
		'collection selection': [ 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 ] component 'filter expression'
		'record limit': [ limit ] component 'number value'
	}
	'graph' { [ graph: ]
		'context selection': component 'node selector'
		'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'
				)
				'type': [ : ] stategroup (
					'number' { [ number ]
						'node selection': component 'conditional selector'
						'attribute': [ : ] reference
						'format': component 'number format'
					}
					'text' { [ text ]
						'node selection': component 'conditional selector'
						'attribute': [ : ] reference
						'format': component 'text format'
					}
					'stategroup' { [ state ]
						'node selection': component 'conditional selector'
						'attribute': [ : ] reference
						'format': component 'state format'
					}
				)
			}
			'has first': stategroup = node-switch .'properties' (
				| nodes = 'yes' { 'first' = first }
				| none  = 'no'
			)
		}
	}
)
'node selector' {
	'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 'node selector'
		}
		'no' { }
	)
}
'singular selector' {
	'has step': stategroup (
		'yes' {
			'type': stategroup (
				'group' {
					'attribute': [ + ] reference
				}
				'parent' { [ ^ ] }
				'state rule' { [ & ]
					'rule': reference
				}
				'reference' {
					'attribute': [ > ] reference
				}
				'reference rule' {
					'text': [ > ] reference
					'rule': [ $ ] reference
				}
			)
			'tail': component 'singular selector'
		}
		'no' { }
	)
}
'conditional selector' {
	'head': component 'singular selector'
	'has step': stategroup (
		'yes' {
			'type': stategroup (
				'state' {
					'stategroup': [ ? ] reference
					'state': [ | ] reference
				}
				'link' {
					'text': [ ~> ] reference
				}
			)
			'tail': component 'conditional selector'
		}
		'no' { }
	)
}
'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 'conditional selector'
			'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 'conditional selector'
			'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 'conditional selector'
			'attribute': [ : ] reference
		}
	)
}
'text format' {
	'type': [ as ] stategroup (
		'text' { [ text ] }
	)
}
'stategroup expression' {
	'node selection': component 'conditional selector'
	'attribute': [ : ] reference
}
'state format' {
	'type': [ as ] stategroup (
		'text' { [ text ] }
	)
}
'filter expression' {
	'has filter': stategroup (
		'yes' {
			'type': stategroup (
				'number' {
					'left value': component 'number expression'
					'operator': stategroup (
						'equal' { [ == ] }
						'greater' { [ > ] }
						'smaller' { [ < ] }
					)
					'right value': component 'number value'
				}
				'stategroup' {
					'value': component 'stategroup expression'
					'include states': [ (, ) ] dictionary { }
				}
			)
			'tail': component 'filter expression'
		}
		'no' { }
	)
}