Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » IllegalStateException for specific text
IllegalStateException for specific text [message #1724402] Tue, 23 February 2016 17:18 Go to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Hi ,

I get an exception at the following part of code.


def private ContentAssistContext[] getContexts(XtextResource resource, String text, ITextRegion selection,
int caretOffset) {
if (caretOffset > text.length)
return #[]
val contextFactory = contextFactoryProvider.get() => [pool = Executors.newCachedThreadPool]
contextFactory.create(text, selection, caretOffset, resource)
}


This happens when the input is

"plot abc by tim by adviser by"


This does not happen when the input

"plot abc by tim by adviser"



my grammar :

Model:
	greetings=Query;

Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) ((groupBy=GroupList)? &(condition=Condtition)? &(range=Transition)?) ;


QTypekeyWord:
	qKeyword='plot'
;

Aggregation:
	agg=('average'|'number of'|'total')
;

Condtition:
	con+='for' dimVal=DimensionValue 'as' dim=Dimension ('and' dimValue=DimensionValue 'as' dimen=Dimension)*
;

MeasureList : names+=Measure ("and" names+=Measure)*;

Measure:ID+;


Dimension:
	dimensions+=ID+
;

DimensionValue:
	value=ID+
;

GroupList:
	(=> "by" (timeGroups+=TimeGroup|dimensionGroups+=Dimension))+
;
Transition:

	'from' dateStart=Date 'to' dateEnd=Date
;

TimeGroup:

	timeGroup=('day'|'week'|'month'|'quarter'|'year')
;
Date:
	d=Day m=Month y=Year ;


Day : INT ;
Month : 'Jan'|'Feb'|'Mar'|'Apr' ;
Year : INT ;







java.util.concurrent.ExecutionException: java.lang.IllegalStateException: expected element: 'org.eclipse.xtext.impl.RuleCallImpl@26d83c77 (cardinality: null, predicated: false, firstSetPredicated: false) (explicitlyCalled: false)', but was: 'org.eclipse.xtext.impl.GroupImpl@7cac903 (cardinality: +, predicated: false, firstSetPredicated: false)'
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_45]
	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_45]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.doCreateContexts(ContentAssistContextFactory.java:173) [org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.create(ContentAssistContextFactory.java:123) [org.eclipse.xtext.ide-2.9.1.jar:?]
	at com.einsights.suggestions.dsl.StandAloneContentAssistService.getContexts(StandAloneContentAssistService.java:72) [classes/:?]
	at com.einsights.suggestions.dsl.StandAloneContentAssistService.createProposals(StandAloneContentAssistService.java:50) [classes/:?]
	at com.einsights.suggestions.dsl.EinDslExecutor.executeContentAssistor(EinDslExecutor.java:51) [classes/:?]
	at com.einsights.suggestions.service.SuggestionsServiceImpl.getContentAssist(SuggestionsServiceImpl.java:243) [classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:139) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at com.sun.proxy.$Proxy144.getContentAssist(Unknown Source) [?:?]
	at com.einsights.suggestions.controller.SuggestionsController.getContentAssist(SuggestionsController.java:119) [classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) [spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237) [spring-boot-actuator-1.3.2.RELEASE.jar:1.3.2.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.4.jar:1.2.4]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.4.jar:1.2.4]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.4.jar:1.2.4]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:111) [spring-boot-actuator-1.3.2.RELEASE.jar:1.3.2.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) [spring-boot-actuator-1.3.2.RELEASE.jar:1.3.2.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_45]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: java.lang.IllegalStateException: expected element: 'org.eclipse.xtext.impl.RuleCallImpl@26d83c77 (cardinality: null, predicated: false, firstSetPredicated: false) (explicitlyCalled: false)', but was: 'org.eclipse.xtext.impl.GroupImpl@7cac903 (cardinality: +, predicated: false, firstSetPredicated: false)'
	at org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.after(AbstractInternalContentAssistParser.java:202) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__GroupByAssignment_3_0(InternalEinDslParser.java:4980) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__UnorderedGroup_3__Impl(InternalEinDslParser.java:4484) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__UnorderedGroup_3__0(InternalEinDslParser.java:4634) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__UnorderedGroup_3(InternalEinDslParser.java:4398) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__Group__3__Impl(InternalEinDslParser.java:2443) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__Group__3(InternalEinDslParser.java:2401) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__Group__2(InternalEinDslParser.java:2317) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__Group__1(InternalEinDslParser.java:2217) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Query__Group__0(InternalEinDslParser.java:2117) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.ruleQuery(InternalEinDslParser.java:230) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.rule__Model__GreetingsAssignment(InternalEinDslParser.java:4795) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.ruleModel(InternalEinDslParser.java:145) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslParser.entryRuleModel(InternalEinDslParser.java:102) ~[classes/:?]
	at org.xtext.example.mydsl.ide.contentassist.antlr.EinDslParser.getFollowElements(EinDslParser.java:87) ~[classes/:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:322) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.createContextsForLastCompleteNode(ContentAssistContextFactory.java:274) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.handleLastCompleteNodeIsPartOfLookahead(ContentAssistContextFactory.java:209) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:164) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:1) ~[org.eclipse.xtext.ide-2.9.1.jar:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_45]
	... 1 more
Re: IllegalStateException for specific text [message #1724404 is a reply to message #1724402] Tue, 23 February 2016 17:24 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
It also happens when the text is

"plot abc by tim by country by month"
Re: IllegalStateException for specific text [message #1724412 is a reply to message #1724404] Tue, 23 February 2016 18:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi can you please file a bug?

does the following work as workaround or does it destroy something?


Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) ((groupBy+=Group)* &(condition=Condtition)? &(range=Transition)?) ;

Group:
	 
	
	"by" timeGroups+=TimeGroup|
	
	"by" dimensionGroups+=Dimension
		
	
;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException for specific text [message #1724450 is a reply to message #1724412] Wed, 24 February 2016 04:07 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ok Thank You. Saved my time. Smile

I have a question on this grammar.
I wish to change the definition of the grammar to support just two cases

by dimension by time .Here when dimension is there then only time should come
by time .only by time can also be allowed.

So in summary.

plot abc by country
plot abc by country by month
plot abc by month

How do I restrict my grammar for the above scenario

[Updated on: Wed, 24 February 2016 04:08]

Report message to a moderator

Re: IllegalStateException for specific text [message #1724452 is a reply to message #1724450] Wed, 24 February 2016 04:16 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
This is my change. I get the desired result. But get the warnings.!


Query:(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) (("by" groupBy=Group)? &(condition=Condtition)? &(range=Transition)?) ;

Group:
	group+= Dimension ('by' group+=TimeGroup)? |
	group+= TimeGroup

;

Re: IllegalStateException for specific text [message #1724455 is a reply to message #1724450] Wed, 24 February 2016 04:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I'd do that in the validator. Or use unordered groups in the grammar

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException for specific text [message #1724456 is a reply to message #1724455] Wed, 24 February 2016 04:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
e.g.

Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) ((groupBy+=Group)? &(condition=Condtition)? &(range=Transition)?) ;


Group:
	 
	
	("by" timeGroups+=TimeGroup)+ &
	
	("by" dimensionGroups+=Dimension)+
		
	
;



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 24 February 2016 04:41]

Report message to a moderator

Re: IllegalStateException for specific text [message #1724458 is a reply to message #1724456] Wed, 24 February 2016 05:02 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member

In my test case I get dimGroup as null. (commented the assert)


@Test
	def void testPlotMeasureByDimension() {

		val query ="plot profit by country"
		val result = parseHelper.parse(query)

		var expected =Arrays.asList("profit")

		Assert.assertEquals(result.greetings.key.getQKeyword,"plot")
		Assert.assertEquals(expected,result.greetings.measure.names)



		var groupBy=getGroupBy(result)
		//Assert.assertEquals(groupBy.get(0),"country")

	}


	def EList<Group> getGroupBy(Model model){

	return  model.greetings.getGroupBy
}



Re: IllegalStateException for specific text [message #1724460 is a reply to message #1724458] Wed, 24 February 2016 05:15 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
The below grammar works for me .But. Please suggest why am I getting ambiguity warning for this. How can I resolve this.


Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) ((groupBy+=Group)? &(condition=Condtition)? &(range=Transition)?) ;

Group:

	"by" ((dimGroup=Dimension("by" timeGroup+=TimeGroup)? )|timeGroup+= TimeGroup)

;

Re: IllegalStateException for specific text [message #1724463 is a reply to message #1724458] Wed, 24 February 2016 05:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
looks like you should try to understand how xtext derives the metamodel from the grammar.
and how to test

println(result.eResource.errors)
gives
[XtextSyntaxDiagnostic: null:1 no viable alternative at input 'country']

if you want to have one thing only you have to state that in your grammar havent you?
from a grammar standpoint your requirements are pain since unordered groups a ors with mult. *

therefore it would be much easyier if you would not insist to do all in grammar but move rules to the validator





Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException for specific text [message #1724464 is a reply to message #1724463] Wed, 24 February 2016 05:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you could try

Group:
	((dimensionGroups+=Dimension ("by" dimensionGroups+=Dimension)*)
	(-> "by" timeGroups+=TimeGroup)*)
	|
	((timeGroups+=TimeGroup ("by" timeGroups+=TimeGroup)*)
	(-> "by" dimensionGroups+=Dimension)*);

Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) (("by"groupBy+=Group)? &('for' condition=Condtition)? &('from' range=Transition)?) ;

.......


and look if it works when ignoring the warning


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 24 February 2016 06:02]

Report message to a moderator

Re: IllegalStateException for specific text [message #1724465 is a reply to message #1724464] Wed, 24 February 2016 06:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
or you dont use the unordered group but do the xmath yourself


Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) (
		
		
		( ("by"groupBy+=Group) ('for' condition=Condtition) ('from' range=Transition) )
	|
	( ("by"groupBy+=Group)  ('from' range=Transition) ('for' condition=Condtition)  )
	|
	( ("by"groupBy+=Group) ('for' condition=Condtition) )
	|
	( ("by"groupBy+=Group)  ('from' range=Transition)  )
	|
	("by"groupBy+=Group)
	|
	(('for' condition=Condtition) ("by"groupBy+=Group)  ('from' range=Transition) )
	|
	(('for' condition=Condtition) ('from' range=Transition)  ("by"groupBy+=Group) )
	|
	(('for' condition=Condtition) ("by"groupBy+=Group)  )
	|
	(('for' condition=Condtition) ('from' range=Transition) )
	|
	('for' condition=Condtition)
	
	|
	(('from' range=Transition) ('for' condition=Condtition) ("by"groupBy+=Group)   )
	|
	(('from' range=Transition) ("by"groupBy+=Group)  ('for' condition=Condtition)  )
	
	|
	(('from' range=Transition) ('for' condition=Condtition)    )
	|
	(('from' range=Transition) ("by"groupBy+=Group)  )
	|
	('from' range=Transition)
	) ;
	
	

Group:
	((dimensionGroups+=Dimension ("by" dimensionGroups+=Dimension)*)
	(-> "by" timeGroups+=TimeGroup)*)
	|
	((timeGroups+=TimeGroup ("by" timeGroups+=TimeGroup)*
	)
	(-> "by" dimensionGroups+=Dimension)*);
	
		
	

QTypekeyWord:
	qKeyword='plot'
;

Aggregation:
	agg=('average'|'number of'|'total')
;

Condtition:
 	dimVal=DimensionValue 'as' dim=Dimension ('and' dimValue=DimensionValue 'as' dimen=Dimension)*
;

MeasureList : names+=Measure ("and" names+=Measure)*;

Measure:ID+;


Dimension:
	->dimensions+=ID+
;

DimensionValue:
	value+=ID+
;


Transition:

	dateStart=Date 'to' dateEnd=Date
;

TimeGroup:

	timeGroup=('day'|'week'|'month'|'quarter'|'year')
;
Date:
	d=Day m=Month y=Year ;


Day : INT ;
Month : 'Jan'|'Feb'|'Mar'|'Apr' ;
Year : INT ;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException for specific text [message #1724496 is a reply to message #1724465] Wed, 24 February 2016 09:05 Go to previous message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Thank you for the suggestion and code. I will report the bug.

[Updated on: Wed, 24 February 2016 09:06]

Report message to a moderator

Previous Topic:Xtext web editor -- debug mode
Next Topic:Cross-reference issues
Goto Forum:
  


Current Time: Fri Apr 19 15:18:57 GMT 2024

Powered by FUDForum. Page generated in 0.02678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top