ad-freiburg / qlever-ui

A user interface for QLever
Apache License 2.0
21 stars 15 forks source link

Optionally complete FILTER clause when selecting variable for literal #21

Open hannahbast opened 4 years ago

hannahbast commented 4 years ago

Consider the following situation:

  1. We are at the position of an object
  2. The top suggestion(s) from the backend are literal(s). For example: "politician"@en, "actor"@en, ...
  3. So far, on top of that, there are variable suggestions. For example: ?label .
  4. When selecting the variable suggestion, the query is extended by exactly the suggested string

Could there be an optional checkbox in the configuration, such that when checked the behaviour in the situation above is as follows:

  1. For each of the "Filter languages" from the configuration (typically only one, say "en") add that language to the variable suggestion. For example: ?label [en] .
  2. When selecting the variable suggestion, extend the query by that variable and the corresponding language filter. For example: ?label . FILTER (LANG(?label) = "en") .

That would be awesome because that is a pretty frequent completion and it would save a lot of keystrokes. It should be configurable, however, as suggested.

Two further remarks:

  1. I am suggesting an abbreviated version in the suggestion (the [en] in the example above) because suggesting the whole construct with FILTER might look too big and ugly. But maybe I'm wrong and it would be fine to suggest exactly the string by which the query is going to be extended.
  2. If it's a problem to have the filter in the same line as the preceding triple, you can also put it in a separate line. But that way, queries become rather long rather quickly. So I have a slight preference right now to put it in the same line. SPARQL, of course, doesn't really care about newlines while the current UI does, but that is a separate issue.