graph

package
v0.0.0-...-a35f667 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graph provides various implementation for a RDF Graph

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph interface {
	// Add a new Triple pattern to the graph.
	Add(triple rdf.Triple)
	// Delete triples from the graph that match a BGP given in parameters.
	Delete(subject, predicate, object rdf.Node)
	// Fetch triples form the graph that match a BGP given in parameters.
	Filter(subject, predicate, object rdf.Node) <-chan rdf.Triple
	// Same as Filter, but with a Limit and an Offset
	FilterSubset(subject rdf.Node, predicate rdf.Node, object rdf.Node, limit int, offset int) <-chan rdf.Triple
}

Graph represents a generic RDF Graph

Package graph provides several implementations for this interface. RDF Graph reference : https://www.w3.org/TR/rdf11-concepts/#section-rdf-graph

type ListGraph

type ListGraph struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

ListGraph is implementation of a RDF Graph, using a slice to store RDF Triples.

func NewListGraph

func NewListGraph() *ListGraph

NewListGraph creates a new List Graph.

func (*ListGraph) Add

func (g *ListGraph) Add(triple rdf.Triple)

Add a new Triple pattern to the graph.

func (*ListGraph) Delete

func (g *ListGraph) Delete(subject, predicate, object rdf.Node)

Delete triples from the graph that match a BGP given in parameters.

func (*ListGraph) Filter

func (g *ListGraph) Filter(subject, predicate, object rdf.Node) <-chan rdf.Triple

Filter fetch triples form the graph that match a BGP given in parameters.

func (*ListGraph) FilterSubset

func (g *ListGraph) FilterSubset(subject rdf.Node, predicate rdf.Node, object rdf.Node, limit int, offset int) <-chan rdf.Triple

FilterSubset fetch triples form the graph that match a BGP given in parameters. It impose a Limit(the max number of results to be send in the output channel) and an Offset (the number of results to skip before sending them in the output channel) to the nodes requested.

func (ListGraph) LoadFromFile

func (r ListGraph) LoadFromFile(filename string, format string) error

LoadFromFile loads triples from a file into a graph, with a given format In the desired format isn't supported or doesn't exist, no new triples will be inserted into the graph and an error will be returned.

type TreeGraph

type TreeGraph struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

TreeGraph is a implementation of a RDF Graph based on the HDT-MR model proposed by Giménez-García et al.

For more details, see http://dataweb.infor.uva.es/projects/hdt-mr/

func NewTreeGraph

func NewTreeGraph() *TreeGraph

NewTreeGraph creates a new empty Tree Graph.

func (*TreeGraph) Add

func (g *TreeGraph) Add(triple rdf.Triple)

Add a new Triple pattern to the graph.

func (*TreeGraph) Delete

func (g *TreeGraph) Delete(subject, predicate, object rdf.Node)

Delete triples from the graph that match a BGP given in parameters.

func (*TreeGraph) Filter

func (g *TreeGraph) Filter(subject, predicate, object rdf.Node) <-chan rdf.Triple

Filter fetch triples form the graph that match a BGP given in parameters.

func (*TreeGraph) FilterSubset

func (g *TreeGraph) FilterSubset(subject rdf.Node, predicate rdf.Node, object rdf.Node, limit int, offset int) <-chan rdf.Triple

FilterSubset fetch triples form the graph that match a BGP given in parameters. It impose a Limit(the max number of results to be send in the output channel) and an Offset (the number of results to skip before sending them in the output channel) to the nodes requested.

func (TreeGraph) LoadFromFile

func (r TreeGraph) LoadFromFile(filename string, format string) error

LoadFromFile loads triples from a file into a graph, with a given format In the desired format isn't supported or doesn't exist, no new triples will be inserted into the graph and an error will be returned.

Jump to

Keyboard shortcuts

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