Core Concepts/Components

Relation (Edge)

Understanding Relations as the edges in a Knowledge Graph.

See the documentation for the Relation model.

Relations as Edges in a Knowledge Graph

In a standard knowledge graph, relations are the fundamental links that connect entities. These relations are represented as edges in the graph structure. An edge defines the nature of the relationship between two nodes (entities), illustrating how they are interlinked.

Relations encode the semantics or meaning underlying these entities, often serving as the predicate in a Subject-Predicate-Object triple. For example, in the triple IBM -- HAS_CUSTOMER --> Ogilvy, HAS_CUSTOMER is the relation (edge) that defines the connection between the entities IBM and Ogilvy.

Relations in the Perseus Client

A Relation in the Perseus Client serves as an edge in the knowledge graph, defining the connection between two entities (nodes). It describes how one entity relates to another.

For instance, a Person entity might be connected to a Company entity by a relation like WORKS_FOR. This relation type itself acts as a label for the edge, representing the predicate in a Subject-Predicate-Object triple. Each Relation links a source entity to a target entity, explicitly defining a factual connection.

Relation Properties

Just like entities, Relation objects can also contain properties, which are key-value pairs providing additional attributes about the relationship. These properties are represented by LiteralValue objects and correspond to the properties field in the Relation model.

For example, a relation describing someone winning an award might have properties like the year the award was won.

Example of a Relation Object

Here is an example of a Relation object connecting an entity representing "Marie Curie" to an entity representing a "Nobel Prize in Physics" in the Perseus Client.

Relation(
    source_uri="http://example.com/person/MarieCurie",
    target_uri="http://example.com/award/NobelPrizeInPhysics",
    predicate="http://example.com/ontology/wonAward",
    properties={
        "http://example.com/ontology/year": LiteralValue(value=1903)
    },
)