stanbol-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rupert Westenthaler <rupert.westentha...@gmail.com>
Subject Re: Unexpected results for FieldQuery (was: Fwd: [jira] [Commented] (STANBOL-187) Extendable indexing infrastructure for the Entityhub)
Date Fri, 03 Jun 2011 18:32:37 GMT
Hi

The reason is that for the Text constraint the searched Text is parsed
via the "text" parameter and not by using "value" as for the
ValueConstraint.
There should be the warning
   "Parsed TextConstraint doese not define the required field 'text'!"
in the log. However I should rather throw an IllegalArgumentException
rather than causing a NPE.

When you change the "value" to "text" than everything should work just
fine - hpefully ...

    {
         "offset": "0",
         "limit": "30",
         "constraints": [
             {
                 "type": "text",
                 "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
                 "text": "PREPARATION DES AGREGATS",
             }
         ]
     }

best
Rupert

On Fri, Jun 3, 2011 at 5:49 PM, florent andré
<florent.andre-dev@4sengines.com> wrote:
> Rupert,
>
> Thanks for this ! This work now for single and multiple words... but with
> the ValueConstraint, the textConstraint fire an NPE.
>
> I restart the indexing and install fresh solr indexes and felix bundle.
> Trying to limit bugs from my brain :).
>
> A) With ValueConstraint, this work well :
> {
>    "offset": "0",
>    "limit": "30",
>    "constraints": [
>        {
>          "type": "value",
>          "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>          "dataTypes":
> ["http:\/\/www.iks-project.eu\/ontology\/rick\/model\/text"],
>          "value": "PREPARATION DES AGREGATS",
>        }
>    ]
> }
>
> B) with TextConstraint, this :
> {
>    "offset": "0",
>    "limit": "30",
>    "constraints": [
>        {
>          "type": "text",
>          "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>          "value": "PREPARATION DES AGREGATS",
>        }
>    ]
> }
>
> Fire this exception :
> =========
> * root error seems to be :
> Caused by: java.lang.NullPointerException
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseTextConstraint(FieldQueryReader.java:229)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseConstraint(FieldQueryReader.java:139)
> =========
> * all stack trace :
>
> Jun 3, 2011 5:22:50 PM
> com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
> SEVERE: The RuntimeException could not be mapped to a response, re-throwing
> to the HTTP container
> com.sun.jersey.api.container.ContainerException:
> java.lang.NullPointerException
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:179)
>        at
> com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:107)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at
> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)
>        at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)
>        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.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>        at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>        at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.NullPointerException
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseTextConstraint(FieldQueryReader.java:229)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseConstraint(FieldQueryReader.java:139)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.fromJSON(FieldQueryReader.java:92)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:57)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:38)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getAsMultipartFormData(MultipartFormDispatchProvider.java:228)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:176)
>        ... 39 more
> Jun 3, 2011 5:23:21 PM
> com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
> SEVERE: The RuntimeException could not be mapped to a response, re-throwing
> to the HTTP container
> com.sun.jersey.api.container.ContainerException:
> java.lang.IllegalArgumentException: The parsed JSON object MUST contain the
> required key "constraints"
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:179)
>        at
> com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:107)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at
> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)
>        at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)
>        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.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>        at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>        at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.IllegalArgumentException: The parsed JSON object MUST
> contain the required key "constraints"
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.fromJSON(FieldQueryReader.java:76)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:57)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:38)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getAsMultipartFormData(MultipartFormDispatchProvider.java:228)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:176)
>        ... 39 more
> Jun 3, 2011 5:31:16 PM
> com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
> SEVERE: The RuntimeException could not be mapped to a response, re-throwing
> to the HTTP container
> com.sun.jersey.api.container.ContainerException:
> java.lang.NullPointerException
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:179)
>        at
> com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:107)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at
> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)
>        at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)
>        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.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>        at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>        at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.NullPointerException
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseTextConstraint(FieldQueryReader.java:229)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseConstraint(FieldQueryReader.java:139)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.fromJSON(FieldQueryReader.java:92)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:57)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:38)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getAsMultipartFormData(MultipartFormDispatchProvider.java:228)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:176)
>        ... 39 more
> Jun 3, 2011 5:37:55 PM
> com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
> SEVERE: The RuntimeException could not be mapped to a response, re-throwing
> to the HTTP container
> com.sun.jersey.api.container.ContainerException:
> java.lang.NullPointerException
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:179)
>        at
> com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:107)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:123)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:170)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at
> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:265)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
>        at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
>        at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:996)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:947)
>        at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:938)
>        at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:399)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:478)
>        at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:663)
>        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.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>        at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>        at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.NullPointerException
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseTextConstraint(FieldQueryReader.java:229)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.parseConstraint(FieldQueryReader.java:139)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.fromJSON(FieldQueryReader.java:92)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:57)
>        at
> org.apache.stanbol.entityhub.jersey.parsers.FieldQueryReader.readFrom(FieldQueryReader.java:38)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getAsMultipartFormData(MultipartFormDispatchProvider.java:228)
>        at
> com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider$MultipartFormParamInjectable.getValue(MultipartFormDispatchProvider.java:176)
>        ... 39 more
>
>
>
> On 06/03/2011 03:55 PM, Rupert Westenthaler wrote:
>>
>> Hi Florent
>>
>> First of all: as I expected it was a Bug in the FieldQuery
>> implementation of the SolrYard. The Bug is fixed in the meantime [1],
>> however the Bug itself was not the reason why you where getting
>> unexpected results. That there where any results for the second query
>> ("South America") was a result of the Bug.
>>
>> The reason why you do not get any results is because you search for
>> "xsd:string" values, but "skos:prefLabel" are mapped to
>> "entityhub:text". The entityhub distinguishes between natural language
>> text and "string" values. Strings would be typically used for ids
>> (e.g. ISBN numbers). also "skos:notation" would be a good example. The
>> Solr yard does not use any tokenizer for String values.
>>
>> Your query used a ValueConstraint to search for the skos:prefLabel:
>>>
>>>    {
>>>        "type": "value",
>>>        "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>>        "value": "Africa",
>>>    }
>>
>> if no data type is defined for such constraint, than the data type is
>> detected based on the java type of the value. What would be
>>
>> * String for "value": "Africa"
>> * Integer for "value": 123
>> * Float for "value": 1.23
>>
>> You can also explicitly parse an dataType by using "dataTypes"
>>     {
>>         "type": "value",
>>         "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>         "dataTypes":
>> ["http:\/\/www.iks-project.eu\/ontology\/rick\/model\/text"],
>>         "value": "South America",
>>     }
>>
>> "http://www.iks-project.eu/ontology/rick/model/text" is the data type
>> used for natural text values.
>>
>> However the preferred way to query for Natural Text values is to use a
>> TextConstraint instead of a ValueConstraint.
>> The TextConstraint equivalent to the above ValueConstraint is:
>>
>>     {
>>         "type": "text",
>>         "text": "South Africa",
>>         "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>     }
>>
>> However text constraints also allow to define the languages to search
>> as well as the use of Wildcards
>> e.g.
>>
>>     {
>>         "selected": [
>>             "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>             "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"],
>>         "offset": "0",
>>         "limit": "30",
>>         "constraints": [
>>         {
>>             "type": "text",
>>             "languages": ["en-GB"],
>>             "patternType": "wildcard",
>>             "text": "Photo*",
>>             "field":
>> "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>         }
>>     ]
>> }
>>
>> A documentation of the FieldQuery syntax is provided at the end of the
>> Entityhub README.TXT [2]
>>
>> best
>> Rupert Westenthaler
>>
>> [1] http://svn.apache.org/viewvc?rev=1131027&view=rev
>> [2]
>> http://svn.apache.org/repos/asf/incubator/stanbol/trunk/entityhub/README.TXT
>>
>>
>>> 1) When indexing a skos file, only terms with multi-words are indexed,
>>> and not term with one word. I observe this first on my particular thesaurus
>>> then also in the iptc one. I try this request
>>> $ curl -X POST -F "query=@fieldQuery.json"
>>> http://localhost:8080/entityhub/site/iptc/query
>>> with queries :
>>
>>> 1.A) @fieldQuery.json =
>>> {
>>>    "offset": "0",
>>>    "limit": "30",
>>>    "constraints": [
>>>        {
>>>          "type": "value",
>>>          "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>>          "value": "Africa",
>>>        }
>>>    ]
>>> }
>>>
>>> ==>  output no results
>>>
>>> 1.B) @fieldQuery.json =
>>> {
>>>    "offset": "0",
>>>    "limit": "30",
>>>    "constraints": [
>>>        {
>>>          "type": "value",
>>>          "field": "http:\/\/www.w3.org\/2004\/02\/skos\/core#prefLabel",
>>>          "value": "South America",
>>>        }
>>>    ]
>>> }
>



-- 
| Rupert Westenthaler             rupert.westenthaler@gmail.com
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen

Mime
View raw message