Wikidata talk:Query Builder

From Wikidata
Jump to navigation Jump to search

Questions[edit]

Here are the questions that you can use in order to give feedback about the Simple query builder presentation:

  • Do you think that such a tool is useful for simple  maintenance tasks?
  • If you are not very experienced with SPARQL, can you imagine using a tool like this?
  • Do you think that groups like GLAM institutions would be helped with such an interface?
  • Are there functions that might not be useful in the suggestion? Are there functions that might be helpful to add (please keep in mind, it should be a beginner tool, though)

Answers[edit]

You can answer the questions above here.

  • I have a modest amount of query experience now but I did struggle with the use cases represented by MINUS and UNION early on (and I found it very hard to find examples that use these functions when I didn't know what they were called). I think this tool would be very helpful. - PKM (talk) 21:09, 6 April 2020 (UTC)Reply[reply]
  • I'm the author of VizQuery, which seems to have the same goals as this idea (and is a working tool, not just mockup). I would definitely take a look there to see what works and what doesn't. Note also that VizQuery actually syncs with SPARQL code. It's not that hard if you only do some simple queries. Husky (talk) 19:28, 8 April 2020 (UTC)Reply[reply]
  • I think this would be very useful for beginners. I can think of many features but I guess this would make it too complex very soon. But maybe one thing: A checkbox to also return objects lower in the hierarchy, so if I say "instance of fictional character" it will also return "instance of movie character". -- Discostu (talk) 09:33, 22 April 2020 (UTC)Reply[reply]
  • About recursion: Thanks for working on this builder! I'm thinking that most queries don't require wdt:P31, wdt:P279 or wdt:P131, but wdt:P31/wdt:P131*, wdt:P279+ or wdt:P131+, to return the complete/correct/expected results, and often people don't get all the results they need because they're not aware of this. I think the possibility of specifying recursive properties may be critical for people to use the builder; it's great that it's easy to use, but if it's too limited to be able to return complete results, it's likely that this builder won't be used very often. Adding an explicit recursion-related option (for example, a checkbox per property, or a more sophisticated feature) to this builder could be the ultimate solution to the problems of people who don't know they need recursion or are unaware that such a thing exists. If you want me to elaborate a little more, please feel free to let me know. --abián 12:28, 24 April 2020 (UTC)Reply[reply]
  • It's a really good idea. Learning SPARQL takes time, and it's probably not easy to lear for people that are not already in computing. Having the ability to generate SPQARL has many advantages. Not only it enables to interoperate with other tools that uses SPARQL, like listeria, but it also enable people to go further and learn SPARQL if needed. It would be a good idea to have a link to a page linking to SPAQRL tutorials in this tool. I also wonder about the limitations of the tool. For instance there aren't any wireframe showing the ability to get more information (OPTION in sparql) about the item founds. This could be useful too. Without that it still seems very useful for maintenance task. For instance I barely know SPARQL and I could use a tool like that as I don't know yet how to automate editions either. As I'm not involved in GLAM I can't comment on that part. As for useful functions, beside adding result fields (like pictures or properties), it would be nice to be able to easily interoperate both ways with certain tools like listeria that are used in wikis like Wikipedia. This means that you could edit a list with that tool, which means that you would need to implement the parsing of SPARQL in the tool to be able to create a graphic version of it. The issue is how to deal with more complicated queries. If the tool is too limited and that people rely on it, then it might create issues were people are expecting to be able to edit a query but can't. Also it would be really nice for the tool to also be able to work without requiring to run JavaScript from remote servers, which practically speaking is a somewhat sandboxed arbitrary execution of code. Users shall not be forced to run code (with desktop applications they choose to run code by manually running it, and with server side applications, the server runs the code). The same applies to the interface for editing properties though. GNUtoo (talk) 21:40, 7 May 2020 (UTC)Reply[reply]
  • It seems easier to get started with than Query Helper indeed. How about building upon Husky's great VizQuery? I totally agree with abi that a tool must show subclasses too, see https://opendata.stackexchange.com/questions/9591/how-to-include-sub-classes-in-a-wikidata-sparql-query-example-when-querying/9743 Even if it means that we must create new database indices or caches, we should do it. Syced (talk) 05:54, 8 May 2020 (UTC)Reply[reply]

Qualifyer[edit]

What would it be like to show the qualifyer of a proprerty ? Bouzinac (talk) 13:47, 8 May 2020 (UTC)Reply[reply]

This is something what were great if this is possible. As far as I know it is not so easy to integrate it in such a tool. Maybe it is possible to collect some usecases were qualifiers are needed and then create something like a configurator out of it to make it possible to find the right query for that usecase. I think there are a lot of query examples and out of them the most cases can be answered.--Hogü-456 (talk) 19:52, 8 May 2020 (UTC)Reply[reply]
Yeah as Hogü-456 said this is not trivial. It'd be very useful to get some examples where it'd be needed. It's unlikely we can make it work in the first versions though. --Lydia Pintscher (WMDE) (talk) 10:24, 31 May 2020 (UTC)Reply[reply]

Sex or gender is a difficult example[edit]

The wireframe example starts by showcasing search for "sex or gender". I suggest removing this complicated property from the wireframe example. The more prominent we make this the more complaints we get. The modeling challenges are out of scope of this tool but if anyone wants to join then develop

Blue Rasberry (talk) 22:44, 8 May 2020 (UTC)Reply[reply]

Query storage[edit]

This tool promises personal query storage as a feature. Instead of personal storage, I wish there were an easy path to public sharing. I do not anticipate that many new users would want personal storage, and experienced users would either have their own storage system or think to do things like share queries.

For example, if a group wanted to share a query with lots of people, I wish they could store that query somewhere and share it with a short link. Blue Rasberry (talk) 22:49, 8 May 2020 (UTC)Reply[reply]

I would prefer having some storage feature over saving queries as bookmark. Combined with the global account, that would be great. --Elya (talk) 16:23, 13 May 2020 (UTC)Reply[reply]
Yeah this is unlikely to make it into the first versions. Let's keep it in mind for later then. Elya: It'd be great to hear from you what you'd use it for. --Lydia Pintscher (WMDE) (talk) 10:26, 31 May 2020 (UTC)Reply[reply]

Adding Comments to sparql queries[edit]

In the SPARQL beginner's tutorial http://wiki.bitplan.com/index.php/SPARQL#Query_Examples section you'll find a few queries I created in the past few months. The style of the queries is to have comment lines embedded and a "try it!" button at the end.

Creating this style of queries is tedious with the current editor since the comments are not automatically created and the try it needs to be created from the url. It would be great if the full wiki markup could be created within the tool or better even if a template could be selected supporting different styles so that the result can be used in different environments to document the query and link back to the query endpoint/editor. WolfgangFahl (talk) 06:07, 10 May 2020 (UTC)Reply[reply]

Example:

# Find World wide whisky distilleries using the Wikidata Query service
# taken from
# http://wiki.bitplan.com/index.php/SPARQL#Whisky_Distilleries_worldwide
# Created 2018-01 by Wolfgang Fahl BITPlan GmbH
# 
# display the results as a map
#defaultView:Map
#
# select the distillery and its coordinates
SELECT ?distillery ?coord 
WHERE 
{
  # any subject
  # which is an instance of
  # https://www.wikidata.org/wiki/Property:P31
  # Whisky distillery
  # https://www.wikidata.org/wiki/Q10373548
  ?distillery wdt:P31 wd:Q10373548.
  # get the coordinate location value for any found distillery
  # https://www.wikidata.org/wiki/Property:P625
  ?distillery wdt:P625 ?coord.
}

try it!

Thank you. So do I understand that you'd like to have an easy way to create a wiki text snippet so you can easily post it on-wiki? --Lydia Pintscher (WMDE) (talk) 10:28, 31 May 2020 (UTC)Reply[reply]
I think it's more that adding comments to the SPARQL, fullstop, would make it more comprehensible; nothing to do with posting it anywhere, merely explaining it within the body of the query. --Tagishsimon (talk) 17:15, 17 August 2021 (UTC)Reply[reply]

Simple Query Builder: wrap-up of the feedback loop and next steps[edit]

Hello all,

@PKM, Husky, Discostu, Abián, GNUtoo, Syced: @Bouzinac, Bluerasberry, WolfgangFahl, VIGNERON, Pasleim, ArthurPSmith: @Sadads, GZWDer, Edoderoo, MichaelSchoenitzer, Daniel Mietchen:

Thank you very much for taking time to have a look at the screenshots and providing useful feedback and suggestions.

Here are some of the things that particularly caught our attention:

  • Your suggestions regarding features that should be part of the Simple Query Builder: minus, union, browsing several levels of instance of/subclass of, querying the existence or not of an article on Wikipedias
  • The existing documentation and tutorials definitely deserve some love
  • Plenty of people agreed that the examples list needs a new sorting method, and to display more explicitly the features used by the queries
  • Existing tools like Vizquery
  • Suggestions for improvements in the SPARQL-typing interface (more tooltips, better comments, etc.)


Now, how are we moving forward with this project? Because we have limited time and resources, we decided to focus on one of the two projects that we presented: the Simple Query Builder. In the next few months, we are going to work on a prototype for a new interface that will hopefully help people who have no prior skills in SPARQL to build some of the queries that they need, especially for maintenance purposes. We will post more information here and will keep you in the loop at different stages of the project.

We are currently working on the first version of the prototype of the Simple Query Builder, and in order to make sure that we are going in the right direction, we would need your feedback again. We would like to run testing sessions where you can try the prototype, and we would observe how you interact with the interface and hear your feedback on what are the areas where we could improve it.

These interviews would take place online, on the chat platform of your choice (e.g. Jitsi, Google Meet, Skype… as long as you can share your screen). We would book a 60 min slot with you to make sure that we have enough time to discuss. The appointments for these sessions will take place until June 20th, and the timing will be decided according to your availability and the UX designer’s availability as well.

If you’re interested, you can add a comment under this message and we will contact you using the email feature, or you can send directly an email to our UX designer Mattia at mattia.capozzi@wikimedia.de.

For these interviews, we are especially looking for people that have a solid understanding of Wikidata’s data model but that don’t necessarily have a lot of experience with using SPARQL. Reason being that the future interface will be targeted to newcomers. If you’re already feeling pretty confident with building queries in SPARQL, you can help us by sharing this message with people that you know who may make use of a simple query builder. This will be very helpful!


Note: the fact that we focus on the Simple Query Builder interface doesn’t mean that the ideas for improvements of the examples list will be abandoned, but we believe that some of these changes, for example a better structure and naming of the examples, can already be done by the community without intervention of the development team. Unfortunately, I won't have time to start this process myself, but it would be awesome if some of you could bring the discussion to the community and make a plan to reorganize the queries.

If you have any questions or suggestions, please let us know. Cheers, Lea Lacroix (WMDE) (talk) 08:10, 4 June 2020 (UTC)Reply[reply]

Feel free to contact me :-) Syced (talk) 15:26, 5 June 2020 (UTC)Reply[reply]
Please keep me in the loop: WolfgangFahl (talk) 13:18, 10 June 2020 (UTC)Reply[reply]

Feedback[edit]

I like the prototype and would likely use it. I think per default the list of items should not only show the name of the item but also the description of the item. It's worth thinking about also providing a thumbnail of icon or image of the item in front of the name of the item.

It's not clear to me why there's a show in SPARQL link and a show in Query Service link. I would expect to see the SPARQL of the query when I click show in Query Service.

I think item/property selection should use the interface that's already existing in the page of items to add statements and not introduce a new one.

I personally consider links to be superior to managing repeated use of the same query. Links allow sharing with other people and the user can also save links in his bookmarks/userpage. I don't think the interface to store queries is needed but I also don't think it's a huge issue to add it. ChristianKl❫ 08:43, 4 June 2020 (UTC)Reply[reply]

Thanks for your feedback!
About displaying descriptions and pictures: we want to make sure that the results obtained from the Simple Query Builder don't differ too much from the SPARQL interface. We also need to be careful that integrating labels, descriptions and pictures by default would not lead to queries timing out.
We're still working on different possibilities to integrate the Simple Query Builder and the existing interface together, nothing is set for now.
We decided that we would not work on storing queries for now, so links will stay the main way to save and share queries. Lea Lacroix (WMDE) (talk) 08:19, 8 June 2020 (UTC)Reply[reply]

Feedback (June 6/Jura1)[edit]

This is unrelated to the prototype.

Personally, I had found the various lookups (for items and properties, but also the code snippets) available at https://query.wikidata.org/ most helpful to (learn to) write queries. I'd tend to add more there. Together with samples queries and occasional help from specialists, I think one can get quite far. --- Jura 14:04, 6 June 2020 (UTC)Reply[reply]

Rank[edit]

We should introduce a rank selector.--GZWDer (talk) 14:09, 12 August 2020 (UTC)Reply[reply]

Hi,
What would you imagine exactly? A possibility to switch between truthy and full data? Or the possibility to select the wished rank for each statement?
The SQB is not intended to replace the existing SPARQL interface, and is targetted at people having small experience with Wikidata and SPARQL, who have relatively simple queries in mind. Do you imagine a usecase where such a person would need to query ranks? Lea Lacroix (WMDE) (talk) 15:12, 13 August 2020 (UTC)Reply[reply]
A Truthy tickbox, either per clause, or covering all clauses in the query, perhaps? Or (and perhaps better?) default to wdt: predicates and provide 'irrespective of rank' tickboxes. --Tagishsimon (talk) 16:56, 17 August 2021 (UTC)Reply[reply]

Possible feature[edit]

  • Store a SQB query as JSON (instead of SPARQL), as the conversion from SQB to SPARQL is one way
  • Execute some SQB query via ElasticSearch instead of SPARQL (this is usually faster if only limited results are returned). Not all SQB query can be executed via ElasticSearch, so interface should indicate which can be executed.

--GZWDer (talk) 14:13, 12 August 2020 (UTC)Reply[reply]

We are currently exploring a way to redirect or rewrite some queries on the WDQS end and then for example serve them from Elastic. That would be considerably more impactful because it'd work for anyone instead of just the people going through the query builder. And on top pf that if that works out the user wouldn't even notice. fingerscrossed... --Lydia Pintscher (WMDE) (talk) 10:53, 13 August 2020 (UTC)Reply[reply]

Integrate Query Builder into Wikidata Repo[edit]

It would be a good way to save queries, cache the results, and even query the queries. Can be used later for result transclusion into other projects, or to highlight collections of data.--DataAthlete (talk) 10:05, 23 August 2020 (UTC)Reply[reply]

Hi, thanks for your suggestion!
Storing and manipulating the queries is quite a different feature from what is aimed by the Simple Query Builder, which is easing the process of writing a query for people who are not very familiar with SPARQL. However, this could be imagined for other or existing tools in the future. Lea Lacroix (WMDE) (talk) 09:26, 28 August 2020 (UTC)Reply[reply]

Test system for the Simple Query Builder[edit]

Hello all,

On https://query-builder-test.toolforge.org you can find a test system for the Simple Query Builder. Please note that this is far from a final version, it doesn't include all of the planned features. We generally want to work with a very simple query, and then improve it by adding more features.

For example, at the moment, the only available property is postal code, and you cannot add anything else than the value.

This page should be use to follow the work of the development team, and should not be considered as a final prototype. Because people are actively working on it, its appearance will change with time, some days it will be partially broken, etc. However, we hope that it can already give you a sneak peak on the interface of the future Simple Query Builder.

If you have any feedback, or questions, feel free to write here! Lea Lacroix (WMDE) (talk) 13:51, 2 November 2020 (UTC)Reply[reply]

Add checkbox for getting the count of results rather than the results themselves[edit]

For example, if I want to know how many video games on Windows that Wikidata has, rather than getting a list of them.

This tool is really coming along! Thanks for your work on this. I'm fairly fluent in SPARQL, but it will probably save me a lot of time in the future when I want to make queries :D Nicereddy (talk) 01:56, 3 February 2021 (UTC)Reply[reply]

Thanks for your feedback! The possibility to count results is not included in the first version of the Query Builder. It may be added in the distant future :) Lea Lacroix (WMDE) (talk) 09:33, 3 February 2021 (UTC)Reply[reply]

Wildcard search and others[edit]

A great tool, thanks.

  • I need a wildcard search for label, description and alias.
  • I need a search for mistakes. Mistakes are shown by an exclamation mark at the wrong value in the web interface.

Greetings--Z thomas (talk) 07:25, 6 February 2021 (UTC)Reply[reply]

I guess I need logical operators
example "people born between 1978 and 1985" - - Z thomas (talk) 10:04, 6 February 2021 (UTC)Reply[reply]
Hello @Z thomas: and thanks for your suggestions!
  • It is not planned to add wildcards for now in the Simple Query Builder - however, similar things exist on query.wikidata.org.
  • The mistakes that you mention are called constraint violations, and they cannot be queried yet in the Simple Query Builder. They may be at some point, but not in the first version of the tool.
  • Logical operators can already be used in the SQB. However, the datatype date is not implemented yet, but will be soon. Lea Lacroix (WMDE) (talk) 13:29, 8 February 2021 (UTC)Reply[reply]
Hi @Lea Lacroix (WMDE): thanks for you answer.
  • Is there a reason why you don't want to add wildcard search? especially for free text (like description) it is useful
  • At the moment there are only three logical operators "matching", "without" and "regardless of the value". What about "bigger", "equal", "equal or smaller"...? (Useful if you search things like "All towers in Germany bigger than 100 metres")
  • How can I search for sitelinks? ("All things in a town without a commonssitelink")
Greetings --Z thomas (talk) 13:53, 8 February 2021 (UTC)Reply[reply]
Yes, these operators will be available once the datatypes date and quantity are available. Sitelinks are not included yet, and may be in the future. Lea Lacroix (WMDE) (talk) 11:42, 10 February 2021 (UTC)Reply[reply]

Show ID-Only[edit]

Hello,

I think it were helpful if there is a notice to tell user how users can extraxt the item ID like Q42 out of the URL to the Item after downloading the results. In Spreadsheets this is possible with a function called MID in English and TEIL in German. It is also possible in SPARQL as far as I know but from my point of view it is better to do it after downloading after it helps to reduce the servers needed for executing the queries. --Hogü-456 (talk) 19:33, 7 February 2021 (UTC)Reply[reply]

It seems that extracting the ID out of the URL after downloading the result is already part of the next step, cleaning/reusing the data. We don't think we should give indications about this step on the interface of the Simple Query Builder, that should remain light and simple. On top of that, depending on their goal, people may have different needs: use the full URL, extract ID, extract something else, and we cannot guess and address all of the possible needs. Lea Lacroix (WMDE) (talk) 13:32, 8 February 2021 (UTC)Reply[reply]

Query Builder update - February 2020[edit]

Hello all,

This is a short update related to the development of the Query Builder. We are still working on adding the features listed here, and you can see the latest improvements on the test system. (usual disclaimer: the test system doesn’t represent the final state of the tool, it can be temporarily broken while we’re working on it, etc.)

The main change compared to the last update in November 2020 is that you can now build some meaningful queries on the test system. For example, you can:

  • Query for any property (supported data types: string, Item, external identifier) with or without a specific value
  • Add or remove query conditions conditions
  • Include results from subclasses when querying for Item values
  • Having multiple query conditions and connecting them via AND as well as OR
  • See the interface of the Query Builder in several languages by adding ?uselang= to the URL (example - Translatewiki page)
  • Show IDs instead of labels in the results (to prevent timeouts)
  • Add a limit to the number of results (to prevent timeouts)
  • Execute and show the result of a query
  • Show the query in the Wikidata Query Service

Some more features are under development but not yet implemented, for example the ability to filter by the presence of references, or querying for dates and coordinates.

If you have any questions or feedback regarding the test system, please let us know. We’re especially interested in your feedback if you try to build your usual maintenance queries with the Query Builder, and let us know if any feature is missing to achieve what you want.

We will keep you updated here about the next steps of development. Cheers, Lea Lacroix (WMDE) (talk) 09:58, 8 February 2021 (UTC)Reply[reply]

Filtering by a lack of label or description in a given language?[edit]

It's typically useful for my maintenance work to be able to write a query like "all video games with an Internet Game Database ID and no label" to find items that can be easily improved, but it doesn't look like the Query Builder has any support for filtering on labels or descriptions. Is that something that's been considered? -Nicereddy (talk) 02:28, 11 February 2021 (UTC)Reply[reply]

Thanks a lot for your feedback! Filtering labels, descriptions or aliases will not be part of the first version of the Simple Query Builder, but we can definitely evaluate this suggestion it for future versions. Lea Lacroix (WMDE) (talk) 15:31, 12 February 2021 (UTC)Reply[reply]

Language of the query builder[edit]

Hello, is the translation of the future tool into a given language taken into (far away/short time) account? Thanks! --Bouzinac💬✒️💛 13:50, 18 February 2021 (UTC)Reply[reply]

Sorry, didn't see the "?uselang=fr" trick. Might be useful to be put somewhere (flag icon eg) good work anyway ! --Bouzinac💬✒️💛 13:52, 18 February 2021 (UTC)Reply[reply]
Indeed, for now it only works with the change in the URL, we're still working on integrating the default language switch menu. Lea Lacroix (WMDE) (talk) 09:49, 1 March 2021 (UTC)Reply[reply]
+1 for adding the language button (and congrats for the tool!) TiagoLubiana (talk) 19:03, 17 August 2021 (UTC)Reply[reply]

Good job![edit]

I'm opening this section to say that I really like the concept and how the interface is coming along, and I'm also glad that the community's suggestions have been taken into account.

As new suggestions:

  • the without-without option may not make sense, the second "without" probably shouldn't be an option when the first "without" is selected;
  • the checkbox for including values from subclasses probably shouldn't appear when the value is not a class, that is, when it doesn't have a subclass of (P279) statement. I'm aware that implementing this condition may take some work, but I think it's important considering that (a) the checkbox is ticked by default, which is ideal but only when the value is a class; and (b) when the value isn't a class, this option can be confused with the other common form of recursion, that which applies directly to the Property (e.g. with located in the administrative territorial entity (P131)).

Good job! --abián 14:12, 28 February 2021 (UTC)Reply[reply]

Hey @Abián:, thanks a lot for your feedback and your suggestions! We're currently talking about them, and I'll come back to you as soon as I have news. Lea Lacroix (WMDE) (talk) 13:50, 2 March 2021 (UTC)Reply[reply]

Comments about Query Builder[edit]

Dear Wikidata Development Team,

I thank you for working on Wikidata Query Builder that can enhance access to the features of the Wikidata Query Service by beginners. I was impressed by the outstanding contribution you have done to this project and I look forward to seeing a surprisingly excellent final output. However, I will appreciate if several comments can be taken into consideration:

  • Aggregate functions: It will be excellent if a drop-down list can be added before each line indicating the user would like to have a list of items or just their counts or sum. Such a drop-down list is easy to do as the number of aggregate functions in SPARQL is limited (https://en.wikibooks.org/wiki/SPARQL/Aggregate_functions). The trick here is to add a GROUP BY statement to the end of the code where you put variables other than the aggregated one together.
  • Timeout error: To prevent timeout error, I propose to put the statement requiring more time to process in an independent query under WITH clause. By that, the speed of the queries can be easily enhanced.
  • OR Statements: UNION can be used to state that ?x can be the result of statement 1 or statement 2.
  • Visualization Type: Allowing the users to choose their default mode of visualization is easy and can be useful.
  • Allowing Sorting: ORDER BY can be used to rank the results according to a given variable. Adding this feature to the Wikidata Query Builder is interesting for users.
  • Operators and Functions: Allowing users to use >, <, =, != and other mathematical operators can let users comfortable in dealing with Statistical Wikidata Properties. String functions like CONTAINS can be important for users to process the Wikidata statements having a string as an object. I know that this is difficult to develop in practice. However, Property Types can serve for letting such an upgrade significantly possible in the short run.

I did not evocate the other comments that have been discussed such as the label extraction as I tried to be brief and deal with the issues that are not raised before.

Yours Sincerely,

--Csisc (talk) 14:58, 22 March 2021 (UTC)Reply[reply]

Thanks for testing the Query Builder and thanks for your feedback! Your ideas are very valuable, but we will not be able to implement them in the first version of the Query Builder.
  • Aggregate functions: seems really interesting, unfortunately out of the scope of the first version of the tool
  • Timeout error and OR Statements: I created a ticket combining these two, in an attempt to optimize the queries behind the tool
  • Visualization Type: it is already possible by changing the view in the left side menu on the result, therefore we decided not to include it in the Query Builder interface
  • Allowing Sorting: as above, this feature is already partially available in the result view, by order the columns, therefore we didn't include it yet
  • Operators and Functions: this is already too complex for what we're trying to achieve with the Query Builder - not all queries can be build with it, at some point people need to switch to SPARQL or another query tool.
Thanks, Lea Lacroix (WMDE) (talk) 11:27, 12 April 2021 (UTC)Reply[reply]

Find a person based on label and date of birth?[edit]

As our names of humans are predominantly in the label or also known as fields, and not reliably in the respective name property components, how would one use query builder to search based on label or even part of the description?  — billinghurst sDrewth 05:06, 27 March 2021 (UTC)Reply[reply]

Thanks for your question. In general, the Wikidata Query Service is not the right tool for that as search within text strings, because Blazegraph is not optimized for that. Elastic search with the special WB keywords is much better for this. Therefore, we don't plan to integrate this feature in the Query Builder. Lea Lacroix (WMDE) (talk) 14:57, 29 March 2021 (UTC)Reply[reply]

Query Builder update - May 2021[edit]

Hi everyone,

This is to give a quick update about recent developments that were made to the Query Builder since February of this year.

It is now possible to query for dates and for events that occurred on either of given two or three dates.

We’re also looking into making the Query Builder accessible from the Wikidata Query Service so users can actually discover the Query Builder in the future. This stage is currently awaiting a security review of the code at WMF this quarter after which it will be deployed as a subpage of query.wikidata.org.

Finally, we conducted testing sessions and incorporated feedback from users with varying levels of experience to see how they are using the Query Builder including people with visual impairments and RTL languages.

Note that this is still a test system and some features may malfunction. Please try the prototype at query-builder-test.toolforge.org if you haven’t done so already, and do not hesitate to let us know if you encounter any issues or discover other needs that you think have not yet been covered.

Thanks,

-Mohammed Sadat (WMDE) (talk) 11:41, 10 May 2021 (UTC)Reply[reply]

Show the query in the Wikidata Query Service[edit]

great job! would it be possible to show query without actually running it? currently it has no query in WQS link before pressing "Run query". i could think of several use-cases:

  • i want to make query skeleton in builder and further develop it in WQS. i know that my skeleton query will timeout (like "get all people in Wikidata") and i don't want to put unnecessary load on server for a query i actually don't want to run.
  • i want to learn sparql - i change some bit in builder and see how query changes. currently it doesn't have too much buttons etc., but anyway :)
    • what would be better for this - some textarea/simple section for (automatically updated) generated query in builder itself, but that's out of scope, i guess.

--Edgars2007 (talk) 07:08, 18 August 2021 (UTC)Reply[reply]

Thank you for the suggestion. I've created a ticket for it: phab:T289419. --Lydia Pintscher (WMDE) (talk) 10:49, 22 August 2021 (UTC)Reply[reply]

Wishlist[edit]

It's been my first try with Query Builder and I don't know Sparql. My feedback:

  • Timeout: My usual queries (including up to 10,000 results) work well. Of course it timed-out with much larger searches but that's normal.
  • Labels: I always get labels back in one language. But some times what I really need to know is the item's label in two or three languages to compare them, or even just the number of labels of an item. I guess it's difficult but it would be great.
  • Maps: Also difficult, but they are great to spot inconsistent elements in a group.

I'm enjoying this tool a lot and looking forward to seeing it improved. Great job!

B25es (talk) 07:20, 18 August 2021 (UTC)Reply[reply]

Thank you! I opened a ticket for the label request here: T289420.
Can you clarify what you would like to see changed wrt maps? Lydia Pintscher (WMDE) (talk) 10:52, 22 August 2021 (UTC)Reply[reply]

Lydia Pintscher (WMDE) Thanks a lot for label ticket. As for maps, when I use Wikidata Query Builder I only see five result presentation options: Table, Graph builder, Tree, Dimensions, and Graph. When using Wikidata Query Service several other options appear, Map and some others. B25es (talk) 14:44, 24 August 2021 (UTC)Reply[reply]

Ahhhh got it! Ok so the embedded results view we are using here is smart. There are no coordinates in the query result so it does not offer displaying the data on a map. The same thing happens in the query service. There it grays out the map option if no coordinates are in the result. So this will be solved once we can add coordinates to the result view. -- Lydia Pintscher (WMDE) (talk) 15:13, 24 August 2021 (UTC)Reply[reply]

First impressions[edit]

Hey, first of all congratulations to finally deploying this. This will be a huge boon to everyone who wants to get into the depths of Wikidata queries but doesn't want to get their hands dirty with SPARQL (and in fair honesty: who does?). A couple of first observations i made assuming i would be a first-time or inexperienced user:

  • I feel that if this is for first-time users, maybe the intro text should be a bit shorter and not mention all the technical details. Maybe give a couple of examples of things you can do with it. I think it's really hard to get started what to query for if you've never done so before. So maybe offer something simple, like 'get all cats' or 'get all Van Gogh paintings'.
  • I'm really pleased that this works so well on mobile. That being said, there are a couple of small UX issues on mobile. The suggestions dropdown (when entering a property) doesn't fit completely on mobile.
  • Great that you're getting a good property suggestion box with descriptions.
  • Is it really necessary to add the wd: prefix to all the item results? I think it mostly confuses people.
  • When searching for property aliases (e.g. 'painter' instead of 'creator') you do see the resulting property, but not why it matched. I think it would be useful to have some kind of indication there ('creator: also known as: painter').
  • I think it would help a lot if there would be a 'Add image if available' option, because it shows you much better how rich the data set on Wikidata is. Imagine being able to see all the cats or Van Gogh paintings i mentioned earlier. See how this works in VizQuery.
  • When coming from a shareable link (e.g. https://w.wiki/3ur$) the property and item are not automatically filled in with their labels, you just see the IDs.
  • An option to see the description for items in the result table would be nice.
  • I love the fact that there's a way to search in the results table.
  • This might be too advanced, and i'm not quite sure how it would be added to the interface, but a way to combine multiple queries would greatly expand the possibilities of the query builder. For example, in VizQuery you are able to do this and build queries like Cities with a female mayor.
  • Agree with B25es that a way to see a map and a way to get multiple language labels would be useful. Also, there really should be a way to switch between different interface languages (given that its already in Translatewiki i'm sure this will be on the roadmap).

Anyway, great start and i'm curious to see how the query builder will be expanded in the following months. Husky (talk) 09:20, 18 August 2021 (UTC)Reply[reply]

Thank you so much for the detailed feedback!
  • About the wd: prefix: We just take the result visualization from the query service for now. Will see what we can do there.
  • Good catch with the alias issue. I have filed phab:T289422 for it.
  • I filed phab:T289423 for showing images if available
  • For the missing labels when opening a query from a shared link I've opened phab:T289424.
  • I opened phab:T289425 to optionally show descriptions for Items in the result set.
  • Switching languages is already possible by adding "?uselang=fr" or similar to the URL. I opened phab:T289426 to make this actually discoverable.
-- Lydia Pintscher (WMDE) (talk) 11:14, 22 August 2021 (UTC)Reply[reply]

Column shortcoming[edit]

Not clear if, or why there is not, an option to display a column for image in this query: https://w.wiki/3uwG

Or an option to show the P131 values for this query: https://w.wiki/3uwL

It's not enough merely to filter on a condition; very often we wish to see the data itself: listed buildings showing their image. Listed buildings showing the administrative area they're in. --Tagishsimon (talk) 12:59, 18 August 2021 (UTC)Reply[reply]

Thanks! We have phab:T289423 and phab:T277646 for these issues. -- Lydia Pintscher (WMDE) (talk) 11:18, 22 August 2021 (UTC)Reply[reply]

A simple and clear way to show items without Wikipedia articles + convert to Listeria list button or instructions[edit]

Hi

It would be really really helpful for me as someone who doesn't know how to use the normal query service (I really tried) is to have a simple way to show which of the items is missing from a specific language or languages Wikipedia article. This would allow me to very easily set up topic specific campigns.

Oh also a button to 'convert this to a listeria list' would be amazing to be able to set up Women in Red style missing article lists.

Thanks

John Cummings (talk) 14:07, 18 August 2021 (UTC)Reply[reply]

So you would like to have a condition "has/does not have article on XXX Wikimedia project? -- Lydia Pintscher (WMDE) (talk) 11:19, 22 August 2021 (UTC)Reply[reply]
Lydia Pintscher (WMDE) thanks very much, I'm not sure of the best way of doing it honestly, as long as its clear that you can do it and how to do that works for me. But yes that would be the information I'd like to find out, also maybe a 'list all wikimedia projects this has a subject for', but maybe that's too fiddly. I just really want an easy way to make redlists both in the tool and on Wikipedia, so something here and then a very clear path to transform this to a listeria list. John Cummings (talk) 12:15, 25 August 2021 (UTC)Reply[reply]
Great. Thanks! :)
I created phab:T289946 for it. Do you have a link to an existing query or listeria list that is close to what you want to create? That might help make it easier to understand for devs in the future. Lydia Pintscher (WMDE) (talk) 16:25, 29 August 2021 (UTC)Reply[reply]
Sorry to miss this before Lydia Pintscher (WMDE) the redlists on Women in Red are a great example, having this function would allow all Wikiprojects to create Wikidata fed lists, especially useful for wikiprojects related to species, e.g lists of all insects without Wikipedia articles. --John Cummings (talk) 11:55, 19 November 2021 (UTC)Reply[reply]

Label language settings? Timeout?[edit]

Where can i set them? What should i do if i get the timeout error? Rtnf (talk) 23:48, 18 August 2021 (UTC)Reply[reply]

You can currently only switch the language of the Query Builder and the results via a URL parameter ("?uselang=fr" etc). We have phab:T289426 to do this properly. If you run into a timeout you can switch off showing the labels, request fewer results or change your query conditions to work on smaller sets of Items. -- Lydia Pintscher (WMDE) (talk) 11:22, 22 August 2021 (UTC)Reply[reply]

good tool[edit]

I hope that the interface can be made multilingual. Afaz (talk) 00:27, 19 August 2021 (UTC)Reply[reply]

Yes! It already is if you add something like "?uselang=fr" to the URL. We have phab:T289426 to make this nicer and less hidden. -- Lydia Pintscher (WMDE) (talk) 11:23, 22 August 2021 (UTC)Reply[reply]

Deprecated values[edit]

Thanks to the developers of this new tool. It will be very useful for people who don't know SPARQL. I have one comment on the design of the fields: There is no defense against statements which are deprecated. For example:

With: Property NKČR AUT ID (P691) ... matching value "ola2008459998" . With and without references (https://w.wiki/3vK7)

produces two results, but one of the item has its value deprecated.

Perhaps you might consider only displaying those with PreferredRank or NormalRank, because these are the results which tend to be desired by people who don't know SPARQL. Vojtěch Dostál (talk) 09:31, 19 August 2021 (UTC)Reply[reply]

Yeah we discussed about this for a long time and ended up with considering all statements because we wanted to focus on supporting maintenance work. We wanted to see what the feedback is to make a better decision once it's out. I'd love to hear what others think about this as well. -- Lydia Pintscher (WMDE) (talk) 11:25, 22 August 2021 (UTC)Reply[reply]

Suggestions[edit]

Thanks for this useful tool, I have a suggestion about something I have needed several times in past: possibility to order articles by subject/feature, examples::

  • All pictures about Virgin Mary - property "depicts" - shown in a timeline or ordered by time to see evolution of styles)
  • All books dealing same topic filtered by author's language

It would be like the possibility of playing with sortable tables in Wikipedia, where user can view results in different orders according to column's values, but in queries presentations and filters. I don't know if it's easy to implement but it would add several real possibilities to queries. --Barcelona (talk) 20:52, 19 August 2021 (UTC)Reply[reply]

Thank you! If you have an example for this somewhere I'd love to see it to get a better idea of how it could look like. -- Lydia Pintscher (WMDE) (talk) 11:26, 22 August 2021 (UTC)Reply[reply]

Suggestion; shareable link doesn't work[edit]

Thank you so much for this tool!! I wanted to do queries in Wikidata, but wasn't able before finding this. Suggestion: let the user add columns beyond item number and label. I have a problem with the shareable link: even though there is a message "URL copied to clipboard!", nothing is copied to my clipboard (Mac OS 11.5.1, Safari 14.1.2). — CvZ (talk) 23:19, 22 August 2021 (UTC)Reply[reply]

Thank you!
For adding columns beyond label and Item ID we have phab:T271296.
Copying in the clipboard: That is weird. Does it work for you on query.wikidata.org when trying to create a sharable link there? We asked someone on the team to try to reproduce it in Safari but it worked for them. Anyone else here who could try it? Lydia Pintscher (WMDE) (talk) 16:28, 29 August 2021 (UTC)Reply[reply]
On query.wikidata.org I can see the short url for a query (used an example query) and copy it.
I subscribed to the Phabricator task so I guess I'll receive updates on its progress (am entirely new to Phab; excited to see what will happen!) — CvZ (talk) 23:04, 29 August 2021 (UTC)Reply[reply]

Feedback from first impressions[edit]

I'm really excited to see this tool, as someone who has tried and failed to figure out SPARQL in the past. Some initial impressions:

  • "Property" did not make sense to me, even with the tooltip.
  • Likewise the "References" box - the tooltip says "You can further narrow your results by only showing statements with or without references" which didn't help me understand what "with references" actually meant.
  • I was puzzled as to what "Regardless of value" meant

But the big thing missing for me was examples. Since I didn't know how to find things to put in the "Property" box I couldn't even start playing with the tool.

I actually hit up this talk page to try and find an example - and found this one: https://w.wiki/3uwL - and suddenly the tool made sense to me! I started experimenting with it and it began to click.

So my suggestion is to add example links to the index page of the tool to help people understand what it does and how to start using it.

--73.189.212.18 22:13, 23 August 2021 (UTC)Reply[reply]

Thank you!
I filed phab:T289947 for the examples.
I will talk to the team about improving the text. Lydia Pintscher (WMDE) (talk) 16:32, 29 August 2021 (UTC)Reply[reply]

Subqueries and Statement nodes[edit]

Query builder makes a really simple query very complex by 1) using subqueries to show labels and 2) using Statement nodes. See for example [1]. This makes it very hard to use it as basis to learn SPARQL, or make minor amendments in "Show query in the Query Service". HenkvD (talk) 09:36, 25 August 2021 (UTC)Reply[reply]

Very good point. I have filed phab:T289948 for this. Lydia Pintscher (WMDE) (talk) 16:36, 29 August 2021 (UTC)Reply[reply]

Can there be a link from the Query Service to the Query Builder?[edit]

Hi

It would be helpful for new users to have a link from the query service to the query builder, please could one be added? Maybe something at the bottom that says 'looking for something more simple? Try the query builder'

Thanks

--John Cummings (talk) 10:14, 25 August 2021 (UTC)Reply[reply]

Yes, absolutely! That will come with phab:T272702. Lydia Pintscher (WMDE) (talk) 16:37, 29 August 2021 (UTC)Reply[reply]

Bug/Error: Unable to find species items with audio files, I get 'Properties with limited support cannot be filtered by value'[edit]

Hi

When I try to find species items with audio files by selection instance of species and property P51 (audio file) I get an error saying 'Properties with limited support cannot be filtered by value'. It would be helpful if there was some more explanation which described how to fix this issue for that property or if this is a simple fix it would be really great if someone could fix it.

Thanks

John Cummings (talk) 10:18, 25 August 2021 (UTC)Reply[reply]

Ah. So right now we don't have full support for some datatypes. This includes the CommonsMedia datatype that you need here. For those datatypes we do support querying for Items that use the Property (so in your case any Item that has a audio file statement) but not specific values (so in your case any Item that has a audio file statement with the value music.mp3).
Were you looking for a specific file or any file? Lydia Pintscher (WMDE) (talk) 16:40, 29 August 2021 (UTC)Reply[reply]

Feature request: Add the data visualisation options from the Query Service[edit]

Hi

I'd really love the data visualisation options from the query service in here, its completely hidden that you can do any kind of data visualisation with query results. If adding data visualisation is not possible currently could a phabricator task be created and also a comment on the page somewhere which mentions you can do data visualisations in the full query service interface.

Thanks very much

--John Cummings (talk) 12:22, 25 August 2021 (UTC)Reply[reply]

Good point. We need to solve phab:T271296 to make this possible. Lydia Pintscher (WMDE) (talk) 16:42, 29 August 2021 (UTC)Reply[reply]

Underwhelming[edit]

I found this tool at a HackerNews discussion (see post) and tried this particular example. Sorry to say, I'm underwhelmed:

  • props and items are not explained in the UI
  • the link "Show query in the Query Service" doesn't work before you run the query
  • the generated queries are unnatural and won't teach anyone anything good

How is this any better than the "query helper" (query explanation) of WDQ? Even for the wicked query generated by Query Builder, it shows a more useful explanation. --Vladimir Alexiev (talk) 10:03, 31 August 2021 (UTC)Reply[reply]

Sort by Label[edit]

Is there any way for the Query Builder to sort items by labels? --Sabelöga (talk) 16:44, 17 December 2021 (UTC)Reply[reply]

Cannot filter for items without a limited support property regardless of value[edit]

I wanted to show items without an official website, but the query builder says "Properties with limited support cannot be filtered by value", fair enough, but I wanted the "regardless of value" match. Even if the match terms cannot be applied, can at least the presence/absence of a property be checked? Vicarage (talk) 08:39, 15 May 2022 (UTC)Reply[reply]

Génial![edit]

Génial ! Ce serait juste bien de pouvoir mettre facilement une valeur "entre". Par exemple "Date de naissance entre 2008 et 2020" au lieu de devoir faire deux briques différenciées. 3(MG)² (talk) 09:27, 28 May 2022 (UTC)Reply[reply]

Will there be more development on this tool?[edit]

Hi

Does anyone know if/when there will be more development of this tool? I'd really like to use it but its missing some features I need (which Lydia has kindly turned into phab tasks).

Thanks

John Cummings (talk) 11:15, 24 June 2022 (UTC)Reply[reply]

Video tutorial[edit]

It will be good if any can can prepare video tutorials on this Query builder with few examples. Akbarali (talk) 15:46, 19 August 2022 (UTC)Reply[reply]

Before/after is acting strange[edit]

New to wikidata, so sorry if this is the wrong place to provide feedback, but wanted to note that there's some unintuitive behavior using before/after. There's no way to specify precision in the query builder, yet it automatically filters for precision in the query. This means, for instance, that filtering for ancienct civilizations starting before 1-1-200BCE doesn't return anything in the query builder, but going into the SPARQL and deleting the line that filters for precision returns Ancient Greece, Rome, Indus Valley, etc. - personally, I think the behavior should be changed so it doesn't filter for precision using the query builder.SandstormNorth (talk) 17:28, 15 November 2022 (UTC)Reply[reply]