package yams:plugins/graph-adapter-v1@1.0.0 /// GraphAdapter v1 — Property-Graph access for YAMS plugins/SDKs /// /// Notes /// - Read-focused interface with optional import/export and delta apply. /// - Iteration uses cursor handles to support large graphs without materializing all data. /// - Properties are represented as a simple key/value variant. interface types { /// Opaque identifiers type id = string; /// Property value variant variant value { null, bool(bool), i64(s64), f64(float64), string(string), bytes(list), } record kv { key: string, val: value, } record node { id: id, labels: list, props: list, } record edge { id: id, src: id, dst: id, label: option, weight: option, props: list, } record graph-stats { num-nodes: u64, num-edges: u64, } record graph-info { id: id, name: string, directed: option, stats: option, } record capabilities { read-only: bool, multigraph: bool, weighted: bool, delta: bool, provenance: bool, views: bool, export-formats: list, import-formats: list, } /// Paged results for iteration record node-page { items: list, done: bool } record edge-page { items: list, done: bool } } interface graph-adapter { use types.{id, graph-info, capabilities, node-page, edge-page}; /// Report adapter capabilities and supported formats. get-capabilities: func() -> capabilities; /// Enumerate available graphs. list-graphs: func() -> list; /// Fetch latest metadata for a graph (counts, flags, etc.). get-graph-info: func(graph: id) -> graph-info; /// Begin node iteration for a graph. Optional filter expressed as JSON (adapter-defined). nodes-begin: func(graph: id, filter-json: option) -> u64; nodes-next: func(cursor: u64, limit: u32) -> node-page; nodes-end: func(cursor: u64); /// Begin edge iteration for a graph. Optional filter expressed as JSON (adapter-defined). edges-begin: func(graph: id, filter-json: option) -> u64; edges-next: func(cursor: u64, limit: u32) -> edge-page; edges-end: func(cursor: u64); /// Export a graph to a portable format (e.g., "graphjson", "graphml", "edge-list", "cytoscape"). /// Returns a binary blob containing the exported data. export-graph: func(graph: id, format: string, options-json: option) -> list; /// Import a graph from a portable format. Returns the created/updated graph id. import-graph: func(format: string, data: list, options-json: option) -> id; /// Apply Graph Delta (JSON/JSONL string) to an existing graph. Returns number of operations applied. apply-delta-json: func(graph: id, delta-jsonl: string) -> u32; } world graph-adapter-v1 { export graph-adapter; }