Unified Object Representation
Everything that flows through a DortDB plan is one of two things: a tuple or an item.
- A tuple is a row with named attributes, just like a relational tuple. Each attribute name is a sequence of identifiers (for example, a table name plus a column name).
- An item is an opaque value. The engine makes no assumptions about its shape or schema; it could be a number, a JSON object, a graph node, or an XML fragment.
Operators consume and produce streams of these values. Keeping the representation this small is what lets one algebra serve relational, document, and graph data at once.
Definitions
The rest of this page is the precise version of the above. You don't need it to use DortDB, but the Operator Reference builds on this notation.
Item
An item is an element of an arbitrary, uninterpreted domain . The engine makes no structural commitments (schema, attribute decomposition, ...) about elements of and treats them as opaque.
Attribute name
An attribute name is a finite, non-empty sequence of identifiers , where each is a non-empty string over a fixed alphabet . The set of all attribute names is denoted .
Tuple
A tuple over a finite attribute set is a total function
The set together with an attribute ordering is the schema of , written . Every tuple an operator produces has the same schema, so we can also talk about the schema of an operator, . The set of all tuples is denoted .
Tuple concatenation
Operators that combine rows (joins, projections, ...) glue tuples together with tuple concatenation, denoted :
The combined schema keeps every attribute from both sides, ordered so that the left tuple's attributes come first:
where is defined by:
- (the left side keeps its order, and comes first);
- (then the attributes unique to the right side, in their order).
On values, when both sides share an attribute, the right side wins:
Stream
A stream is a possibly infinite, ordered sequence of values of type , denoted . Two refinements show up in operator signatures:
- produces exactly one value.
- produces one or no value.
A concrete stream is written with angle brackets, optionally as a comprehension:
The set of all streams is denoted .
Why not nested relations or property graphs?
Nested relations are a well-studied formal model, but they assume you know the full schema of every source up front, which conflicts with DortDB's schema-agnostic design. They also don't fit semi-structured or unstructured data well. Our opaque items handle those cases, while our tuples are essentially relational tuples, so there's still plenty of overlap.
Property graphs can model anything, since any data can be drawn as a graph. We chose tuples and items instead, mainly because existing work on XQuery algebra adapted cleanly to our needs.