Topic on User talk:Yurik

Jump to navigation Jump to search
Jura1 (talkcontribs)

Hi Yurik. Thanks for the again for the news.

Looking at the syntax, the main problems I had:

  • the sparql query isn't readable (and editable on the page). User:Multichill mentioned that, I think.
  • it's not easy to figure out which are the variable names that need changing. Default sparql labels tend to be in the form "asdfLabel".
  • there is no preview (supposedly there are technical reasons for that).

It would be good to have few samples for each of the possible graphs: it's easier to learn from changing them than to start from scratch. I guess I should start by reading the tutorial.

Yurik (talkcontribs)

@Jura1, see User:Yurik/sandbox - I rewrote Template:Graph:Pie chart -- now you simply supply the query in the original SPARQL format (and it gives you a link to the query service at the bottom). The query must produce two columns "label" and "value", or you need to supply the name of the columns (e.g. valueColumn=...) This way, the pie chart could plot them without modification. Preview should work ok, not sure what issue you are seeing.

Jura1 (talkcontribs)

Thanks. I got it to work (Property_talk:P3096#Charts). It seems that on preview, I just didn't wait long enough.

Looks like there is a bug in templatedata: "labelColumn" gets rendered as "LabelColumn" ;)

BTW, what would be a good way to specify percentages of total ? Most charts on it:Progetto:Biografie/Wikidata use sparql to output just one line with the total and 1 or 2 values for a percentage. Otherwise it times out. Already, the same wont work for entire Wikidata.

Yurik (talkcontribs)

Feel free to modify the template for the labelcolumn param :) What do you mean by percentage - do you want the input value to be the percentage? Or do you want it to always show percentage instead of the actual value on the graph?

Jura1 (talkcontribs)
Yurik (talkcontribs)

Ah yes, I told User:Multichill - it is very hard to work with values like that, it requires additional lua script to convert. It would be much easier if you modify the SPARQL to produce two column result - "label" and "value".

Jura1 (talkcontribs)

maybe with CONSTRUCT .. still have to learn how to use that.

Jura1 (talkcontribs)

Is this correct what I just added at Category:Pages with graphs. I keep mixing them up. Worse itwiki had had the template names switched ;)

Yurik (talkcontribs)

That category is automatic - any page that has a <graph> tag on it appears in that category.

Jura1 (talkcontribs)

Actually, I had in mind the note on the category description page itself.

BTW, is there a way to do the map from with Graph? I'd like to add it here.

Yurik (talkcontribs)
Jura1 (talkcontribs)

Good news. For this, I think it would be sufficient. I tried adding it, but somehow it worked when previewing it on mediawikiorg, but not here. Same for Smalysev's sample.

Yurik (talkcontribs)

it has just launched, riding the train, should be available on wikidata either today or tomorrow

Jura1 (talkcontribs)

Ok .. good. .. I thought it was another of thoses things that were around since April, but where none was aware of it ;)

Are there other types of graphs available as well?

Yurik (talkcontribs)

maps do not support any kinds of visualizations other than what's available in GeoJSON, plus the the external data thing we just enabled.

Jura1 (talkcontribs)

but forms: there are pie charts, the x/y plot. Any others?

Yurik (talkcontribs)

The graphs support anything you can throw at it - any kinds of marks -- because you control the drawing process - you specify arcs, bars, polygons, etc, to draw, based on the data. Because of its power, it is a bit complex to use :( See Vega.js documentation. I haven't made any ready-made graphs yet, but anyone is welcome to help with it :)

Jura1 (talkcontribs)

I will try to figure out how to do some ..

In the meantime, the map works at Wikidata too. There is just one thing I had noticed: highlighting Russia isn't ideal, as it spreads across 180°. Fiji would have the same problem, but it's fairly rare.

How does one have outlines added, e.g. departments of France?

Yurik (talkcontribs)

It all depends on OSM - if OSM has wikidata IDs for the shapes that you need, we will show them. If they don't, we will need to figure out a way to store them.

Jura1 (talkcontribs)
Yurik (talkcontribs)

no, the geoshapes service can only understand wikidata IDs. Others are much less stable.

Jura1 (talkcontribs)

The property gives for a Wikidata ID the corresponding OSM relation. Supposedly that is linked to a shape at OSM.

The Wikidata property values are meant to be stable.

Yurik (talkcontribs)

yes, but OSM relation IDs are not stable. I don't want to have to deal with multiple systems of IDs - Wikidata is meant to be the most stable of them, plus it makes everything relate to "concepts" rather than "geoshapes". Concepts are much more valuable, as they provide good linking to all other things in wikidata and outside.

Jura1 (talkcontribs)

I think a property for relations was picked over the others as they are considered the only stable thing at OSM.

I suppose the question if you want to source it from here or from there.

Reply to "Dynamic graphs and sparql"