query

reporter grammar version 47

'query type' stategroup
(
	'collection' [ collection: ]
		'context selection' component 'node selector'
		'collection selection' [ from ] component 'collection selector'
		'properties' [ select ] collection order 'order'
		(
			'has next' stategroup has successor 'next' 'yes' 'no'
			'type' [ : ] stategroup
			(
				'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 has 'properties' first 'first' 'yes' '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'
			'reference' [ > ] reference
			'dereference' component 'dereference'
			'collection' component 'entity ancestor selector'
			'collection type' stategroup
			(
				'collection'
					'graph' [ flatten ] reference
			)
		)
		'query' group
		(
			'collection selection' [ from ] component 'collection selector'
			'properties' [ select ] collection order 'order'
			(
				'has next' stategroup has successor 'next' 'yes' 'no'
				'type' [ : ] stategroup
				(
					'number' [ number ]
						'node selection' component 'conditional selector'
						'property' [ : ] reference
						'format' component 'number format'
					'text' [ text ]
						'node selection' component 'conditional selector'
						'property' [ : ] reference
						'format' component 'text format'
					'stategroup' [ state ]
						'node selection' component 'conditional selector'
						'property' [ : ] reference
						'format' component 'state format'
				)
			)
			'has first' stategroup has 'properties' first 'first' 'yes' 'no'
		)
)
'dereference'
	'dereference' stategroup
	(
		'yes'
	)
'entity equality'
'node selector'
	'has step' stategroup
	(
		'yes'
			'type' stategroup
			(
				'group'
					'group' [ + ] reference
				'collection entry'
					'collection' [ . ] reference
					'entry id' [ [, ] ] component 'text value'
				'state'
					'stategroup' [ ? ] reference
					'state'      [ | ] reference
			)
			'tail' component 'node selector'
		'no'
	)
'singular selector'
	'has step' stategroup
	(
		'yes'
			'type' stategroup
			(
				'group'
					'group' [ + ] reference
				'parent' [ ^ ]
				'reference'
					'reference' [ > ] reference
					'dereference' component 'dereference'
			)
			'tail' component 'singular selector'
		'no'
	)
'conditional selector'
	'head' component 'singular selector'
	'has step' stategroup
	(
		'yes'
			'stategroup' [ ? ] reference
			'state'      [ | ] reference
			'tail' component 'conditional selector'
		'no'
	)
'entity ancestor selector'
	'has step' stategroup
	(
		'yes'
			'type' stategroup
			(
				'parent'
					'entity scope' [ ^ ] component 'entity equality'
			)
			'tail' component 'entity ancestor selector'
		'no'
	)
'entity descendant selector'
	'has step' stategroup
	(
		'yes'
			'type' stategroup
			(
				'group'
					'group' [ + ] reference
				'state'
					'stategroup' [ ? ] reference
					'state'      [ | ] reference
			)
			'tail' component 'entity descendant selector'
		'no'
	)
'collection selector'
	'has step' stategroup
	(
		'yes'
			'head' component 'entity descendant selector'
			'collection' [ . ] reference
			'tail' component 'collection selector'
		'no'
	)
'number value'
	'type' stategroup
	(
		'dynamic'
			'parameter' [ & ] reference
		'static'
			'value' number
	)
'number expression'
	'type' stategroup
	(
		'value'
			'value' component 'number value'
		'property'
			'node selection' component 'conditional selector'
			'property' [ : ] reference
	)
'number format'
	'type' [ as ] stategroup
	(
		'number' [ number ]
		'date'     [ date ]
		'time'     [ time ]
		'datetime' [ datetime ]
		'decimal'  [ decimal ] 'shift' number
	)
'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'
			'property' [ : ] reference
	)
'text format'
	'type' [ as ] stategroup
	(
		'text' [ text ]
	)
'stategroup expression'
	'node selection' component 'conditional selector'
	'stategroup' [ : ] 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'       [ > ]
						'greater equal' [ >= ]
						'smaller'       [ < ]
						'smaller equal' [ <= ]
					)
					'right value' component 'number value'
				'stategroup'
					'value' component 'stategroup expression'
					'include states' [ (, ) ] collection ( )
			)
			'tail' component 'filter expression'
		'no'
	)