Wikidata:Property proposal/Wikidata SPARQL query equivalent

Wikidata SPARQL query equivalent edit

Originally proposed at Wikidata:Property proposal/Generic

Data typeString
DomainWikimedia category (Q4167836) items
ExampleCategory:Ugandan writers (Q7439502)?item wdt:P31 wd:Q5. ?item wdt:P27 wd:Q1036.
Motivation

I was navigating the category tree for writers in English Wikipedia, and I imagined it would be useful to have links in every category to the equivalent Wikidata SPARQL query. For example, in en:Category:Ugandan writers (Category:Ugandan writers (Q7439502)), we could have a link to this equivalent query. Though I think that the property only should include the text "?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q1036", skipping the SELECT, WHERE and end lines. Those lines could be included by the template in English Wikipedia. Perhaps every Wikipedia wants to show different columns for results, or different sorts, etc. Even if Englsh Wikipedia isn't interested in having those links in the categories, I think this property that would translate categories<->sparql is still useful for users and bots. Emijrp (talk) 17:24, 19 March 2017 (UTC)[reply]

Discussion

  Comment I'm not good at queries. Can you prove that there is an unique query that solves a problem? If not, how to choose the "best" one? --★ → Airon 90 17:50, 19 March 2017 (UTC)[reply]

This is SPARQL, not SQL. SPARQL endpoints are generally not configured to allow any updates of the dataset, so I don't think there's any security issue at all here. ArthurPSmith (talk) 19:52, 2 May 2017 (UTC)[reply]

  Done Changed to string after input from Stas. @Emijrp, Airon90, Lockal, ValterVB, Zolo: @ChristianKl, Melderick, ArthurPSmith:--Micru (talk) 14:46, 5 May 2017 (UTC)[reply]