# Query Processing in Blockchain Systems: Current State and Future Challenges
## 3 Application Domains Identified through Literature Review
### Lessons Learned  
Derived from the presented application domains, we conclude that there are two different types of data that are entered into a blockchain. We outline their characteristics in Table 2. The first type of data entered into a blockchain is only valid at a specific point in time, which we call a _constant object_. Constant objects are, in other words, just events, such as those known from complex event processing [95]. However, there is a peculiarity in dealing with the timestamp of a constant object. This is because the timestamp can be dependent on the block in which the object is stored (i.e., an object with a _block-dependent timestamp_), or dependent on the object, because the object itself provides a timestamp attribute that must be used rather than the timestamp of the block (i.e., an object with an _object-dependent timestamp_). The second type of data entered into a blockchain is modified over time, which we call an _expandable object_. As the modifications are scattered over many blocks, they must first be combined in order to be used further. Therefore, expandable objects have only block-dependent timestamps. We use the term \"object\" to describe a set of attributes, i.e., data in the form of a set of key-value pairs, so-called fields. Although the concept of objects is mainly known in the paradigm of object orientation, this data model does not restrict us to the use of object-oriented data stores. These objects can also be represented in other data models such as _JSON documents_, _RDF triples_ (i.e., mapping the fields of an object to individual triples), or _XML instances_. Listing 1 shows an object named obj1 with three attributes and their values in those three representations. We discuss those object types further in Section 4. Furthermore, from the presented use cases, we derive eight query capabilities that an efficient query engine for blockchain systems has to support in order to be usable in the given application domains. These required capabilities are _projection_, _selection_, _sorting_, _aggregation_, _grouping_, and _joins_. These operators are well-known from the _relational algebra_, on which the query languages of many traditional database systems are based. **Listing 1. ** An object with three attributes and their values represented as a JSON document, RDF triples, and an XML instance. An object represented in the form of a JSON document named obj1. \begin{tabular}{l l} \hline \hline \{ & \begin{tabular}{l} An object represented in \\ the form of RDF triples. \\ \end{tabular} & \begin{tabular}{l} An object represented in \\ the form of RDF triples. \\ \end{tabular} \\ \hline \{ & \begin{tabular}{l} \{ \\ \"attr1\": \"_val1\"_, \\ \"attr2\": \"_val2\"_, \\ \"attr3\": \"_val3\"_ \\ \} \\ \end{tabular} & \begin{tabular}{l} An object represented in \\ the form of an XML instance. \\ \end{tabular} \\ \hline \{ & \begin{tabular}{l} \{ \\ \"attr1\": \"_val1\"_, \\ \"attr2\": \"_val2\"_, \\ \"attr3\": \"_val3\"_ \\ \} \\ \end{tabular} & \begin{tabular}{l} An object represented in \\ the form of an XML instance. \\ \end{tabular} \\ \hline \hline \{ & \begin{tabular}{l} \{ \\ \"attr2\": \"_val3\"_ \\ \} \\ \end{tabular} & \begin{tabular}{l} An object represented in \\ the form of RDF triples. \\ \end{tabular} & \begin{tabular}{l} An object represented in \\ the form of an XML instance. \\ \end{tabular} \\ \hline \{ & \begin{tabular}{l} \{ \\ \"attr1\": \"_val1\"_, \\ \"attr2\": \"_val2\"_, \\ \"attr3\": \"_val3\"_ \\ \} \\ \end{tabular} & \
\begin{tabular}{l} \{ \\ \"<obj1, attr1, \"_val1\"_'_' \\ \"<obj1, attr2, \"_val2\"_'_' \\ \"attr2\": \"_val2\"_'/attr2\"_' \\ \"attr3\": \"_val3\"_'_' \\ \end{tabular} &
\begin{tabular}{l} \{ \\ \"<obj1\"_' \\ \"attr1\"_'_' \\ \"<attr2\"_'val2\"_'/attr2\"_' \\ \"attr3\": \"val3\"_'/ attr3\"_'_' \\ \} \\ \end{tabular} \\ \hline \hline \end{tabular}   
Projection means selecting specific attributes from objects that are included in the result set, i.e., if an object has several attributes, only a specific subset of them is returned.