Parser/QueryParser.cpp
antlrcpp::Any QueryParser::visitGroupOrUnionGraphPattern(SPARQLParser::GroupOrUnionGraphPatternContext *ctx, \
	QueryTree::GroupPattern &group_pattern)
{
	if (ctx->children.size() == 1)
	{
		group_pattern.addOneGroup();
		visitGroupGraphPattern(ctx->groupGraphPattern(0), group_pattern.getLastGroup());
	}
	else
	{
		group_pattern.addOneGroupUnion();
		for (auto groupGraphPattern : ctx->groupGraphPattern())
		{
			group_pattern.addOneUnion();
			visitGroupGraphPattern(groupGraphPattern, group_pattern.getLastUnion());
		}
	}

	return antlrcpp::Any();
}
/**
	groupOrUnionGraphPattern : groupGraphPattern ( K_UNION groupGraphPattern )* ;
	Visit node groupOrUnionGraphPattern: if there is only one child, it is an individual 
	nested group graph pattern; if there are multiple children, they are connected by UNION.
	Add corresponding components to group_pattern, and fill them by recursively visiting
	the children.

	@param ctx pointer to groupOrUnionGraphPattern's context.
	@param group_pattern a group graph pattern.
	@return a dummy antlrcpp::Any object.
*/
groupOrUnionGraphPattern : groupGraphPattern ( K_UNION groupGraphPattern )* ;
Visit node groupOrUnionGraphPattern: if there is only one child, it is an individual
nested group graph pattern; if there are multiple children, they are connected by UNION.
Add corresponding components to group_pattern, and fill them by recursively visiting
the children.
groupOrUnionGraphPattern : groupGraphPattern ( K_UNION groupGraphPattern ) * ; Visit node groupOrUnionGraphPattern : if there is only one child it is an individual nested group graph pattern ; if there are multiple children they are connected by UNION . Add corresponding components to group_pattern and fill them by recursively visiting the children .
antlrcpp::Any QueryParser::visitGroupOrUnionGraphPattern(SPARQLParser::GroupOrUnionGraphPatternContext *ctx, \
	QueryTree::GroupPattern &group_pattern)
{
	if (ctx->children.size() == 1)
	{
		group_pattern.addOneGroup();
		visitGroupGraphPattern(ctx->groupGraphPattern(0), group_pattern.getLastGroup());
	}
	else
	{
		group_pattern.addOneGroupUnion();
		for (auto groupGraphPattern : ctx->groupGraphPattern())
		{
			group_pattern.addOneUnion();
			visitGroupGraphPattern(groupGraphPattern, group_pattern.getLastUnion());
		}
	}
	return antlrcpp::Any();
}
antlrcpp :: Any QueryParser :: visitGroupOrUnionGraphPattern ( SPARQLParser :: GroupOrUnionGraphPatternContext * ctx , QueryTree :: GroupPattern & group_pattern ) { if ( ctx -> children . size ( ) == 1 ) { group_pattern . addOneGroup ( ) ; visitGroupGraphPattern ( ctx -> groupGraphPattern ( 0 ) , group_pattern . getLastGroup ( ) ) ; } else { group_pattern . addOneGroupUnion ( ) ; for ( auto groupGraphPattern : ctx -> groupGraphPattern ( ) ) { group_pattern . addOneUnion ( ) ; visitGroupGraphPattern ( groupGraphPattern , group_pattern . getLastUnion ( ) ) ; } } return antlrcpp :: Any ( ) ; }
groupOrUnionGraphPattern : groupGraphPattern ( K_UNION groupGraphPattern )* ;
Visit node groupOrUnionGraphPattern: if there is only one child, it is an individual
nested group graph pattern; if there are multiple children, they are connected by UNION.
groupOrUnionGraphPattern : groupGraphPattern ( K_UNION groupGraphPattern ) * ; Visit node groupOrUnionGraphPattern : if there is only one child it is an individual nested group graph pattern ; if there are multiple children they are connected by UNION .