**Revised after public discussion, April 1 2017**
== Problem ==
Wikimedia is managing a growing amount of machine readable data as wiki page content. The latest addition is the Data namespace on commons, which hosts tabular data like [[https://commons.wikimedia.org/wiki/Data:Dolmens_of_the_Preseli_Hills.tab|Data:Dolmens_of_the_Preseli_Hills.tab]] and geographic data like [[https://commons.wikimedia.org/wiki/Data:Avignon_City_Wall.map|Data:Avignon_City_Wall.map]].
There is currently no canonical URL for referring to and retrieving these data sets. Canonical URLs are needed as stable identifiers (URIs) in linked data.
**Concrete need:** Wikidata can reference geo-shape data from the Data namespace on Commons. To represent such references in RDF, the data set needs a canonical URI. See {T159517}
== Proposed Solution ==:
* Use URLs of the form https://commons.wikimedia.org/data/Data:Avignon_City_Wall.map to identify and retrieve machine readable page content.
* The ```/data/``` path is rewritten to a special page, Special:PageData
* Special Special:PageData will redirect (with status 303) to an appropriate (and typically cacheable) URL for retrieving the page data. For now, this will use the ```action=raw``` interface.
* Special:PageData may apply content negotiation based on the Accept header sent by the client. In the first iteration, it will only check if any accept header sent by the client is compatible with the content model of the requested page.
* The 303 redirects are not cecheable for now, because they depend on the Accept header; complex normalization would be needed to allow the cache to vary on the Accept header without causing massive cache fragementation.
Note that in contrast to Wikidata entity URIs, the above URIs identify //descriptions// (data), not the thing described by the data.
== Status Quo ==
* There is a way to get raw page data for most data types, using action=raw with the "ugly" URL form: <https://commons.wikimedia.org/w/index.php?title=Data:Avignon_City_Wall.map&action=raw>. However, this is not supported for data types that have "direct editing " disabled. E.g. <https://www.wikidata.org/w/index.php?title=Q23&action=raw> does not work.
* Wikidata uses <https://www.wikidata.org/entity/Q23> as the canonical URI of concepts, and <https://www.wikidata.org/wiki/Special:EntityData/Q23> as the canonical URI of the description. Both apply content negotiation and trigger a 303 redirect. The canonical URL for a specific serialization has the form <https://www.wikidata.org/wiki/Special:EntityData/Q23.ttl>.
== Concerns an Alternatives Considered ==
* Do not include the namespace after /data/, e.g. https://commons.wikimedia.org/data/Avignon_City_Wall.map
: TBD
* Use "raw" instead of "data", e.g. https://commons.wikimedia.org/raw/Data:Avignon_City_Wall.map
: TBD
* Use REST API URLS
: TBD
* Apply content negotiation to the established page URLs using the /wiki/ path
: TBD
* "URLs don't need to be pretty"
: TBD
== Resources ==
* https://www.w3.org/TR/cooluris/
* https://www.w3.org/TR/dwbp/#UniqueIdentifiers
* https://www.w3.org/TR/ld-bp/#HTTP-URIS
* https://data.gov.uk/resources/uris
* http://philarcher.org/diary/2013/uripersistence/#minimal
* https://www.w3.org/Provider/Style/URI.html