Documentation
¶
Overview ¶
Example (Example1) ¶
package main
import (
"embed"
"fmt"
_ "embed"
nt "github.com/0x51-dev/rdf/ntriples"
)
var example1 string
func main() {
doc, _ := nt.ParseDocument(example1)
fmt.Println(doc)
}
Output: <http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> . _:subject1 <http://an.example/predicate1> "object1" . _:subject2 <http://an.example/predicate2> "object2" .
Index ¶
Examples ¶
Constants ¶
View Source
const MediaType = "application/n-triples"
Variables ¶
This section is empty.
Functions ¶
func ToggleValidation ¶
func ToggleValidation(enabled bool)
ToggleValidation enables/disables validation of IRIs.
Types ¶
type BlankNode ¶
type BlankNode string
type Document ¶
type Document []Triple
func ParseDocument ¶
func (Document) Equal ¶
Equal returns true if the document is equal to the given value. NOTE: blank nodes will be compared, not by value, but by relation in the document.
func (Document) NormalizeBlankNodes ¶
type IRIReference ¶
type IRIReference string
func ParseIRIReference ¶
func ParseIRIReference(n *parser.Node) (*IRIReference, error)
func ParsePredicate ¶
func ParsePredicate(n *parser.Node) (*IRIReference, error)
func (IRIReference) Equal ¶
func (r IRIReference) Equal(v any) bool
Equal returns true if the IRI reference is equal to the given value.
func (IRIReference) IsValid ¶
func (r IRIReference) IsValid() bool
func (IRIReference) String ¶
func (r IRIReference) String() string
type Literal ¶
type Literal struct {
Value string
Reference *IRIReference
Language string
}
type Subject ¶
type Subject interface {
Equal(v any) bool
fmt.Stringer
// contains filtered or unexported methods
}
Subject is either an IRI or a blank node.
Click to show internal directories.
Click to hide internal directories.