rinne_graph 0.7.0 copy "rinne_graph: ^0.7.0" to clipboard
rinne_graph: ^0.7.0 copied to clipboard

A SQLite-based embedded graph database library for Dart.

example/example.dart

import 'package:rinne_graph/rinne_graph.dart';

/// Minimal console Quickstart example for RinneGraph.
///
/// Run: dart run example/example.dart
Future<void> main() async {
  // 1) Open an in-memory database
  final graph = await Graph.openInMemory();

  // 2) Create a tiny graph in a transaction
  await graph.transaction((txn) async {
    final marko = await txn.createVertex(
      Vertex(labels: {'person'}, properties: {'name': 'marko'}),
    );
    final josh = await txn.createVertex(
      Vertex(labels: {'person'}, properties: {'name': 'josh'}),
    );
    await txn.createEdge(
      Edge(
          labels: {'knows'},
          properties: {},
          fromVertexId: marko.id!,
          toVertexId: josh.id!),
    );
  });

  // 3) Run a simple traversal
  final g = graph.traversal();
  final names = await g
      .V()
      .hasLabel(['person'])
      .hasKey('name', 'marko')
      .out(['knows'])
      .values(['name'])
      .toList();

  print(names); // => ['josh']

  // 4) Close the database
  await graph.close();
}
1
likes
150
points
8
downloads

Publisher

verified publisherszktty.jp

Weekly Downloads

A SQLite-based embedded graph database library for Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

args, collection, csv, equatable, expressions, json_annotation, meta, path, sqflite_common_ffi, sqlite3, yaml

More

Packages that depend on rinne_graph