Documentation
¶
Index ¶
- Constants
- func HasIdentifierPrefix(value string) bool
- type Identifier
- func (receiver Identifier) Get() (string, bool)
- func (receiver Identifier) IsNothing() bool
- func (receiver Identifier) Label() (Label, bool)
- func (receiver Identifier) MarshalText() (text []byte, err error)
- func (receiver Identifier) String() string
- func (receiver *Identifier) UnmarshalText(text []byte) error
- type Label
Constants ¶
const ( ErrIdentifierPrefixNotFound = erorr.Error("blank-node-identifier prefix (\"_:\") not found") ErrLabelFirstCharacterNotAllowed = erorr.Error("blank-node-label first character not allowed") ErrLabelLastCharacterNotAllowed = erorr.Error("blank-node-label last character not allowed") ErrEmptyIdentifier = erorr.Error("empty blank-node-identifier") ErrEmptyLabel = erorr.Error("empty blank-node-label") ErrEmptyString = erorr.Error("empty string") ErrNilReceiver = erorr.Error("nil receiver") )
const IdentifierPrefix string = "_:"
IdentifierPrefix is the prefix at the beginning of all blank-node-identifiers.
It makes blank-node-identifiers look like a URL/URI/IRI with a scheme of "_".
You can see the prefix in these example blank-node-identifiers:
_:b0 _:address84 _:n1 _:ed7ba470-8e54-465e-825c-99712043e01c _:label123
Variables ¶
This section is empty.
Functions ¶
func HasIdentifierPrefix ¶
HasIdentifierPrefix return whether a string beings with a "_:" or not.
All blank-node-identifiers begin with a "_:".
Types ¶
type Identifier ¶
type Identifier struct {
// contains filtered or unexported fields
}
Identifier represents a blank-node-identifier from RDF (resource description framework) technologies, such as: JSON-LD, N-Quads, N-Triples, RDF/XML, RDFa, TriG, Turtle, etc.
Here are some example blank-node-identifiers:
_:b0 _:address84 _:n1 _:ed7ba470-8e54-465e-825c-99712043e01c _:label123
func MustParseIdentifierBytes ¶
func MustParseIdentifierBytes(value []byte) Identifier
func MustParseIdentifierString ¶
func MustParseIdentifierString(value string) Identifier
func NoIdentifier ¶
func NoIdentifier() Identifier
NoLIdentifier returns an empty Identifier.
Identifier is an optional-type — also known as a option-type or maybe-type elsewhere.
func ParseIdentifierBytes ¶
func ParseIdentifierBytes(value []byte) (Identifier, error)
ParseIdentifierBytes parses the []byte for a Blank Node Identifier.
A Blank Node Identifier looks like these:
_:b0 _:address84 _:n1 _:ed7ba470-8e54-465e-825c-99712043e01c _:label123
func ParseIdentifierString ¶
func ParseIdentifierString(value string) (Identifier, error)
ParseIdentifierString parses the string for a Blank Node Identifier.
A Blank Node Identifier looks like these:
_:b0 _:address84 _:n1 _:ed7ba470-8e54-465e-825c-99712043e01c _:label123
func (Identifier) Get ¶
func (receiver Identifier) Get() (string, bool)
func (Identifier) IsNothing ¶
func (receiver Identifier) IsNothing() bool
func (Identifier) Label ¶
func (receiver Identifier) Label() (Label, bool)
Label returns the blank-node-label for the blank-node-identifier.
func (Identifier) MarshalText ¶
func (receiver Identifier) MarshalText() (text []byte, err error)
MarshalText makes Identifier fit encoding.TextMarshaler.
func (Identifier) String ¶
func (receiver Identifier) String() string
String makes Identifier fit fmt.Stringer.
func (*Identifier) UnmarshalText ¶
func (receiver *Identifier) UnmarshalText(text []byte) error
UnmarshalText makes Identifier fit encoding.TextUnmarshaler.
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label represents a blank-node-label from RDF (resource description framework) technologies, such as: JSON-LD, N-Quads, N-Triples, RDF/XML, RDFa, TriG, Turtle, etc.
For each of the Blank Node Identifiers:
_:b0 _:address84 _:n1 _:ed7ba470-8e54-465e-825c-99712043e01c _:label123
Their Blank Node Labels are as follows:
b0 address84 n1 ed7ba470-8e54-465e-825c-99712043e01c label123
I.e., a Blank Node Label is the part of the Blank Node Identifier after the "_:".
func MustParseLabelBytes ¶
func MustParseLabelString ¶
func NoLabel ¶
func NoLabel() Label
NoLabel returns an empty Label.
Label is an optional-type — also known as a option-type or maybe-type elsewhere.
func ParseLabelBytes ¶
ParseLabelBytes parses a []byte for a blank-node-label from RDF (resource description framework) technologies, such as: JSON-LD, N-Quads, N-Triples, RDF/XML, RDFa, TriG, Turtle, etc.
A blank-node-label is what comes after the "_:" is a blank-node-identifier.
For example, if the blank-node-identifier is:
_:abcdef12345
Then its blank-node-label is:
abcdef12345
This uses the definition found in RDF 1.1 Turtle (https://www.w3.org/TR/turtle/):
RDF blank nodes in Turtle are expressed as _: followed by a blank node label which is a series of name characters. The characters in the label are built upon PN_CHARS_BASE, liberalized as follows: • The characters _ and digits may appear anywhere in a blank node label. • The character . may appear anywhere except the first or last character. • The characters -, U+00B7, U+0300 to U+036F and U+203F to U+2040 are permitted anywhere except the first character.
( https://www.w3.org/TR/turtle/#BNodes )
Where, PN_CHARS_BASE is defined as:
PN_CHARS_BASE ::= [A-Z] |
[a-z] |
[#x00C0-#x00D6] |
[#x00D8-#x00F6] |
[#x00F8-#x02FF] |
[#x0370-#x037D] |
[#x037F-#x1FFF] |
[#x200C-#x200D] |
[#x2070-#x218F] |
[#x2C00-#x2FEF] |
[#x3001-#xD7FF] |
[#xF900-#xFDCF] |
[#xFDF0-#xFFFD] |
[#x10000-#xEFFFF]
( https://www.w3.org/TR/turtle/#grammar-production-PN_CHARS_BASE )
See also: ParseLabelString.
func ParseLabelString ¶
ParseLabelString parses a string for a blank-node-label from RDF (resource description framework) technologies, such as: JSON-LD, N-Quads, N-Triples, RDF/XML, RDFa, TriG, Turtle, etc.
A blank-node-label is what comes after the "_:" is a blank-node-identifier.
For example, if the blank-node-identifier is:
_:abcdef12345
Then its blank-node-label is:
abcdef12345
This uses the definition found in RDF 1.1 Turtle (https://www.w3.org/TR/turtle/):
RDF blank nodes in Turtle are expressed as _: followed by a blank node label which is a series of name characters. The characters in the label are built upon PN_CHARS_BASE, liberalized as follows: • The characters _ and digits may appear anywhere in a blank node label. • The character . may appear anywhere except the first or last character. • The characters -, U+00B7, U+0300 to U+036F and U+203F to U+2040 are permitted anywhere except the first character.
( https://www.w3.org/TR/turtle/#BNodes )
Where, PN_CHARS_BASE is defined as:
PN_CHARS_BASE ::= [A-Z] |
[a-z] |
[#x00C0-#x00D6] |
[#x00D8-#x00F6] |
[#x00F8-#x02FF] |
[#x0370-#x037D] |
[#x037F-#x1FFF] |
[#x200C-#x200D] |
[#x2070-#x218F] |
[#x2C00-#x2FEF] |
[#x3001-#xD7FF] |
[#xF900-#xFDCF] |
[#xFDF0-#xFFFD] |
[#x10000-#xEFFFF]
( https://www.w3.org/TR/turtle/#grammar-production-PN_CHARS_BASE )
See also: ParseLabelString.
func (Label) MarshalText ¶
MarshalText makes Label fit encoding.TextMarshaler.
func (*Label) UnmarshalText ¶
UnmarshalText makes Label fit encoding.TextUnmarshaler.