Page MenuHomePhabricator

Add autocompletion to the SPARQL ui to allow entering items by typing their label
Closed, ResolvedPublic

Description

This should be possible with the Show hint addon of codemirror. If a wd: or wdt: prefix is entered, the completion should search on Wikidata, if wikibase: is entered.

Event Timeline

Bene created this task.Jun 8 2015, 11:14 AM
Bene updated the task description. (Show Details)
Bene raised the priority of this task from to Needs Triage.
Bene added a project: Wikidata-Query-Service.
Bene added a subscriber: Bene.
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 8 2015, 11:14 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Smalyshev set Security to None.
Smalyshev moved this task from Needs triage to WDQS on the Discovery board.
Lydia_Pintscher moved this task from incoming to monitoring on the Wikidata board.Jun 10 2015, 6:36 AM
Bene awarded a token.Jun 16 2015, 4:44 PM
Bene added a comment.Jun 16 2015, 5:36 PM

This should be split into two parts:

One suggestor should handle general SPARQL keywords (and would therefore be reusable in a broad context). Ultimately the first suggestor could automatically read the PREFIX annotations and show them to the user as well. Also variables which have been used already might be suggested if the user types ? or $.

The second suggestor would contain the Wikidata-specific stuff and add autocompletion based on IRIs to wikidata.org and wikiba.se. At first, it makes sense to support only English labels and aliases but it would be nice if the interface language could be changed to be able to search in other languages as well.

Bene triaged this task as Low priority.Jul 29 2015, 1:16 PM
Jonas added subscribers: johl, JanZerebecki.

Change 246697 had a related patch set uploaded (by Jonas Kress (WMDE)):
Code completion for Wikidata prefixes in SPARQL

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

Change 246893 had a related patch set uploaded (by JanZerebecki):
Code completion for Wikidata entities in SPARQL

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

Change 246697 abandoned by JanZerebecki:
Code completion for Wikidata entities in SPARQL

Reason:
Wrong repo, moved to https://gerrit.wikimedia.org/r/#/c/246893/ .

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

This is pretty cool!

Some UI nitpicks: there is an un-intuitive part that you have to have prefixes defined in order for it to work. It'd be nice to have some feedback or help somewhere about how it should work. As I understand, you have to:

  • Have prefixes in the editor window
  • Type the prefix (e.g. wd:) and optionally part of the label
  • Press Ctrl-Space
  • Continue typing the label

It is also not obvious that if you press Ctrl-Space right after prefix, even though nothing visible happens you can continue typing the label and it will start completing. It may be better to show something to indicate completion is now active.

Hey thanks for your feedback!
I also think it would be good to have some user help function to explain how it works.

This is pretty cool!

  • Have prefixes in the editor window

We decided to parse the prefixes, because someone could rename them and we didn't want to have them hard coded in the hinting plugin.

  • Type the prefix (e.g. wd:) and optionally part of the label

wbsearchentites unfortunately doesn't work with empty search strings

Change 246893 merged by jenkins-bot:
Code completion for Wikidata entities in SPARQL

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

Jonas updated the task description. (Show Details)Oct 20 2015, 7:50 PM
Jonas closed this task as Resolved.