Requested Information - Grammar

To illustrate the grammar, some examples are given next:

Examples

Phone number required for passenger with a given id:

passenger[ee764ee0-55a1-11eb-ae93-0242ac130002].details.phone
	

First name and name required with a given id:

passenger[ee764ee0-55a1-11eb-ae93-0242ac130004].details.firstName AND passenger[ee764ee0-55a1-11eb-ae93-0242ac130004].details.name	
	

More complex example:

passenger[ee764ee0-55a1-11eb-ae93-0242ac130006].details.firstName AND passenger[ee764ee0-55a1-11eb-ae93-0242ac130006].details.name AND (passenger[ee764ee0-55a1-11eb-ae93-0242ac130006].details.eMail OR passenger[ee764ee0-55a1-11eb-ae93-0242ac130006].details.phone)
	

Grammar for Requested Information

Here is the grammar in ANTLR notation.

	grammar RequestedInformation;

	requested_informations
		: requested_information (boolean_operator requested_information)*
		| boolean_expression
		;
	
	requested_information
		: boolean_expression_with_brackets boolean_operator boolean_expression_with_brackets
		;
	
	boolean_expression_with_brackets
		: Opening_Bracket boolean_expression Closing_Bracket
		;
	
	boolean_expression
		: class_index_attribute boolean_operator class_index_attribute
		;
	
	class_index_attribute
		: Class Opening_Index_Bracket Identifier Closing_Bracket (Point Attribute)+
		;
	
	Class
		: [A-Z][a-z_]*[a-z]
		;
	
	Attribute
		: [a-z_][a-z]*
		;   
	
	Identifier
		: UUID
		| 'ANY'
		;
	
	UUID
		: Block Block '-' Block '-' Block '-' Block '-' Block Block Block
		;
	
	fragment Block
		: [A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9]
		;
	
	boolean_operator
		: And_Operator
		| Or_Operator
		;
	
	Opening_Index_Bracket
		: '['
		;
	
	Closing_Index_Bracket
		: ']'
		;
	
	Opening_Bracket
		: '('
		;
	
	Closing_Bracket
		: ')'
		;
	
	And_Operator
		: 'AND'
		;
	
	Or_Operator
		: 'OR'
		;
	
	Point
		: '.'
		;

		

Block

[A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9] [A-Za-z0-9]

Class

[A-Z] [a-z_] [a-z]

Attribute

[a-z_] [a-z]

Identifier

UUID 'ANY'

UUID

Block Block '-' Block '-' Block '-' Block '-' Block Block Block

Opening_Index_Bracket

'['

Closing_Index_Bracket

']'

Opening_Bracket

'('

Closing_Bracket

')'

And_Operator

'AND'

Or_Operator

'OR'

Point

'.'

requested_informations

requested_information boolean_operator requested_information boolean_expression

requested_information

boolean_expression_with_brackets boolean_operator boolean_expression_with_brackets

boolean_expression_with_brackets

Opening_Bracket boolean_expression Closing_Bracket

boolean_expression

class_index_attribute boolean_operator class_index_attribute

class_index_attribute

Class Opening_Index_Bracket Identifier Closing_Bracket Point Attribute

boolean_operator

And_Operator Or_Operator