rdf

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: 1 Imported by: 3

Documentation

Overview

Package rdf provides primitives to work with RDF

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingsGroup

type BindingsGroup struct {
	Bindings map[string]Node
}

BindingsGroup represents a group of bindings, a pair (variable, RDF term), as described in SPARQL 1.1 language reference.

SPARQL 1.1 reference : https://www.w3.org/TR/sparql11-query/

func NewBindingsGroup

func NewBindingsGroup() BindingsGroup

NewBindingsGroup creates a new BindingsGroup.

func (BindingsGroup) Clone

func (b BindingsGroup) Clone() BindingsGroup

Clone creates a duplicate of the group of bindings

func (BindingsGroup) Equals

func (b BindingsGroup) Equals(other BindingsGroup) (bool, error)

Equals is a function that compare two group of bindings and return True if they are equals, False otherwise.

type BlankNode

type BlankNode struct {
	Value string
}

BlankNode represents a Blank Node in a RDF Graph.

RDF Blank Node reference : https://www.w3.org/TR/rdf11-concepts/#section-blank-nodes

func NewBlankNode

func NewBlankNode(variable string) BlankNode

NewBlankNode creates a new Blank Node.

func (BlankNode) Equals

func (b BlankNode) Equals(n Node) (bool, error)

Equals is a function that compare a Blank Node with another RDF Node and return True if they are equals, False otherwise.

func (BlankNode) String

func (b BlankNode) String() string

Serialize a Blank Node to string and return it.

type Literal

type Literal struct {
	Value string
	Type  string
	Lang  string
}

Literal represents a Literal node in a RDF Graph.

RDF Literal reference : https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal

func NewLangLiteral

func NewLangLiteral(value, lang string) Literal

NewLangLiteral returns a new Literal with a language.

func NewLiteral

func NewLiteral(value string) Literal

NewLiteral creates a new Literal.

func NewTypedLiteral

func NewTypedLiteral(value, xmlType string) Literal

NewTypedLiteral returns a new Literal with a type.

func (Literal) Equals

func (l Literal) Equals(n Node) (bool, error)

Equals is a function that compare a Literal with another RDF Node and return True if they are equals, False otherwise.

func (Literal) String

func (l Literal) String() string

Serialize a Literal to string and return it.

type Node

type Node interface {
	Equals(n Node) (bool, error)
	String() string
}

Node represents a generic node in a RDF Grapg

RDF Graph reference : https://www.w3.org/TR/rdf11-concepts/#section-rdf-graph

type Triple

type Triple struct {
	Subject   Node
	Predicate Node
	Object    Node
}

Triple represents a RDF Triple

RDF Triple reference : https://www.w3.org/TR/rdf11-concepts/#section-triples

func NewTriple

func NewTriple(subject, predicate, object Node) Triple

NewTriple creates a new Triple.

func (Triple) Complete

func (t Triple) Complete(group BindingsGroup) Triple

Complete use a group of bindings to complete the variable in the triple pattern and then return a new completed Triple pattern

func (Triple) Equals

func (t Triple) Equals(other Triple) (bool, error)

Equals is a function that compare two Triples and return True if they are equals, False otherwise.

type URI

type URI struct {
	Value string
}

URI represents a URI node in a RDF Graph

RDF URI reference : https://www.w3.org/TR/rdf11-concepts/#section-IRIs

func NewURI

func NewURI(value string) URI

NewURI creates a new URI.

func (URI) Equals

func (u URI) Equals(n Node) (bool, error)

Equals is a function that compare a URI with another RDF Node and return True if they are equals, False otherwise.

func (URI) String

func (u URI) String() string

Serialize a URI to string and return it.

type Variable

type Variable struct {
	Value string
}

Variable represents a SPARQL variable used when querying data in a RDF graph

func NewVariable

func NewVariable(value string) Variable

NewVariable creates a new Variable.

func (Variable) Equals

func (v Variable) Equals(n Node) (bool, error)

Equals is a function that compare a Variable with another RDF Node and return True if they are equals, False otherwise. Two variables are equals if they have the same value, and a variable is always equals to any other RDF node.

func (Variable) String

func (v Variable) String() string

Serialize a Variable to string and return it.

Jump to

Keyboard shortcuts

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