Topic on Extension talk:LinkedWiki

No visualization for pictures available

6
Summary by Karima Rafes

The parameter options can be use to visualize pictures, videos, etc.

Example, here for pictures in the column[2] :

{{#sparql:PREFIX p: <http://www.wikidata.org/prop/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#> 
PREFIX wikibase: <http://wikiba.se/ontology#> 
PREFIX wd: <http://www.wikidata.org/entity/> 

SELECT DISTINCT ?nobelLabel  ?winnerLabel ?image WHERE {
  ?winner wdt:P31 wd:Q5 ;
          wdt:P18 ?image ;
          wdt:P166 ?nobel .
  ?nobel wdt:P279 wd:Q7191 .
  ?winner p:P166 ?statement .
  ?statement pq:P585 ?when .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  
  FILTER(YEAR(?when) = 2019)
} 
ORDER BY DESC(?year) ?nobelLabel ?winnerLabel
limit 100
| endpoint = https://query.wikidata.org/sparql
| chart=bordercloud.visualization.DataTable
| options=colstyle=col2_img_max-width:175px;
| log=2
}}

Doc : https://bordercloud.github.io/sgvizler2/tutorial-bordercloud_visualization_DataTable.html

S0ring (talkcontribs)

No visualization for pictures in version 3.3.7 available, DataTable or Google Table show the URL's only. Would it be possible in future versions?

Karima Rafes (talkcontribs)

It works in this version but there is still work to improve ergonomics.

You can test with this query :


{{#sparql:PREFIX p: <http://www.wikidata.org/prop/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#> 
PREFIX wikibase: <http://wikiba.se/ontology#> 
PREFIX wd: <http://www.wikidata.org/entity/> 

SELECT DISTINCT ?nobelLabel  ?winnerLabel ?image WHERE {
  ?winner wdt:P31 wd:Q5 ;
          wdt:P18 ?image ;
          wdt:P166 ?nobel .
  ?nobel wdt:P279 wd:Q7191 .
  ?winner p:P166 ?statement .
  ?statement pq:P585 ?when .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  
  FILTER(YEAR(?when) = 2019)
} 
ORDER BY DESC(?year) ?nobelLabel ?winnerLabel
limit 100
| endpoint = https://query.wikidata.org/sparql
| chart=bordercloud.visualization.DataTable
| options=colstyle=col2_img_max-width:175px;
| log=2
}}

source : https://linkedwiki.com/query/List_of_Nobel_Prize_2019

Documentation with DataTable : https://bordercloud.github.io/sgvizler2/tutorial-bordercloud_visualization_DataTable.html

Bye

S0ring (talkcontribs)

Great, your example works! But if you add a new column, it won't work:

SELECT DISTINCT ?nobelLabel  ?winnerLabel ?gndid ?image WHERE {

  ?winner wdt:P31 wd:Q5 ;

         wdt:P18 ?image ;

         wdt:P166 ?nobel ;

         wdt:P227 ?gndid.

  ?nobel wdt:P279 wd:Q7191 .

  ?winner p:P166 ?statement .

  ?statement pq:P585 ?when .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }

 

  FILTER(YEAR(?when) = 2019)

}

ORDER BY DESC(?year) ?nobelLabel ?winnerLabel

Karima Rafes (talkcontribs)

You must to change the column in the options if you change the output.

In my request, image is in the column 2 : options=colstyle=col2_img_max-width:175px;

In your request, image is in the column 3 : options=colstyle=col3_img_max-width:175px;

S0ring (talkcontribs)
Karima Rafes (talkcontribs)

Thanks ! Bye ;)