Skip to content

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.

FieldTypeDescription
labelstringA user-provided name for reference in edges and queries
mappedTableSourceMappedTableSourceSpecifies how vertex maps to catalog
attributes[]AttributeSpecifies additional attribute for queries.

FieldTypeDescription
labelstringA user-provided name for reference in queries
fromstringThe from vertex label
tostringThe to vertex label
mappedTableSourceMappedTableSourceSpecifies how edge maps to catalog
attributes[]AttributeSpecifies additional attribute for queries

FieldTypeDescription
catalogstringCatalog name matches the specified catalog schema.
schemastringSchema name matches the schema inside the catalog.
tablestringTable 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
{

"id" :"string",

"from":"string",

"to" :"string"

}

  • id - The edge id fields inside the data source table. The id field must be string and unique.
  • from, to - The from, to fields inside the data source table. The from and to field must be the id of the specified vertex.

FieldType
namestringThe field name. The name must match the field name inside the data source table.
typestringThe 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.