User:Duesentrieb/References

Evil plan for re-doing Wikibase references:
 * References are top level elements of Entities, just like Statements.
 * References are identified by GUID, just like Statements.
 * References consist of a main Snak and qualifiers, just like Statements. (They are structurally just like the things we called "Claims", but logically, they represent something different)
 * Each Statement can reference any number of References defined on the item.

Usage:
 * In the UI, when adding a reference, the user would have the choice of either creating or re-using a reference
 * References would be show just like the Cite extension does it (a [1] thing on the statement, and a list of references at the bottom)


 * Typically, the main Snak of a Reference would point to an item that describes a citable resource, e.g. a book (or edition of a book), a website, a journal (or journal article), etc.
 * The main Snak could also be an ISBN, or a URL. This should not restricted by software, just by convention.
 * Qualifiers would be used to specify the page or chapter of a book, the article of a journal, etc.
 * When creating a Statement via the API, referencing a non-existing Reference would trigger an error.
 * Should unused references automatically be removed? Or at least highlighted somehow?
 * Should it be possible to removed references if they are still used?

Transition and B/C:
 * Deserializers used with DB content will need to support the old way to define references forever. We probably also want to allow this for the API for a while.
 * Old-style references would be converted to new-style upon de-serialization.
 * Old style references would be converted as follows:
 * If there is only one Snak, make it the main Snak.
 * Otherwise, make the main Snak point to a reserved Item ("legacy citation") and make all Snaks qualifiers.
 * Assign a GUID and place the Reference at the top level of the entity; If there is already a Reference there with the same hash (that is, the same content), re-use it. Leave a reference to that GUID in the Snak that originally contained the old-style Reference.