Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Page MenuHomePhabricator

Make /entity/ alias work for Commons
Closed, ResolvedPublic

Description

Wikidata has entity URLs in the form of http://www.wikidata.org/entity/Q42 - which is redirected to https://www.wikidata.org/wiki/Special:EntityData/Q42 and ultimately to https://www.wikidata.org/wiki/Q42.

It makes sense to have the same setup for Commons - so that Commons URL http://commons.wikimedia.org/entity/M9103972 would redirect to
https://commons.wikimedia.org/wiki/Special:EntityData/M9103972 (and of course carry over all suffixes and query strings just like Wikidata does).

Also statement URIs - like https://www.wikidata.org/entity/statement/L40053-5aa77d7a-4c9e-ba1c-255b-3c8e4ab60d5d or https://commons.wikimedia.org/entity/statement/M40538870-D3B1F1D8-C2E4-4C7B-B562-721D6C94CF25 - should be supported, they should redirect to L40053 and M40538870 entity pages respectively.

Event Timeline

Smalyshev triaged this task as Medium priority.May 2 2019, 6:59 AM

(Just to clarify – Special:EntityData works, it’s “only” the /entity/ redirect that’s missing.)

For wikidata this is done in

puppet/modules/mediawiki/files/apache/sites/wikidata-uris.incl

We should set up a similar set of things for commons I guess.

Change 526757 had a related patch set uploaded (by Smalyshev; owner: Smalyshev):
[operations/puppet@production] Support /entity/ and other Wikidata URLs for Commons

https://gerrit.wikimedia.org/r/526757

Mentioned in SAL (#wikimedia-operations) [2019-08-27T19:08:58Z] <gehel> starting deployment of Apache config for lexemes / SDoC - T222321

Smalyshev updated the task description. (Show Details)

I'd be in favor of enabling the minimum needed here and just do the entity resolution here, doing the statement sounds a bit more complex as it may work for wikibase because we will redirect to the entity page which will support statement anchors, for commons we redirect to the File page.
As you can see in the existing rewrite rule the statement id is completely ignored:

RewriteRule ^/entity/statement/([QqPp]\d+).*$ %{ENV:RW_PROTO}://%{SERVER_NAME}/wiki/Special:EntityData/$1 [R=303,L]

The fix could be:

RewriteRule ^/entity/statement/([QqPp]\d+)-(.*)$ %{ENV:RW_PROTO}://%{SERVER_NAME}/wiki/Special:EntityData/$1#$2 [R=303,L]

But I doubt that would work for commons.

Change 547541 had a related patch set uploaded (by DCausse; owner: DCausse):
[operations/puppet@production] Revert "Revert "Add L and M to allowed statement starts""

https://gerrit.wikimedia.org/r/547541

@Gehel @dcausse what's the plan here? Currently every file on Commons that uses structured data (about 2M I think) has a (broken) link in the sidebar "Concept URI". For example http://commons.wikimedia.org/entity/M1916 on https://commons.wikimedia.org/wiki/File:Grote-Kerk-Haarlem.jpg . It would be really nice to fix this broken link.

In the current state url's like https://www.wikidata.org/entity/M12345 redirect to https://www.wikidata.org/wiki/Special:EntityData/M12345 which gives a bad request. That rewrite patch should probably reverted and a Commons only patch should be made. Do you agree?

Problem is that Special:EntityData does not support displaying the content of non main slot, it seems to just redirect to the File page: http://commons.wikimedia.org/wiki/Special:EntityData/M1916 which is not particularly useful because these Concept URI links simply link back to the same File page. I guess the question is more how to make Special:EntityData displays the structured MediaInfo data in the browser. JSON/RDF/TTL format are supported for MediaInfo entities but I can't seem to find how to make it visible in html.
@Lucas_Werkmeister_WMDE, @Cparle what do you think Special:EntityData should do when given a MediaInfo entity?

Nothing is broken if we are OK having Special:EntityData/M123 redirecting back to the File page, the only thing that I don't know how to do is to have direct reference to a particular statement (like the statement id anchor on wikibase entity e.g. https://www.wikidata.org/wiki/Q1#Q1$8983b0ea-4a9c-0902-c0db-785db33f767c)

Yeah, it the content negotiation is for html, showing the File page is imho the only correct location to link to.

To be able to link to specific sections, you have to give the div an unique id I think. In your example it's div id="Q1$8983b0ea-4a9c-0902-c0db-785db33f767c" class="wikibase-statementview wikibase-statement-Q1$8983b0ea-4a9c-0902-c0db-785db33f767c wb-normal">

In the example on Wikidata we have: <div data-guid='M1916$8DFF061F-559D-45CC-884B-D7253442138A' class='wbmi-item-container'>. I think if you change that to <div id="M1916$8DFF061F-559D-45CC-884B-D7253442138A" data-guid='M1916$8DFF061F-559D-45CC-884B-D7253442138A' class='wbmi-item-container'> that you should be able to link to this.

Side note: Do we have a convention on single and double quotes? I now see a mix of it in the source code. Only the SDoC code part seems to be using single quotes. I would expect only double quotes.

I agree that nothing is broken with Special:EntityData behavior. It would be nice if it was possible to link to a specific statement group or statement, but I think that’s only weakly related to this task, and doesn’t need to block the redirect for /entity/M….

Change 547541 merged by Gehel:
[operations/puppet@production] Revert "Revert "Add L and M to allowed statement starts""

https://gerrit.wikimedia.org/r/547541

In summary, it seems we need to merge the patch[1] for the /entity/ endpoint, and this should be resolved?

[1] https://gerrit.wikimedia.org/r/#/c/operations/puppet/+/526757/

In summary, it seems we need to merge the patch[1] for the /entity/ endpoint, and this should be resolved?

[1] https://gerrit.wikimedia.org/r/#/c/operations/puppet/+/526757/

Yes, commit this and maybe do a follow up patch to split up Wikidata (P..., Q..., etc.) and Structured data on Commons (M....)

Mentioned in SAL (#wikimedia-operations) [2020-02-18T09:09:05Z] <gehel> disabling puppet on mw* to deploy apache config change - T222321

Change 526757 merged by Gehel:
[operations/puppet@production] Support /entity/ and other Wikidata URLs for Commons

https://gerrit.wikimedia.org/r/526757