query-438d60df06e66e86ca6350231beddd7a

rq turtle/ttl

Resolution of image (on item for painting)? a list of paintingsIs there a good way to add an indication of the resolution of the available image to Maybe there are three or four basic resolutions: 4. printing quality (same size as original, dpi?). 3. zoomable on details: depends on actual painting size (there are columns with W and H in cm), not sure what a good measure would be 2. Commons/Wikipedia file description page: is that 800px ? )sample1. Wikipedia infobox resolution: maybe 300px wide (How to call the resolutions? 4 very high < 4 high < 3 medium < 2 low < 1 very low 05:35, 13 November 2021 (UTC) Jura--- 10:31, 14 November 2021 (UTC) Jura. --- c:Commons:Village_pump#determine_available_image_resolution_(for_a_list_of_paintings)I asked for help on (3) and (4) at

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?itemDescription 
  (ROUND(?height*100) as ?h_cm) (ROUND(?width*100) as ?w_cm) (ROUND(?height * 10 * ?width)/10 as ?size) 
  ?img0 ?imgh ?imgw ?imgsize ?available_img_res
WHERE
{
  ?item wdt:P31 wd:Q3305213;
    wdt:P170 wd:Q725681.
  OPTIONAL { ?item p:P2048 /psn:P2048 [wikibase:quantityAmount ?height ; wikibase:quantityUnit wd:Q11573 ] }
  OPTIONAL { ?item p:P2049 /psn:P2049 [wikibase:quantityAmount ?width ; wikibase:quantityUnit wd:Q11573 ]. }  

  OPTIONAL { 
    ?item wdt:P18 ?img0
    BIND(replace(wikibase:decodeUri(SUBSTR(STR(?img0), 52)),"_"," ") AS ?img)
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
      bd:serviceParam wikibase:api "Generator" .
      bd:serviceParam mwapi:generator "allpages" .
      bd:serviceParam mwapi:prop "imageinfo" .
      bd:serviceParam mwapi:gapprefix ?img .
      bd:serviceParam mwapi:gapnamespace "6" .
      bd:serviceParam mwapi:iiprop "timestamp|user|mediatype|metadata|dimensions" .
      ?imgsize wikibase:apiOutput "imageinfo/ii/@size".
      ?imgw wikibase:apiOutput "imageinfo/ii/@width".
      ?imgh wikibase:apiOutput "imageinfo/ii/@height".
      ?imgmediatype wikibase:apiOutput "imageinfo/ii/@mediatype".
    } 
    BIND(xsd:integer(?imgw) as ?imgwi)
    BIND(
        IF(?imgwi < 290, "very low", 
        IF(?imgwi < 750, "low", 
           "medium or higher"))
           as ?available_img_res)
   }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?available_img_res"):::projected v12("?h_cm") v2("?height"):::projected v5("?img") v4("?img0"):::projected v8("?imgh"):::projected v9("?imgmediatype") v6("?imgsize"):::projected v7("?imgw"):::projected v10("?imgwi") v1("?item"):::projected v14("?size") v13("?w_cm") v3("?width"):::projected a2((" ")) a1((" ")) a4((" ")) a3((" ")) c4(["wd:Q725681"]):::iri c32(["imageinfo/ii/@mediatype"]):::literal c29(["imageinfo/ii/@size"]):::literal c2(["wd:Q3305213"]):::iri c14(["bd:serviceParam"]):::iri c31(["imageinfo/ii/@height"]):::literal c20(["allpages"]):::literal c27(["timestamp|user|mediatype|metadata|dimensions"]):::literal c16(["commons.wikimedia.org"]):::literal c7(["wd:Q11573"]):::iri c25(["6"]):::literal c22(["imageinfo"]):::literal c35(["#91;AUTO_LANGUAGE#93;,en"]):::literal c30(["imageinfo/ii/@width"]):::literal c18(["Generator"]):::literal v1 --"p:direct/P31"--> c2 v1 --"p:direct/P170"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; a1 -."mwapi:quantityAmount".-> v2 a1 --"mwapi:quantityUnit"--> c7 v1 --"p:P2048"--> a2 a2 --"p:statement/value-normalized/P2048"--> a1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; a3 -."mwapi:quantityAmount".-> v3 a3 --"mwapi:quantityUnit"--> c7 v1 --"p:P2049"--> a4 a4 --"p:statement/value-normalized/P2049"--> a3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v4 bind0[/"replace(http://wikiba.se/ontology#decodeUri(substring(str(?img0),'52^^xsd:integer')),'_',' ')"/] v4 --o bind0 bind0 --as--o v5 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c14 --"mwapi:endpoint"--> c16 c14 --"mwapi:api"--> c18 c14 --"mwapi:generator"--> c20 c14 --"mwapi:prop"--> c22 c14 --"mwapi:gapprefix"--> v5 c14 --"mwapi:gapnamespace"--> c25 c14 --"mwapi:iiprop"--> c27 v6 --"mwapi:apiOutput"--> c29 v7 --"mwapi:apiOutput"--> c30 v8 --"mwapi:apiOutput"--> c31 v9 --"mwapi:apiOutput"--> c32 end bind1[/"http://www.w3.org/2001/XMLSchema#integer(?imgw)"/] v7 --o bind1 bind1 --as--o v10 bind2[/"if(?imgwi < '290^^xsd:integer','very low',if(?imgwi < '750^^xsd:integer','low','medium or higher'))"/] v10 --o bind2 bind2 --as--o v11 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c14 --"mwapi:language"--> c35 end bind3[/"numeric-round(?height * '100^^xsd:integer')"/] v2 --o bind3 bind3 --as--o v12 bind4[/"numeric-round(?width * '100^^xsd:integer')"/] v3 --o bind4 bind4 --as--o v13 bind5[/"numeric-round(?height * '10^^xsd:integer' * ?width) / '10^^xsd:integer'"/] v2 --o bind5 v3 --o bind5 bind5 --as--o v14