I am trying to plan a framework for relational algebra using the Dataset capability of Mathematica 10.
In the work of Date and Darwen, there are two concepts known as TABLE_DEE and TABLE_DUM. TABLE_DEE is a relation with a (column) header but no rows, whereas TABLE_DUM is simply:
Dataset[{}]
How might I create a TABLE_DEE with Dataset--a table with headers, but no data? I feel this would allow a framework for performing orthodox relational database operations.
Answer
You have to use the undocumented (and subject-to-change) syntax for specifying a type or schema:
Needs["TypeSystem`"];
Dataset[
{},
Vector @ Struct[
"field1" -> Atom[Integer],
"field2" -> Atom[String]
]
]
Replace the contents of the inner Struct
as you see fit (you can always use TypeSystem`DeduceType on a chunk of data obeying your desired schema to see more examples of these type expressions).
Comments
Post a Comment