-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.go
92 lines (70 loc) · 2.15 KB
/
simple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-FileCopyrightText: 2021 Iwan Aucamp
//
// SPDX-License-Identifier: CC0-1.0 OR Apache-2.0
package rdf4go
////////////////////////////////////////////////////////////////////////////////
// type SimpleBnode
////////////////////////////////////////////////////////////////////////////////
type SimpleBnode struct {
id string
}
func (*SimpleBnode) isSubjectType() {}
func (*SimpleBnode) isObjectType() {}
func (s *SimpleBnode) Id() string {
return s.id
}
func (s *SimpleBnode) String() string {
return s.id
}
////////////////////////////////////////////////////////////////////////////////
// type SimpleIRI
////////////////////////////////////////////////////////////////////////////////
type SimpleIRI struct {
value string
}
func (*SimpleIRI) isSubjectType() {}
func (*SimpleIRI) isPredicateType() {}
func (*SimpleIRI) isObjectType() {}
func (s *SimpleIRI) Value() string {
return s.value
}
func (s *SimpleIRI) String() string {
return s.value
}
////////////////////////////////////////////////////////////////////////////////
// type SimpleLiteral
////////////////////////////////////////////////////////////////////////////////
// Literal ...
type SimpleLiteral struct {
value string
language *string
dataType *IRI
}
func (*SimpleLiteral) isObjectType() {}
func (s *SimpleLiteral) Value() string {
return s.value
}
func (s *SimpleLiteral) Language() *string {
return s.language
}
func (s *SimpleLiteral) DataType() *IRI {
return s.dataType
}
////////////////////////////////////////////////////////////////////////////////
// type SimpleValueFactory
////////////////////////////////////////////////////////////////////////////////
type SimpleValueFactory struct {
}
func (f *SimpleValueFactory) NewBNode(id string) (*SimpleBnode, error) {
return &SimpleBnode{id: id}, nil
}
func (f *SimpleValueFactory) NewIRI(value string) (*SimpleIRI, error) {
err := ValidateIRI(value)
if err != nil {
return nil, err
}
return &SimpleIRI{value: value}, nil
}
func (f *SimpleValueFactory) NewLiteral(value string, language *string, dataType *IRI) (*SimpleLiteral, error) {
return &SimpleLiteral{value: value, language: language, dataType: dataType}, nil
}