Ticket #672 (closed Enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

getRelatedAssociations with fetchComposite=true is "not yet impemented"

Reported by: Malte Owned by: jri
Priority: Minor Milestone:
Component: DeepaMehta Standard Distribution Version: 4.3
Keywords: Cc: jri
Complexity: 3 Area: Application Framework / API
Module: deepamehta-core

Description

Jul 07, 2014 10:11:29 PM de.deepamehta.plugins.webservice.provider.CatchAllExceptionMapper toResponse
SEVERE: A DeepaMehta resource method or event listener threw an exception resp. an error occurred. Mapping exception/error to response: 500 (Internal Server Error).
java.lang.RuntimeException: not yet implemented
	at de.deepamehta.core.impl.EmbeddedService.instantiateRelatedAssociation(EmbeddedService.java:755)
	at de.deepamehta.core.impl.EmbeddedService.instantiateRelatedAssociations(EmbeddedService.java:764)
	at de.deepamehta.core.impl.AttachedTopic.getRelatedAssociations(AttachedTopic.java:120)
	at org.deepamehta.plugins.wikidata.WikidataSearchPlugin.getTopicRelatedAssociations(WikidataSearchPlugin.java:363)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1480)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
	at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
	at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
	at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
	at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
	at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
	at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:654)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:369)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:933)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:995)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:744)

untested: probably then this is also the case for fetchRelatingComposite=true the in getRelatedAssociations(..)-call

If this could be realized, additional client-side http request to render a page vould vanish.

Change History

comment:1 Changed 6 years ago by jri

  • Owner set to jri
  • Status changed from new to accepted

comment:2 Changed 6 years ago by Malte

Great. What is needed here (wikidata-plugin) is: The full composite of ALL related Associations (those at the end of the association).

I just deactivated this feature in the current wikidata-topicmaps service since this often leaves the webclient unusable (too many client-side requests take too long), users can't interact with selected topics on a canvas.

comment:3 Changed 6 years ago by jri

With the refactored "fetchComposite" mechanics (see #699) we are nearly there (retrieving the association's composite). I'll try to fix it in the upcoming DM4.4 release. (Scheduled for end of Sep 2014. We're slightly late.)

comment:4 Changed 6 years ago by Jörg Richter

Core: include_childs for association lists (#699).

All REST APIs: the Core's JerseyResponseFilter processes the fetch_composite query parameter also for Iterable<Association> responses.

In particular this works for the GET /core/topic/{id}/related_assocs request (see #672, see #707).

See #699.

comment:5 follow-up: ↓ 6 Changed 6 years ago by jri

This should work now.

  • Core API: When you need access the assoc childs at server-side just do so:
    assoc.getCompositeValue().get...
    
    The child topics are loaded on-demand.

Note: there are no fetchComposite parameters in the Core API anymore (see #699).

  • REST APIs: When you need to include the association child topics in a response just include include_childs=true in the request. Your plugin must not care about loading the child topics and putting them in the response. The Core does this for you. Note: this works only if your RESTful method returns an Association (or a subtype) or an Iterable<Association> (or any Iterable subtype). See #699.

Does this work for you?

Last edited 6 years ago by jri (previous) (diff)

comment:6 in reply to: ↑ 5 Changed 6 years ago by jri

Replying to jri:

  • Core API: When you need access the assoc childs at server-side just do so:
    assoc.getCompositeValue().get...
    

CORRECTION: in DM 4.4 getCompositeValue() is obsolete. Use getChildTopics() as a replacement:

assoc.getChildTopics().get...

comment:7 Changed 6 years ago by jri

One more hint: about the "composite value" obsoleteness see #702.

comment:8 Changed 6 years ago by Jörg Richter

Core: include_childs for association lists (#699).

All REST APIs: the Core's JerseyResponseFilter processes the fetch_composite query parameter also for Iterable<Association> responses.

In particular this works for the GET /core/topic/{id}/related_assocs request (see #672, see #707).

See #699.

comment:9 Changed 6 years ago by Malte

  • Status changed from accepted to closed
  • Resolution set to fixed

The changes mentioned in comment:8 did it!
Thanks

Note: See TracTickets for help on using tickets.