LinkedDataFragments / jQuery-Widget.js

[DEPRECATED] A jQuery widget to query Triple Pattern Fragments interfaces
http://client.linkeddatafragments.org/
MIT License
35 stars 10 forks source link

Add Wikidata in the default config? #11

Closed tuukka closed 6 years ago

tuukka commented 6 years ago

Could the Wikidata LDF endpoint be added in the default config and example queries? See https://query.wikidata.org/bigdata/ldf and http://ldfclient.wmflabs.org/

rubensworks commented 6 years ago

@tuukka Do you have any suggestions for Wikidata example queries?

tuukka commented 6 years ago

The ldf-client at wmflabs has this one that seems to work nicely at least, "Directors of movies starring Brad Pitt":

SELECT ?film ?title ?name WHERE {
  ?film wdt:P161 wd:Q35332 ; wdt:P57 ?director .
  ?director rdfs:label ?name .
  ?film rdfs:label ?title .
  FILTER LANGMATCHES(LANG(?title), "EN")
  FILTER LANGMATCHES(LANG(?name),  "EN")
}
rubensworks commented 6 years ago

I just tried configuring the wikidata source and this example query, but I seem to run into a problem with the wikidata endpoint.

When querying it myself, the server seems to return a 500 error. If I request the turtle or trig version of the server, it gives the following error:

<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /bigdata/ldf. Reason:
<pre>    Server Error</pre></p><h3>Caused by:</h3><pre>javax.servlet.ServletException: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.linkeddatafragments.servlet.LinkedDataFragmentServlet.doGet(LinkedDataFragmentServlet.java:197)
    at org.wikidata.query.rdf.blazegraph.ldf.LDFServlet.doGet(LDFServlet.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1667)
    at ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.wikidata.query.rdf.blazegraph.filters.ClientIPFilter.doFilter(ClientIPFilter.java:43)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:497)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.linkeddatafragments.util.MIMEParse.parseMimeType(MIMEParse.java:99)
    at org.linkeddatafragments.util.MIMEParse.parseMediaRange(MIMEParse.java:119)
    at org.linkeddatafragments.util.MIMEParse.bestMatch(MIMEParse.java:268)
    at org.linkeddatafragments.util.MIMEParse.bestMatch(MIMEParse.java:292)
    at org.linkeddatafragments.servlet.LinkedDataFragmentServlet.doGet(LinkedDataFragmentServlet.java:161)
    ... 28 more
</pre>

@tuukka Do you know if the endpoint is using the latest LDF server version?

I'm wondering how you got the webclient working on http://ldfclient.wmflabs.org/ then? Because I can't seem to get it working on both my local webclient and the command line.

tuukka commented 6 years ago

Unfortunately, I don't know who runs ldfclient.wmflabs.org and where the source is. Command line works for me though:

$ npm install ldf-client
$ node_modules/.bin/ldf-client https://query.wikidata.org/bigdata/ldf -q 'SELECT ?film ?title ?name WHERE {
  ?film <http://www.wikidata.org/prop/direct/P161> <http://www.wikidata.org/entity/Q35332> ; <http://www.wikidata.org/prop/direct/P57> ?director .
  ?director rdfs:label ?name .
  ?film rdfs:label ?title .
  FILTER LANGMATCHES(LANG(?title), "EN")
  FILTER LANGMATCHES(LANG(?name),  "EN")
}'
{"?film":"http://www.wikidata.org/entity/Q2992335","?title":"\"Across the Tracks\"@en","?name":"\"Sandy Tung\"@en"},
{"?film":"http://www.wikidata.org/entity/Q770965","?title":"\"Confessions of a Dangerous Mind\"@en","?name":"\"George Clooney\"@en"},
{"?film":"http://www.wikidata.org/entity/Q770965","?title":"\"Confessions of a Dangerous Mind\"@en","?name":"\"George Clooney\"@en-ca"},

etc.

mielvds commented 6 years ago

Seems like the issue is at least related to @hartig 's blazegraph extension

hartig commented 6 years ago

@rubensworks do you have access to the complete stack trace of the exception? From the partial stack trace that you have posted, the issue does not seem to be in the Blazegraph extension but in org.linkeddatafragments.util.MIMEParse.parseMimeType(MIMEParse.java:99). I don't think I have ever touched this part of the code base, and I don't think that parseMimeType is affected by whatever is used as a back-end. I might be wrong of course; I have not looked at this code since ages (and, these days, I don't really have time to investigate :-(

By the way, I think the person who worked on setting up the Wikidata LDF server was @smalyshev

rubensworks commented 6 years ago

The problem is indeed not related to the Blazegraph extension. That specific error was caused by an unrelated problem with invalid accept headers (https://github.com/LinkedDataFragments/Server.Java/issues/47).

Querying does indeed work with the latest released ldf-client. (I was using a development version which appears to have a problem with non-quad representations: https://github.com/LinkedDataFragments/Client.js/blob/feature-qpf-latest/lib/extractors/ControlsExtractor.js#L46-L47, same problem as https://github.com/comunica/comunica/issues/121)

And apparently I had this same dev version linked to the jQuery widget locally, so that is why it didn't work there either.

So all problems were unrelated to Wikidata and its example query, opened a PR for adding it #12.

mielvds commented 6 years ago

Correct, should have looks more at the stacktrace. Apologies @hartig ;)