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 them — Wictionary
Datatypes have syntactic significance:
"http:/tei.wwp.northeastern.edu/" a valid value?"401-863-38"?"here there everywhere" one thing or
three?They also have semantic significance:
1 = 01?"1" mean male?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.