Documentation
¶
Overview ¶
Package scanner implements parsing Turtle data provided as a byte slice and reading it triple by triple. It handles the compact version of Turtle just as the N-triples version where each row corresponds to a single triple. It handles @base and @forms. It ignores comments and labels and data types assigned to object literals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// If set, URLs will be shortened to their relative representation to the base.
Base string
// If set, URLs will be shortened to their relative representation to the
// base of the prefix on match, and the prefix applied. Resource tags ("<>")
// will be omitted from this representation.
Prefixes map[string]string
}
Options changes the behavior of the scanner. It is passed to NewWithOptions.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner uses bufio.Scanner to parse the provided byte slice word by word. It keeps information about prefixes and base of the provided graph and the next triple to be read.
func NewWithOptions ¶
func (*Scanner) Base ¶
Base returns empty string in case there was no base specified in the so far scanned content and returns the string of the base prefix in case there was.
func (*Scanner) Next ¶
Next tries to extract a next triple or multiple triples from the provided data, when succesful it stores the new triples and returns true. If not it returns false. Another calls to Next would also return false.
func (*Scanner) TripleWithAnnotations ¶
TripleWithAnnotations returns the next triple with label and datatype