Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
values.mdwn
Here we’ll discuss and define the concept of values - exactly what they are and why they are special.
The expression model uses entities to refer to things in the world. However, as mentioned earlier, there are two kinds of things:
- Things we define by referring to them
- Things we describe when referring to them
We already saw an example: A person requires a very complex data structure to define fully (whole DNA structure, precise physical shape, precise mathematical description of personality, etc.). In addition we can describe the person (e.g. John loves Anne) but that’s not part of a minimal definition which uniquely identifies the person. On the other hand, the phrase “the number 1” easily identifies the number 1 uniquely. The reference itself is also a precise definition. And here again, we can make additional descriptions which may be beyond the bare definition of the number 1, for example definitions of mathematical operations we can do with it.
The expression model divides the entities into two groups, two kinds of entities:
- Values represent things you define by referring to them
- Resources represent things you describe when referring to them
We have already discussed resources, and now it is time to talk about values. What kinds of values exist? How do we express them in a data model? How does a computer represent them? How do we use them?
First, let’s see some statements which use values:
de1785195a75aa690c6c4fc252977b0f is-a Document
de1785195a75aa690c6c4fc252977b0f is-stored-at "file:///home/john/Music/article.odt"
John Doe was-born-in 1976
John Doe has-first-name "John"
In fact, the words “Document”, “is-a”, etc. are not stored in computer memory stored triples as words, but their uid are stored. The question is whether we treat a sequence of characters as just a string, or as a uid referring to a resource.
Assuming the following uids:
- de1785195a75aa690c6c4fc252977b0f - The document we want to describe (article.odt)
- 616945da1a99c6aa118f40fd529872b5 - The person we want to describe (John Doe)
- 6c2a36d62b575675dd3f590a52987331 - is-a
- 57f84541d5b2676e6cfa66aa5298733c - Document
- dd581ccf2ec2ea99ad69ee3d52987353 - is-stored-at
- 102873fed9d5226c61d3d2ed52987363 - was-born-in
- f64a2704249b4a1fcde5fa5c52987371 - has-first-name
The four statements would actually look like this on a computer:
de1785195a75aa690c6c4fc252977b0f 6c2a36d62b575675dd3f590a52987331 57f84541d5b2676e6cfa66aa5298733c
de1785195a75aa690c6c4fc252977b0f dd581ccf2ec2ea99ad69ee3d52987353 "file:///home/john/Music/article.odt"
616945da1a99c6aa118f40fd529872b5 102873fed9d5226c61d3d2ed52987363 1976
616945da1a99c6aa118f40fd529872b5 f64a2704249b4a1fcde5fa5c52987371 "John"
You may recognize three kinds of strings here:
- UUID strings serving as uids (example: de1785195a75aa690c6c4fc252977b0f)
- Numbers (example: 1976)
- Text (example: “John”)
Even when ignoring issues of computer representations and technical details, we can think of reasons to allow databases to recognize different types:
- Some mathematical operations don’t make sense for strings
- Some properties should be limited to numbers only (e.g. weight) or strings only (e.g. name)
- Grouping kinds of values allows to talk about them specifically in separate from values as a whole
uids may look like text, but as we saw already they have a special role in the expression model: They represent resources. Thus, we are left with two kinds of entities that are not resources, i.e. are values: Numbers and text. More kinds of values are possible, e.g. date and time. We will discuss that in the next section.
Besides the division into those kinds (called types in the expression model), values have an aspect of relations and operations which can be done on them. Since by referring to them we define them, all the meaning in them (like the possbility to add, multiply and compare numbers, etc.) is defined with them and we can use it. For example, the following query requires the use of comparison (order relation):
“Give me a list of all the people who were born before 1948.”
The word before tells the machine to identify matching people by comparing their year of birth to 1948.
Values may also have conversion capabilities: For example, it is possible to convert the number 1 to the text “1”, and vice versa.