query-42fa5abc9cd95f1741fd37fb80c7e08f
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
- https://query.wikidata.org/sparql
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". }
}