knowledge

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package knowledge provides protocol knowledge graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From     string       `json:"from"`
	To       string       `json:"to"`
	Relation RelationType `json:"relation"`
}

Edge represents a knowledge graph edge.

type Graph

type Graph struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

Graph represents a protocol knowledge graph.

func NewGraph

func NewGraph() *Graph

NewGraph creates a new knowledge graph.

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to string, rel RelationType)

AddEdge adds an edge.

func (*Graph) AddNode

func (g *Graph) AddNode(id, typ, name string)

AddNode adds a node.

func (*Graph) Describe

func (g *Graph) Describe() string

Describe returns a text description.

func (*Graph) Query

func (g *Graph) Query(nodeID string) []Edge

Query finds nodes related to a given node.

func (*Graph) ToMermaid

func (g *Graph) ToMermaid() string

ToMermaid generates a Mermaid graph.

type Node

type Node struct {
	ID   string `json:"id"`
	Type string `json:"type"` // protocol, rfc, org, usecase
	Name string `json:"name"`
}

Node represents a knowledge graph node.

type RelationType

type RelationType string

RelationType represents a relationship type.

const (
	RelEncapsulates RelationType = "encapsulates"
	RelDefinedBy    RelationType = "defined_by"
	RelUsedIn       RelationType = "used_in"
	RelSucceeds     RelationType = "succeeds"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL