Documentation ¶
Overview ¶
Package rdf implements functions for serializing/deserializing to/from ttl and json-ld as well as conversion of triples to a graph structure.
Index ¶
- Variables
- func EncodeJSONLD(triple []Triple, output io.Writer) (err error)
- func EncodeTTL(triple []Triple, output io.Writer) (err error)
- type BlankNode
- type Edge
- type Graph
- func (graph *Graph) Merge(gIn *Graph) (err error)
- func (graph *Graph) String() (ret string)
- func (graph *Graph) SubGraph(nodes ...*Node) (g Graph)
- func (graph *Graph) ToGraphvizDot(output io.Writer, replace map[string]string, nodeShape map[string]string) (err error)
- func (graph *Graph) ToTriples() (ret []Triple)
- type IRI
- type Literal
- type Node
- type Object
- type Predicate
- type Subject
- type Term
- type TermType
- type Triple
Constants ¶
This section is empty.
Variables ¶
var ( // XsdString string XsdString = "http://www.w3.org/2001/XMLSchema#string" // XsdBoolean bool XsdBoolean = "http://www.w3.org/2001/XMLSchema#boolean" // XsdDecimal float XsdDecimal = "http://www.w3.org/2001/XMLSchema#decimal" // XsdInteger int XsdInteger = "http://www.w3.org/2001/XMLSchema#integer" // XsdDouble float XsdDouble = "http://www.w3.org/2001/XMLSchema#double" // XsdTime time XsdTime = "http://www.w3.org/2001/XMLSchema#time" // XsdDate time XsdDate = "http://www.w3.org/2001/XMLSchema#date" // XsdDateTime time XsdDateTime = "http://www.w3.org/2001/XMLSchema#dateTime" // XsdDateTimeStamp time XsdDateTimeStamp = "http://www.w3.org/2001/XMLSchema#dateTimeStamp" // XsdYear time XsdYear = "http://www.w3.org/2001/XMLSchema#gYear" // XsdMonth time XsdMonth = "http://www.w3.org/2001/XMLSchema#gMonth" // XsdDay time XsdDay = "http://www.w3.org/2001/XMLSchema#gDay" // XsdYearMonth time XsdYearMonth = "http://www.w3.org/2001/XMLSchema#gYearMonth" // XsdDuration time XsdDuration = "http://www.w3.org/2001/XMLSchema#Duration" // XsdByte byte XsdByte = "http://www.w3.org/2001/XMLSchema#byte" )
IRIs of different literal datatype
Functions ¶
func EncodeJSONLD ¶
EncodeJSONLD encodes triples in json ld format
Types ¶
type BlankNode ¶
type BlankNode struct {
// contains filtered or unexported fields
}
BlankNode is a possible RDF term
func NewBlankNode ¶
NewBlankNode returns an blanknode object with specified name
func (BlankNode) SerializeTTL ¶
SerializeTTL serializes blank node in ttl format
type Graph ¶
Graph is a rdf grapgh containing nodes and edges
func (*Graph) SubGraph ¶
SubGraph returns a graph containing the specified nodes and all transitive objects
type IRI ¶
type IRI struct {
// contains filtered or unexported fields
}
IRI is a possible RDF term
func (IRI) SerializeTTL ¶
SerializeTTL serializes IRI in ttl format
type Literal ¶
type Literal struct {
// contains filtered or unexported fields
}
Literal is a possible RDF term
func NewLiteral ¶
NewLiteral returns a literal
func (Literal) SerializeTTL ¶
SerializeTTL serializes Literal in ttl format
func (Literal) ToDuration ¶
ToDuration converts a literal to time.Duration if possible
type Predicate ¶
type Predicate interface { Term }
Predicate represents the predicate of a rdf triple
type Term ¶
type Term interface { Type() (typ TermType) String() (str string) SerializeTTL(prefix map[string]string) (str string) }
Term represents an RDF term. possible types: Blank node, Literal and IRI.