Page MenuHomePhabricator

Suggestions for auto completion suggestions
Closed, ResolvedPublic

Description

The query service interface has autocomplete suggestions accessible via Ctrl-Space. One of these is the following

SELECT * WHERE {

}

This is useful, but not quite enough to avoid a lot of repetitiveness in typing out queries. Here are some other code blocks which I find myself typing quite frequently, which I think would be useful as suggestions:

SELECT ?item ?itemLabel WHERE {
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
#defaultView:Graph
SELECT ?s ?sLabel ?t ?tLabel WHERE {
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
SELECT (COUNT( * ) AS ?count) WHERE {
  
}
SELECT ?item ?itemLabel (COUNT( ?i ) AS ?count) WHERE {
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} GROUP BY ?item ?itemLabel ORDER BY DESC ( ?count )

Some other more general suggestions:

wdt:P31 / wdt:P279*
prov:wasDerivedFrom / pr:P248
FILTER EXISTS {
  
}

Event Timeline

Restricted Application added projects: Wikidata, Discovery. · View Herald TranscriptJul 12 2017, 12:49 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

We could add some auto completion here:
Source Code

Some of them would better fit here T165727: Query Examples - boilerplate queries section

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptJul 12 2017, 8:55 AM

Another suggestion: When ?x is declared as a variable, ?xLabel should be on the list of suggestions for variable names.

@Yair_rand Is the issue been resolved? If not, I would like to work on this. Please guide me from where to start. I am new to MediaWiki.

Hi @Diwanshu885, thanks for your interest! Do you have a specific question (please read and follow https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker#Suggested_reading ), and can you also clarify what is unclear with the task description and comments? Thanks!

@Aklapper Do I need to add the code blocks mentioned in the description in this file "https://phabricator.wikimedia.org/diffusion/WDQG/browse/master/wikibase/queryService/ui/editor/hint/Sparql.js
Or something else is required? Please guide!

@Diwanshu885: That is up to you to find out, test, and verify, I would say. :)

Change 637417 had a related patch set uploaded (by Shubham656jain; owner: Shubham656jain):
[wikidata/query/gui@master] ADD autocompletion suggestion in Sparql.js

https://gerrit.wikimedia.org/r/637417

@Aklapper @Jonas I have released a patch. Please review if it any modifications are required. Thanks!

@Shubham656jain: I am not a developer, and @Jonas is not an active account.

@Aklapper Can you tell me who should I ask for review as the I cannot see the author's name @Yair_rand in gerrit's Add reviewer options?

Change 637417 merged by jenkins-bot:
[wikidata/query/gui@master] ADD autocompletion suggestion in Sparql.js

https://gerrit.wikimedia.org/r/637417

Change 637689 had a related patch set uploaded (by Shubham656jain; owner: Shubham656jain):
[wikidata/query/gui@master] ADD autocompletion suggestion in Sparql.js

https://gerrit.wikimedia.org/r/637689

Change 637689 abandoned by Shubham656jain:
[wikidata/query/gui@master] ADD autocompletion suggestion in Sparql.js

Reason:

https://gerrit.wikimedia.org/r/637689

@Shubham656jain: Hi, all related patches in Gerrit have been merged or abandoned. Is there more to do in this task? Asking as you are set as task assignee. Thanks in advance! (You can change the task status via Add Action...Change Status in the dropdown menu.)

@Aklapper Hi! I don't seem to find any more queries to add in this task.

Hi @Shubham656jain: Thanks for the quick reply! Does that mean this task is complete and should be closed? If yes then please feel free to do so.
If you think that this task is not complete and you don't plan to further work on this task, it would be good to reset the assignee.

Shubham656jain removed Shubham656jain as the assignee of this task.Mon, Nov 23, 12:32 PM
Shubham656jain added a subscriber: Shubham656jain.
Lucas_Werkmeister_WMDE closed this task as Resolved.Mon, Nov 23, 12:44 PM
Lucas_Werkmeister_WMDE assigned this task to Shubham656jain.

I think we can close this – otherwise it’ll be one of those tasks that stay open forever because there are no clear criteria for when to close them.