query-42fa5abc9cd95f1741fd37fb80c7e08f

rq turtle/ttl

querying and displaying images with author/copyright 21:22, 3 March 2021 (UTC)) talk (Elya --Please ping me for an answer, but it might exist a different solution here, like openening the image in the Commons image viewer (like in the item page). Any ideas are appreciated … thanks! Commons talk:Structured data, the result at query.wikidata.org will be an image thumb with a larger size in a lightbox, which restrict's its usage to very private occasions because I cannot fulfill CC attribution requirements (especially when embedding the result). What would be a feasible approach to solve this? I placed a similar question @(P18)image On Querying : this technically works, but not as optimal, as multiple requests (first to WDQS, then to commons API, maybe then to WCQS).Elya@ 06:22, 4 March 2021 (UTC)) talk (ElyaI might try however to additionally output the Commons file page as hyperlink in the map, which would be a no-api but sufficient solution. Thanks for thinking around with me ;-) If anybody is aware of an API approach, still highly appreciated! -- 09:15, 4 March 2021 (UTC)) talk (GhoustonYes, this particular output is giving no way to get to the Commons image page, so it's inadequate. Perhaps the underlying software could be modified. . no chance to get to the image attributions. Churches in Wittenberg, thanks, but not exactly. Check out this random map query: Ghouston@ , yes, we have this data at structured Commons, but how to retrieve it? I could start a project completely out of the Query Service and combine 2 APIs, however, it would be nice to retrieve them via the Query service. Writing a bot that copies structured data from Commons to Wikidata as qualifiers … ? Rather not, I think.Tagishsimon@ 02:06, 4 March 2021 (UTC)) talk (Tagishsimon, for instance) such that reports could access one or other value. --(P275)copyright license : The solution would be either or both of representing the copyright status and/or licence for the image in Commons structured data, and as a qualifier of the P18 value (Elya@ 01:50, 4 March 2021 (UTC)) talk (GhoustonPeople have said that "click through" attribution is sufficient, and that's what Wikipedia uses. If you click the image you go the page on Commons with the details.

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?pbLabel ?cat ?coord ?img (IF(BOUND(?img), ?usage, "") AS ?usg)
WHERE {
   {
  SELECT ?item (SAMPLE(?cat) AS ?cat) (SAMPLE(?coord) AS ?coord) (SAMPLE(?img) AS ?img)
               WHERE {
                 wd:Q75849591 wdt:P527 [ wdt:P527 ?item; wdt:P361 ?pb ].
                 ?pb wdt:P31 wd:Q76598130.
                 ?item wdt:P625 ?coord.
                 OPTIONAL { ?item wdt:P373 ?cat. }
                 OPTIONAL { ?item wdt:P18 ?img. }
               } GROUP BY ?item
}.

  BIND(STRAFTER(wikibase:decodeUri(STR(?img)), "http://commons.wikimedia.org/wiki/Special:FilePath/") AS ?fileTitle)

  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
                    wikibase:api "Generator";
                    wikibase:limit "once";
                    mwapi:generator "allpages";
                    mwapi:gapfrom ?fileTitle;
                    mwapi:gapnamespace 6; # NS_FILE
                    mwapi:gaplimit "1";
                    mwapi:prop "imageinfo";
                    mwapi:iiprop "extmetadata" ;
                    mwapi:iiextmetadatafilter "UsageTerms" .

    ?usage wikibase:apiOutput "imageinfo/ii/extmetadata/UsageTerms/@value".
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?cat"):::projected v6("?coord"):::projected v6("?fileTitle") v6("?img"):::projected v1("?item"):::projected v2("?pb") v7("?usage"):::projected v8("?usg") a1((" ")) c34(["de"]):::literal c27(["extmetadata"]):::literal c10(["bd:serviceParam"]):::iri c18(["allpages"]):::literal c5(["wd:Q76598130"]):::iri c12(["commons.wikimedia.org"]):::literal c31(["imageinfo/ii/extmetadata/UsageTerms/@value"]):::literal c23(["1"]):::literal c16(["once"]):::literal c3(["wd:Q75849591"]):::iri c21(["6^^xsd:integer"]):::literal c25(["imageinfo"]):::literal c29(["UsageTerms"]):::literal c14(["Generator"]):::literal a1 --"wdt:P527"--> v1 a1 --"wdt:P361"--> v2 c3 --"wdt:P527"--> a1 v2 --"wdt:P31"--> c5 v1 --"wdt:P625"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P373".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v6 end bind3[/"sample(?cat)"/] v6 --o bind3 bind3 --as--o v6 bind4[/"sample(?coord)"/] v6 --o bind4 bind4 --as--o v6 bind5[/"sample(?img)"/] v6 --o bind5 bind5 --as--o v6 bind6[/"substring-after(http://wikiba.se/ontology#decodeUri(str(?img)),'http://commons.wikimedia.org/wiki/Special:FilePath/')"/] v6 --o bind6 bind6 --as--o v6 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c10 --"mwapi:endpoint"--> c12 c10 --"mwapi:api"--> c14 c10 --"mwapi:limit"--> c16 c10 --"mwapi:generator"--> c18 c10 --"mwapi:gapfrom"--> v6 c10 --"mwapi:gapnamespace"--> c21 c10 --"mwapi:gaplimit"--> c23 c10 --"mwapi:prop"--> c25 c10 --"mwapi:iiprop"--> c27 c10 --"mwapi:iiextmetadatafilter"--> c29 v7 --"mwapi:apiOutput"--> c31 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c10 --"mwapi:language"--> c34 end bind7[/"if(bound(?img),?usage,'')"/] v6 --o bind7 v7 --o bind7 bind7 --as--o v8