graph

package
v0.0.0-...-7a6127a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dict

type Dict map[string]rdf.Term

Dict reference a term by its rawvalue

type Edge

type Edge struct {
	F, T graph.Node
	Term rdf.Term
}

Edge ...

func (Edge) Attributes

func (e Edge) Attributes() []encoding.Attribute

Attributes fulfills the gonum encoding Attributer

func (Edge) From

func (e Edge) From() graph.Node

From ...

func (Edge) ReversedEdge

func (e Edge) ReversedEdge() graph.Edge

ReversedEdge returns a new Edge with the F and T fields swapped.

func (Edge) To

func (e Edge) To() graph.Node

To ...

type Graph

type Graph struct {
	*simple.DirectedGraph
	// Reference of the term and their associated nodes
	Reference map[rdf.Term]*Node
	// Dict ...
	Dict map[string]rdf.Term
}

Graph is carrying the information

BUG: the simple graph does not handle multiple edges between two identical nodes

func NewGraph

func NewGraph(rdfGraph *rdf.Graph) Graph

NewGraph ...

func (*Graph) FindNode

func (g *Graph) FindNode(t rdf.Term) *Node

FindNode returns a node whose Term match t's rawstring it returns nil if no matching node is found

func (*Graph) GetTerm

func (g *Graph) GetTerm(s string) rdf.Term

GetTerm returns the term matching s (short forms are expanded according to the namespaces of the graph)

func (*Graph) ToWithEdges

func (g *Graph) ToWithEdges(n *Node, ts ...rdf.Term) graph.Nodes

ToWithEdges return al the nodes reaching n with an edge whosh subject is one of ts

type Node

type Node struct {
	Subject         rdf.Term
	PredicateObject map[rdf.Term][]rdf.Term
	// contains filtered or unexported fields
}

Node is a node of the graph, it carries n tuple associated with one subject

func (*Node) Attributes

func (n *Node) Attributes() []encoding.Attribute

Attributes fulfills the gonum encoding Attributer

func (*Node) ID

func (n *Node) ID() int64

ID of the node

Jump to

Keyboard shortcuts

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