# About Ontologies

% Remco Bloemen % 2010-06-05, last updated 2014-03-04

## About Ontologies

### Ontology of relations

Statements Interpretation

Nonary statements (propositions) true (true) Humans are mortal (humansAreMortal) Unary relations (predicates) X exists (exist X) X is heavy (isHeavy X) X is green (isGreen X) Binary relations (triples) X equals Y (equals X Y) X likes Y (like X Y) X’s weight is Y (weight X Y) X’s colour is Y (colour X Y) Ternary relations X was introduced to Y by Z (introducedToBy X Y Z) X bought Y from Z (boughtFrom X Y Z) X is between Y and Z (between X Y Z) Higher order relations: X loaned Y from Z between Q and R in exchange for S (loanedFromBetweenFor X Y Z Q R S) Variable relations X has friends A and B and C and … (friends X A B C …) X prefers A then B then C … (preference X A B C …)

#### Higher order relations:

X loaned Y from Z between Q and R in exchange for S.

X: Person Y: Object Z: Person Q: Time R: Time S: Object

X thinks (statement)

X heard (statement)

### Ontologies in programming languages

c = mul(a, b)

(q, r) = div(n, d)

(x, y) = extended_gcd(a, b)


### Layer 1: Nodes

The entire data set consists of a set of nodes, $mathcal N$. The nodes contain a bitstring value, but have an identity separate of their value (so two different nodes can have the same bitstring).

This is everything there is to know about layer one.

### Layer 2: Tuples

In layer two the value of some nodes are intepretted to represent tuples of nodes, $left(n_1, n_2, dots right)$ where $n_i in mathcal N$.

### Old version:

$$left( mathcal N, mathcal R right)$$

Where $mathcal N$ is a set of nodes, which contain a bitstring $B(n)$.

Where $mathcal R$ is a set of relations of the form:

$$left(n_1, n_2, dots right) where n_i in mathcal N$$

The first object is interpreted as the kind of relation.

The second object is interpreted as the object of a relation and

That is, ordered lists of two or more nodes. This can represent a variety of statements such as:

$$left(n_{statement}right)$$

$$left(n_{predicate}, n_{subject}right)$$

$$left(n_{verb}, n_{subject}, n_{object}right)$$

$$left(n_{property}, n_{subject}, n_{value}right)$$

$$left(n_{function}, n_{variable}, n_{variable}, n_{variable}, n_{variable}right)$$

Node: a bitstring, can be zero to N bits long, in increments of eight. Interpretation depends on other information available, but the following encodings are recommended: DateTime, UTF-8.

Equivalence of content does not mean that the nodes are identical. The nodes have their own identity. How this identity is achieved (i.e. by an unique identification number, memory pointer or other means) is an implementation detail which should be hidden from the programmer.

Tuple: Represents a statement. It is a list of minimal two nodes, the first node represents the subject of the node, the second represents the property described to the first node. The other nodes are optional parameters to this property.

Example use cases are

(UserJoe, IsMale) or (UserJoe, Gender, Male)

(IsMale, UserJoe) or (Gender, UserJoe, Male)

(FavoriteBands, UserJoe, Beatles, RollingStones, Metallica, ACDC)


### Reification

The following example defines a node wich represents the statement "Humans are mortal":

(humansAreMortal isa statement)

(humansAreMortal verb are)

(humansAreMortal subject humans)

(humansAreMortal object mortal)


With this node defined, one can now claim that humans are mortal:

(humansAreMortal)


Which is a reification of the statement:

(are humans mortal)


### Binding

The previous example can be considered as a special case of binding, where all variables are bound.

### Queries

Basic queries, should be O(1):

• Does (predicate, object) exist?

• Does (verb, object, subject) exist?

• For which value does (property, object, value) exist?

• For which values (x1, x2, …) does (property, object, x1, x2, …) exist?

More advanced, maximum O(n):

• For which objects does (predicate, object) exist?

• For which objects does (predicate, object) exist?

### The element of change/time

• Change the nodes

• Create node

• Delete node

• Replace node value

• Change the relations

• Create relation

• Delete relation

• Replace relation predicate

• Replace relation subject

• Change the argument

• Change the argument

• Add node at position

• Remove node from position

• Swap node positions

### Random stuff

x = n × ( n + 1 ) / 2 = x ÷ × n + n 1 2

(t1 + n 1) (t2 × n t1) (x ÷ t2 2)

(x ÷ (. × n (. + n "1")) "2")

### Example using unicode string instead of bitstrings

""[
. "Type"[]
. "Name"[]
. "Male"[]
. "User"[]

. ""[
. Type User
. Name "Joe"[]
. Male
]
]


Remco Bloemen
Math & Engineering
https://2π.com