rdf

package module
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: 3 Imported by: 0

README

RDF 1.1

Test Cases

Name Report Compliance
N-Triples report.ttl 68/68 (100.0%)
N-Quads report.ttl 85/85 (100.0%)
Turtle report.ttl 288/288 (100.0%)
Trig report.ttl 332/332 (100.0%)

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlankNode

type BlankNode struct {
	Attribute string
}

BlankNode identifiers are local identifiers.

func (*BlankNode) Equal

func (b *BlankNode) Equal(other Node) bool

func (*BlankNode) GetValue

func (b *BlankNode) GetValue() string

type DataType

type DataType string
const (
	XSD                 = "http://www.w3.org/2001/XMLSchema#"
	XSDAnyType DataType = XSD + "anyType"
	XSDBoolean DataType = XSD + "boolean"
	XSDInteger DataType = XSD + "integer"
	XSDDecimal DataType = XSD + "decimal"
	XSDDouble  DataType = XSD + "double"
	XSDString  DataType = XSD + "string"

	XSDNS       = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	XSDNSString = XSDNS + "langString"
)

INFO on datatypes: https://www.w3.org/TR/xmlschema11-2/type-hierarchy-201104.longdesc.html

func (DataType) NativeType

func (d DataType) NativeType(value string) (any, bool, error)

NativeType returns the native type of the given value. Returns true if the value was converted, otherwise false.

func (DataType) Validate

func (d DataType) Validate(v any, acceptString bool) bool

Validate returns true if the given value is valid for the datatype.

type Graph

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

func NewGraph

func NewGraph(ts ...*Triple) *Graph

func (*Graph) Add

func (g *Graph) Add(s, p, o Node)

func (*Graph) Find

func (g *Graph) Find(s, p, o Node) *Triple

Find returns the first triple matching the given pattern.

func (*Graph) FindAll

func (g *Graph) FindAll(s, p, o Node) []*Triple

FindAll returns all triples matching the given pattern.

func (*Graph) Remove

func (g *Graph) Remove(t *Triple)

type IRIReference

type IRIReference struct {
	Value string
}

func (*IRIReference) Equal

func (r *IRIReference) Equal(other Node) bool

func (*IRIReference) GetValue

func (r *IRIReference) GetValue() string

type Literal

type Literal struct {
	// Value is a Unicode string.
	Value string
	// Datatype is an IRI identifying a datatype that determines how the lexical form maps to a literal value.
	Datatype DataType
	// Language can only be present if Datatype is XSDNSString.
	Language string
}

Literal is used to represent values such as strings, numbers, and dates.

func (*Literal) Equal

func (l *Literal) Equal(other Node) bool

func (*Literal) GetValue

func (l *Literal) GetValue() string

type Node

type Node interface {
	// GetValue returns the value of the node.
	GetValue() string
	// Equal returns true if the two nodes are equal.
	Equal(other Node) bool
	// contains filtered or unexported methods
}

type Triple

type Triple struct {
	Subject   Node
	Predicate Node
	Object    Node
}

func NewTriple

func NewTriple(s, p, o Node) *Triple

func (*Triple) Equal

func (t *Triple) Equal(other *Triple) bool

Directories

Path Synopsis
internal
star

Jump to

Keyboard shortcuts

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