Datatypes

Datatype: a classification or category of various types of data, that states the possible values that can be taken, how they are stored, and what range of operations are allowed on themWictionary

Datatypes have syntactic significance:

  • Is "http:/tei.wwp.northeastern.edu/" a valid value?
  • How about "401-863-38"?
  • Is "here there everywhere" one thing or three?

They also have semantic significance:

  • Does 1 = 01?
  • Or does "1" mean male?
  • Does 2012-06-05 = 2001, or is "2012-06-05" the date of the last transit of Venus?

We saw datatypes come up in the previous slide when defining the list of possible values for the @type attribute of the <title> element. It is important to note that datatypes have syntactic significance: they affect how we parse and interpret the structure of a data value. Datatypes also can have semantic significance: they affect how we understand the meaning of a data value.

What are some examples of attribute values that you might want to constrain using a datatype?

We can test for syntactic validity, and perhaps even if values make sense (like birthdate preceding date of death); but we generally cannot test for semantic correctness. It is usually very easy to test general syntactic validity, but somewhat harder to be precise about allowed values. E.g., 90210 is a syntactically valid and semantically useful ZIP code; 90910 is syntactically valid, but meaningless (there is no "909" USPO sectional center facility). In this case, testing that a ZIP code is 5 digits is very easy, but testing that it actually matches an existing post office is somewhat harder.

Introduction to Writing ODDs slide 09 of 24
© 2010 Syd Bauman, Julia Flanders, and the Women Writers Project This TEI-encoded XML file is available under the terms of the Creative Commons Attribution-ShareAlike 3.0 (Unported) license.