nquads

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Example (Example1)
package main

import (
	"embed"
	"fmt"

	_ "embed"
	nq "github.com/0x51-dev/rdf/nquads"
)

var example1 string

func main() {
	doc, _ := nq.ParseDocument(example1)
	fmt.Println(doc)
}
Output:

<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> <http://example.org/graph3> .
_:subject1 <http://an.example/predicate1> "object1" <http://example.org/graph1> .
_:subject2 <http://an.example/predicate2> "object2" <http://example.org/graph5> .

Index

Examples

Constants

View Source
const (
	// MediaType with an encoding using UTF-8.
	MediaType = "application/n-quads"
	// MediaTypeAlt with an encoding using 7-bit US-ASCII.
	MediaTypeAlt = "text/x-nquads"
)

Variables

This section is empty.

Functions

func ParseGraphLabel

func ParseGraphLabel(n *parser.Node) (nt.Subject, error)

Types

type Document

type Document []Quad

func ParseDocument

func ParseDocument(doc string) (Document, error)

func (Document) Equal

func (d Document) Equal(other Document) bool

func (Document) Graphs

func (d Document) Graphs() map[string]nt.Document

func (Document) Len

func (d Document) Len() int

func (Document) Less

func (d Document) Less(i, j int) bool

func (Document) NormalizeBlankNodes

func (d Document) NormalizeBlankNodes() Document

func (Document) String

func (d Document) String() string

func (Document) Swap

func (d Document) Swap(i, j int)

type Quad

type Quad struct {
	nt.Triple
	GraphLabel nt.Subject
}

func NewQuadFromTriple

func NewQuadFromTriple(t nt.Triple, graphLabel nt.Subject) Quad

func ParseQuad

func ParseQuad(n *parser.Node) (*Quad, error)

func (Quad) String

func (q Quad) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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