graph

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(g *Graph, stmt Statement) bool

func Count

func Count(g *Graph) int

func Insert

func Insert(g *Graph, statements ...Statement) error

func Remove

func Remove(g *Graph, predicate func(Statement) bool) error

Types

type EdgeType

type EdgeType struct {
	Name       string
	Domain     string
	Range      string
	ScopeType  string
	Inherit    string
	Transitive bool
	Symmetric  bool
	Inverse    string
}

type Entity

type Entity struct {
	Name    string
	Content string
	HasFile bool
}

type Graph

type Graph struct {
	Statements    []Statement
	Entities      map[string]*Entity
	Relationships map[string]*Relationship
	Schema        *Schema
	Subgraphs     map[string][]Statement
	// contains filtered or unexported fields
}

func CrossProduct

func CrossProduct(g1, g2 *Graph) *Graph

func Difference

func Difference(g1, g2 *Graph) *Graph

func Distinct

func Distinct(g *Graph) *Graph

func Intersection

func Intersection(g1, g2 *Graph) *Graph

func Join

func Join(g1, g2 *Graph, onField string) *Graph

func New

func New(dbPath string) (*Graph, error)

func Project

func Project(g *Graph, fields ...string) *Graph

func Rename

func Rename(g *Graph, oldName, newName string, targetType string) *Graph

func Restrict

func Restrict(g *Graph, predicate func(Statement) bool) *Graph

func Union

func Union(g1, g2 *Graph) *Graph

func (*Graph) AddStatement

func (g *Graph) AddStatement(stmt Statement) error

func (*Graph) GetEntity

func (g *Graph) GetEntity(name string) (*Entity, bool)

func (*Graph) GetRelationship

func (g *Graph) GetRelationship(name string) (*Relationship, bool)

func (*Graph) ListEntities

func (g *Graph) ListEntities() []string

func (*Graph) ListSubgraphs

func (g *Graph) ListSubgraphs() []string

func (*Graph) Load

func (g *Graph) Load() error

func (*Graph) Query

func (g *Graph) Query(subject, relationship, object string) []Statement

func (*Graph) QueryWithScope

func (g *Graph) QueryWithScope(subject, relationship, object, scope string) []Statement

func (*Graph) SetEntity

func (g *Graph) SetEntity(name, content string) error

func (*Graph) SetRelationship

func (g *Graph) SetRelationship(name, content string) error

func (*Graph) String

func (g *Graph) String() string

type Relationship

type Relationship struct {
	Name    string
	Content string
	HasFile bool
}

type Schema

type Schema struct {
	NodeTypes map[string]map[string]string
	EdgeTypes map[string]*EdgeType
}

type Statement

type Statement struct {
	Subject      string
	Relationship string
	Object       string
	Scope        string
	Label        string
	Reflexive    bool
	SourceFile   string
	LineNumber   int
}

func ParseStatements

func ParseStatements(content, subgraph, sourceFile string, lineNum int) []Statement

Jump to

Keyboard shortcuts

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