nquads

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 15

Documentation

Overview

Package nquads implements parsing the RDF 1.1 N-Quads like line-based syntax for RDF datasets.

Typed parsing is performed as based on a simplified grammar derived from the N-Quads grammar defined by http://www.w3.org/TR/n-quads/.

Raw parsing is performed as defined by http://www.w3.org/TR/n-quads/ with the exception that parser will allow relative IRI values, which are prohibited by the N-Quads quad-Quads specifications.

For a complete definition of the grammar, see cquads.rl and nquads.rl.

Index

Constants

This section is empty.

Variables

View Source
var AutoConvertTypedString = true

AutoConvertTypedString allows to convert TypedString values to native equivalents directly while parsing. It will call ToNative on all TypedString values.

If conversion error occurs, it will preserve original TypedString value.

View Source
var DecodeRaw = false

Functions

func Parse

func Parse(statement string) (quad.Quad, error)

ParseTyped returns a valid quad.Quad or a non-nil error. ParseTyped does handle comments except where the comment placement does not prevent a complete valid quad.Quad from being defined.

func ParseRaw

func ParseRaw(statement string) (quad.Quad, error)

ParseRaw returns a valid quad.Quad or a non-nil error. ParseRaw does handle comments except where the comment placement does not prevent a complete valid quad.Quad from being defined.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader implements N-Quad document parsing according to the RDF 1.1 N-Quads specification.

func NewReader

func NewReader(r io.Reader, raw bool) *Reader

NewReader returns an N-Quad decoder that takes its input from the provided io.Reader.

func (*Reader) Close

func (dec *Reader) Close() error

func (*Reader) ReadQuad

func (dec *Reader) ReadQuad() (quad.Quad, error)

ReadQuad returns the next valid N-Quad as a quad.Quad, or an error.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer implements N-Quad document generator according to the RDF 1.1 N-Quads specification.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns an N-Quad encoder that writes its output to the provided io.Writer.

func (*Writer) Close

func (enc *Writer) Close() error

func (*Writer) WriteQuad

func (enc *Writer) WriteQuad(q quad.Quad) error

func (*Writer) WriteQuads

func (enc *Writer) WriteQuads(buf []quad.Quad) (int, error)

Jump to

Keyboard shortcuts

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