Jump to content

Topic on Extension talk:WikibaseMediaInfo/RDF mapping

Mapping from filenames to MediaObjects

2
Dipsacus fullonum (talkcontribs)

The example

<https://commons.wikimedia.org/wiki/File:Boat_movie.webm> a schema:Article ;

schema:about sdoc:M222222 ;

schema:isPartOf <https://commons.wikimedia.org/> .

should give a way to get from a filename to a MediaObject. But in WCQS there are no triples with the predicate schema:about and no objects of type schema:Article.

Is the description here outdated or is the triples missing in WCQS?

What is the recommended way to get a MediaObject if you have the filename? You can go the opposite way with schema:contentUrl by taking the last part of the URI and decode, but you cannot construct the contentURI from the filename.

Lucas Werkmeister (WMDE) (talkcontribs)

Hm, strange. The only way I found to get the entity is this terrible hack (do not use) to get the page ID via MWAPI:

SELECT * WHERE {
  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:endpoint "commons.wikimedia.org";
                    wikibase:api "Generator";
                    mwapi:generator "allpages";
                    mwapi:gapfrom "Mapa de Palomino.jpg";
                    mwapi:gapto "Mapa de Palomino.jpg";
                    mwapi:gapnamespace "6".
    ?pageId wikibase:apiOutput "@pageid".
  }
  BIND(IRI(CONCAT(STR(sdc:M), ?pageId)) AS ?entity)
}

Try it!

I think I’ll leave the better answering of this to the WCQS team :)

Reply to "Mapping from filenames to MediaObjects"