 |
Textual representation
Although graphing can be useful for reinforcing our directed graph representation, we ultimately need a textual representation.
Terminology
  | Keywords: A keyword is an alphanumeric string that may contain underscores but not spaces. We'll also use symbols such as = as keywords. |
  | Entity: An entity is analagous to a node in a graph. A keyword can be associated with an entity, but the same keyword can't be used to identify more than one entity. |
  | Connection: A connection is analagous to an edge, and can be non-directional, uni-directional, or bi-directional. |
  | Relationship: A relationship has seven parts: |
 |   | A node to represent the instance of the relationship |
 |   | A non-directinoal connection from the first entity (ex. Daniel) |
 |   | A connection to the second entity (ex. person). This is often a directional connection, but can also be non-directional. |
 |   | A non-directional connection to the type of relationship (ex. is_a) |
Entities
An entity can be defined by simply listing a keyword on its own line. For example, the following six entities can be defined like this:
is_a has 1 Daniel person first_name |
|
Note that while entities can be explicitly defined, they are implicitly defined if and when they are first used in a connection or relationship.
Connections
A non-directional connection can be defined like this:
This results in a non-directional connection between x and y.
A uni-directional connection can be defined like this:
A bi-directional connection can be defined like this:
Note that while connections can be explicitly defined, they are most often implicitly defined when relationships are used.
Relationships
A non-directinoal relationship can be defined like this:
This implies the following entities:
It also implies the following connections, where x is an un-named node in the graph:
Daniel - x x - friend x - Graham |
|
A uni-directinoal relationship can be defined like this:
The greater than sign acts like an arrow to represent the direction. This implies the following entities:
It also implies the following connections, where x is a new, un-named node in the graph:
Daniel - x x - is_a x -> person |
|
Since certain relationships, such as is_a and has are used so often, we will hard code into our system the fact that they are directional so that we don't have to specify the arrow each time. |
|
 |