Last modified: 2014-09-05 17:04:55 UTC
EntityContent should be able to represent redirects (while Entity and the rest of the Wikibase datamodel should not know about redirects).
Change 89810 had a related patch set uploaded by Daniel Kinzler: Allow ItemContent to represent a redirect. https://gerrit.wikimedia.org/r/89810
Should this really be implemented in EntityContent, or might we use the standard redirect feature of MediaWiki?
@Bene: in order to use MediaWiki's standard redirect feature, EntityContent must implement that feature for, well, entities. The Content interface defines the appropriate methods, EntityContent currently doesn't do anything with them though. However, I'm no longer convinced that this is the best approach to implementing redirects for Wikibase (though the redirect interface in Content must be used in *some* way), see my my mail to wikidata-tech: http://lists.wikimedia.org/pipermail/wikidata-tech/2013-December/000347.html
As per discussion on the mailing list, redirects are to be implemented as a mode of EntityContent. See https://meta.wikimedia.org/wiki/Wikidata/Development/Entity_redirect_after_merge for a summary
We have discussed the expected behavior of entity redirects internally. Here are the key points: * An Entity object cannot represent a redirect * An EntityContent object may represent a redirect. In that case, calling getEntity() will fail. * Redirects should only be possible within one kind of entity, redirects from one kind of entity to another are not supported. * For now, only Items can redirect to other Items. Redirects for Properties will not be supported initially, if ever. * The only way to create a redirect should be by merging two entities. Ideally, the merge would involve two edits to the redirected item: one to "empty" it, and a separate one to turn it into a redirect. This allows for better diffs, for easier undo/revert, and a clearer edit history. * Redirects can be turned back into normal entities by undoing/reverting the edit that turned them into a redirect (if that is possible without conflicts). * On the RDF level, redirects a re modeled as an owl:sameAs relationship between concept URIs. This also means that the redirected document URL is considered to be "about" the target's concept URI. * Viewing a page of an entity that is a redirect shall show the content of the redirect target, as usual. This can be disabled withing the redirect=no parameter, as usual. * When viewing an entity page that references redirected entity IDs, it would be nice to mark these somehow. We will probably not support this initially. * When accessing an entity explicitly via ID from a client wiki, any redirects should be automatically resolved. * When trying to edit an entity that is a redirect (via the API od a special page), the edit will fail. * When fetching entities via the API, redirects should NOT be automatically resolved, unless this is requested using redirects=resolve. * When requesting entity data using a canonical data URL or concept URI, redirects should be resolved automatically. The resulting data does not need to indicate that a redirect was resolved. * For RDF data, the relevant owl:sameAs triples should be included, no matter whether what URL the document was accessed with. * All redirects should be present in the full RDF dump, as owl:sameAs triples. * Redirects are not present in JSON dumps of entities, but there would be a separate JSON dump for redirects. * Redirects from wikitext pages to entities will work as usual, and do not concern us. * We should make sure the "redirected from" line is shown correctly in entity pages. * Revert/Restore needs to work as expected * Diffs between the redirect and non-redirect versions of an entity need to work * EntityRevisionLookup will not resolve redirects and will fail when used with a redirected entity ID. This could be relaxed if no specific revision is requested. * EntityLookup will resolve redirects if explicitly asked to do so. * The EntityPerPage table will maintain the link between a redirected entity ID and the wiki page that contains the redirect. We will add a column (or an extra table) that holds the redirect targets.
Change 134379 merged by jenkins-bot: Implement redirects in ItemContent https://gerrit.wikimedia.org/r/134379