Skip to content

Switch to schemaless open type graphs #22

@kornelrabczak

Description

@kornelrabczak

Current implementation uses strictly typed subgraphs, requiring explicit CREATE NODE TABLE and CREATE REL TABLE statements before any data can be inserted (see LadybugDBConfig.initializeSchema()):

conn.query("CREATE NODE TABLE IF NOT EXISTS Entity(name STRING PRIMARY KEY, type STRING, observations STRING[])");
conn.query("CREATE REL TABLE IF NOT EXISTS RELATED_TO(FROM Entity TO Entity, relationType STRING)");

This forces a pre-defined schema. LadybugDB supports open type graphs which allow creating nodes with arbitrary labels without first defining tables:

CREATE GRAPH my_graph ANY;
USE my_graph;
-- No CREATE NODE TABLE needed!
CREATE (u:User {name: 'Alice'});
CREATE (p:Project {name: 'Archiledger', language: 'Java'});

Motivation

  • Flexible entity types, users can define any entity type without schema changes
  • Dynamic properties, entities can have varying properties per type
  • Reduced boilerplate, no need for initializeSchema() or upfront table definitions
  • Better fit for knowledge graphs, knowledge graphs are inherently schemaless; entities from different domains have different shapes
  • Neo4j/GQL compatibility, open type graphs provide familiar behavior for users migrating from Neo4j

Considerations

  • Open type graphs may have slightly different performance characteristics
  • Decide whether to keep strict typing as an opt-in mode for users who want schema guarantees

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.2.xIssues for the 0.2 releaseenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions