query-55b6a039e233ad7b9b28900cd03e4dfe
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
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#>
#title: Find metadata like artist and license for an image
SELECT ?image ?filename ?license ?artist ?licenseurl WHERE {
wd:Q20 wdt:P948 ?image . # Change here to select any other image, by changing item and property
# The following line transforms the image to be used in the Commons API
BIND(wikibase:decodeUri(STRAFTER(STR(?image), "http://commons.wikimedia.org/wiki/Special:FilePath/")) AS ?filename)
# Below is the call to the Wikimedia Commons API
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
wikibase:api "Generator";
mwapi:generator "allpages";
mwapi:prop "imageinfo";
mwapi:iiprop "extmetadata";
mwapi:gapfrom ?filename ;
mwapi:gapto ?filename;
mwapi:gapnamespace "6".
?license wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseShortName/@value" .
?artist wikibase:apiOutput "imageinfo/ii/extmetadata/Artist/@value" .
?licenseurl wikibase:apiOutput "imageinfo/ii/extmetadata/LicenseUrl/@value" .
}
}
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh