Wikidata talk:SPARQL query service/Wikidata Query Help/Result Views

From Wikidata
Jump to navigation Jump to search



What is the URL for the simple JSON format "JSON file" for API? "format=json" gives a standard long format with "results", "bindings", etc. — Finn Årup Nielsen (fnielsen) (talk) 15:10, 8 February 2017 (UTC)[reply]

wrong page


"Embed Mode" and "Download results" should be at Wikidata:SPARQL query service/A gentle introduction to the Wikidata Query Service d1g (talk) 08:58, 22 May 2017 (UTC)[reply]

More details please


I tried to get informations on how to change de view results of maps. The reading of this section don't really help me. Do someone who know these things can developp more ? Or show me how to show the pink color of P465 of this :

#Metro lines in Montreal, Quebec, Canada
#defaultView:Map{"layer": "?rgb"}
SELECT ?station ?stationLabel ?line ?lineLabel ?rgb ?coord ?image
  ?line wdt:P81 wd:Q43298334 ;
        wdt:P625 ?coord.
OPTIONAL { ?line wdt:P465 ?rgb. }
#  ?station wdt:P81 ?line;
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . }
Try it!

Thank you. Simon Villeneuve (talk) 13:33, 25 April 2018 (UTC)[reply]

Improvements to Query view


I've written a blog post about using query view and it's getting a good reaction from colleagues, but they've fed back that the interactivity could be better.

  • When I mouse over a node, the text that pops up is just a repeat of the label. So the user curious for information about what this node represents doesn't get any, unless they click through to Wikidata. I've like a configurable column that specifies an extra text field (into which I'd put the itemDescription).
  • Clicking through takes the user to the Wikidata entry for the item. I'd like a configurable column for a URL that items link to, so I can use alternatives like Reasonator links or the catalogue links for a museum object.

Are these feasible? MartinPoulter (talk)

Using the result in Wikipedia


Can we list the WDQ results which can be integrated into Wikipedia, please? Listeria is the only one I can think of, but would love to bring in auto generated WD graphs into cywiki. Llywelyn2000 (talk) 09:28, 15 August 2019 (UTC)[reply]



The example code for a LineChart doesn't work. It gives StackOverflowError. I have rewritten it to this which seems to work. --Dipsacus fullonum (talk) 02:15, 5 January 2020 (UTC)[reply]

SELECT ?country ?year ?population ?countryLabel
    SELECT ?country ?year (avg(?populationValue) as ?population)
          ?country wdt:P47 wd:Q183.
          ?country p:P1082 ?populationStatement.
          ?populationStatement ps:P1082 ?populationValue.
          ?populationStatement pq:P585 ?date.
          bind(str(YEAR(?date)) AS ?year)
    group by ?country ?year
} AS %results
    INCLUDE %results.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
Try it!

Order of variables for graph


It might be helpful to explain that the order of variables is crucial for the graph mode to work correctly.

  • Labels and pictures (and colour?) must appear after the item they pertain to, and before any new item.
  • Edge labels must appear after the destination item (which is usually going to be the second item)

So a suggested variable ordering is: ?item ?itemLabel ?itemPic ?itemColor ?toLink ?toLinkLabel ?edgeLabel

Also, could we add an option for "roots" mode (as opposed to the default "leaves") for hierarchical "shakeTowards"?[1] I don't know about others, but I tend to build graphs where the root is the focus. In particular, the "leaves" mode doesn't work well on digraphs where there are multiple paths to a leaf of different lengths.

I would also suggest making the (hoverover) title be the node id when a label is supplied, instead of just being a copy of the label. Bovlb (talk) 22:30, 14 April 2020 (UTC)[reply]

My suggested code changes are phab:T250299, phab:T250301. Bovlb (talk) 17:21, 15 April 2020 (UTC)[reply]

Change font size in iframe


Hi, is there an easy way to change the font size or color in an iframe resulting from the WDQS? I tried using CSS font-size: 10px, but to no result

<iframe style="position: float; height: 400px; width: 100%; border: 1px; font-size: 10px" src="" referrerpolicy="origin" sandbox="allow-scripts allow-same-origin allow-popups"></iframe>

Any suggstions? --OlafJanssen (talk) 23:22, 29 January 2021 (UTC)[reply]

list of WDQS '#' tags ?


Refering to -> Are there only two WDQS tags ? where is the list of recognised WDQS tags with description and parameters ? Thanks --Christian 🇫🇷 FR (talk) 08:57, 17 June 2024 (UTC)[reply]