Page MenuHomePhabricator

Fix the "Query is malformed" error in the "EasyQuery" JavaScript gadget on
Closed, ResolvedPublic


To reproduce the problem:

SPARQL-QUERY: queryStr=SELECT ?item ?label ?_image WHERE {
  ?item wdt:P2044 "4 <span class="wb-unit">metre</span>".
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" . 
    ?item rdfs:label ?label
OPTIONAL { ?item wdt:P18 ?_image. }

The code to fix is located in

When you work on this task, you can test the code and your changes by copy-pasting the code into the console (in Inspect element) of your web browser's developer tools. Once your code works as expected, upload your new version as a file into the Phabricator task. @Ladsgroup will review your code there.

Event Timeline

Yurik created this task.Sep 24 2017, 5:29 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 24 2017, 5:29 AM
Aklapper added a subscriber: Ladsgroup.

@Ladsgroup: Could you elaborate where a contributor could find the code base to work on, how to test a potential fix, where to propose such a fix? Thanks!

@Aklapper: The code is:, they can test it by copy-pasting it into console (in Inspect element), if they want to make a change, just copy past the new version here and I will review.

Aklapper renamed this task from EasyQuery gadget: Malformed query to Fix the "Query is malformed" error in the "EasyQuery" JavaScript gadget on 27 2017, 8:56 PM
Aklapper updated the task description. (Show Details)
awight added a subscriber: awight.Nov 29 2017, 6:13 PM

Confirmed that the fact no longer has an ellipsis. I also tried an old revision,

The "triple dot link" is not showing on this Wikimedia page...

Yeah need to install the easy query gadget first, it is in (you can copy-paste it in the console or enable it in gadget section in your preferences)

rafidaslam added a subscriber: rafidaslam.

Claimed on gci

rafidaslam added a comment.EditedDec 1 2017, 5:18 PM

Here's the patched code:

Could you test it @Ladsgroup ?

When running your snippet in console, I get "org.openrdf.query.MalformedQueryException: Encountered " <STRING_LITERAL2> "\"Commons category\" "" at line 2, column 26." (link to query)

rafidaslam added a comment.EditedDec 2 2017, 2:18 AM

@Ladsgroup have you disabled the gadget (EasyQuery) first at your Wikidata account? I had the same problem before, it seems like caused by jQuery catched the wrong element when there are 2 3 dots buttons

Yes, you're right, Overall it's better to select based on class and id so nothing like this happens and it selects from the right element regardless of changes, but that can happen later.

Ladsgroup closed this task as Resolved.Dec 2 2017, 3:20 PM

I think so +1