Jump to content

Wikifunctions:Type proposals/Wikidata string-based value

From Wikifunctions

This is a type proposal for the several string-like data types Wikidata supports. As Z6 and Z11 already have types on Wikifunctions, they are not listed here.

Wikimedia Commons references

There are three types that reference files on Wikimedia Commons: Commons media file, geographic shape, and tabular data.

These are not being proposed here as Commons integration is probably going to have to be a project further down the line, however here are some notes about what we would need for the types on Wikidata:

Media file

  • Mxxx is already used to refer to the media entity internally, that could be used for references
  • All file formats have different data and structure, so it would be nice to have a different type for each file format
  • Files have structured data, it would be nice if that could be accessed
    • This would include captions and statements
  • The file names should be accessible
  • Some files have associated TimedText pages, it would be nice to be able to access those

Geographic shape

(See mw:Help:Map data)

  • The JSON structure could be copied over
  • Some way to resolve names will be needed

Tabular data

(See mw:Help:Tabular_data)

  • The JSON structure could be copied over
  • Some way to resolve names will be needed

Structure

All of the types being proposed here are represented as plain strings on Wikidata. As such, there representation here will be an object with a single additional key of type Z6/String.

External identifier

External identifiers do not add any semantics to a string

Validator

The validator will not check anything about the string

Converting to code

Python

It will be represented as a string

Javascript

It will be represented as a string

Parser

The parser will take a standard string of any format

Renderer

The renderer will return the contained string

URL

Validator

The validator will check that it is a proper URL

Converting to code

Python

As python does have a standard URL type, it will be represented as a string

Javascript

As javascript does not have a standard URL type that is available, it will be represented as a string

Parser

The parser will take a URL and convert it to the URL type

Renderer

The renderer will output the URL as a string. Later on, it will become a link to that URL

Mathematical expression

Validator

The validator will check that there are no syntax errors

Converting to code

Python

It will be represented as a string

Javascript

It will be represented as a string

Parser

The parser will take an expression and wrap it into a mathematical expression

Renderer

The renderer will output the expression as a string. Later on, it will rendered like it is on Wikidata.

Musical notation

Validator

The validator will check that there are no syntax errors

Converting to code

Python

It will be represented as a string

Javascript

It will be represented as a string

Parser

The parser will wrap the input

Renderer

The renderer will output the internal representation directly. Later on, it will be rendered as it is on Wikidata.