Schema
PuppyGraph uses schemas to structure the concepts (vertices and edges) within a graph.
Graph Concepts
Vertices
Vertices (also known as nodes) are the fundamental units of which graphs are formed. Think of them as points in a space where each point can represent an object, a person, a place, or any abstract concept. Vertices can have properties. For example, if a vertex represents a person, its properties might include name: John Doe
, age: 30
, and occupation: Software Engineer
.
Edges
Edges are the connections between vertices. They signify relationships or interactions between the vertices. In a simple graph, an edge might just be a line connecting two vertices.
Similar to vertices, edges can have properties. These properties can describe the nature or characteristics of the relationship. For example, if an edge represents a friendship between two people, it might have properties like since: 2010
, indicating when the friendship began.
Modeling Data into Concepts
Modeling Vertices from Tables
- All the rows for a specific vertex type needs to come from a single table.
- Each vertex table needs to have an identifier column.
Modeling Edges from Tables
PuppyGraph uses a directional edge model, indicating a relationship from one vertex (the source) to another (the target).
- All the rows for a specific edge type needs to come from a single table.
- Each edge table needs to have an identifier column.
- Each edge table needs to have columns corresponding to the ids of its end vertices.
JSON Representation
PuppyGraph has a JSON representation for its schemas.
Field | Type | Description |
---|---|---|
label | string | A user-provided name for reference in edges and queries |
mappedTableSource | MappedTableSource | Specifies how vertex maps to catalog |
attributes | []Attribute | Specifies additional attribute for queries. |
Field | Type | Description |
---|---|---|
label | string | A user-provided name for reference in queries |
from | string | The from vertex label |
to | string | The to vertex label |
mappedTableSource | MappedTableSource | Specifies how edge maps to catalog |
attributes | []Attribute | Specifies additional attribute for queries |
Field | Type | Description |
---|---|---|
catalog | string | Catalog name matches the specified catalog schema. |
schema | string | Schema name matches the schema inside the catalog. |
table | string | Table name matches the table inside the catalog. |
metaFields (Vertex) | object{"id" :"string"} | The vertex id fields inside the data source table. The id field must be string and unique. |
metaFields (Edge) | object
|
|
Field | Type | |
---|---|---|
name | string | The field name. The name must match the field name inside the data source table. |
type | string | The data type of the attribute. |
Building a Schema
The JSON form of the schema is comprehensive but verbose. To build a schema, it is recommended to use the Graph Schema Builder provided in PuppyGraph web UI.