-
Notifications
You must be signed in to change notification settings - Fork 4
/
NIFBean.py
196 lines (157 loc) · 4.94 KB
/
NIFBean.py
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
class NIFBean(object):
def __init__(self):
self._context = None
self._annotator = None
self._mention = None
self._beginIndex = None
self._endIndex = None
self._score = None
self._taIdentRef = None
self._taClassRef = None
self._referenceContext = None
self._taMsClassRef = None
@property
def taMsClassRef(self):
if self._taMsClassRef is not None:
return 'nif:taMsClassRef <' + self._taMsClassRef + '> ;' + '\n\t'
return ''
@taMsClassRef.setter
def taMsClassRef(self, value):
self._taMsClassRef = value
@taMsClassRef.deleter
def taMsClassRef(self):
del self._taMsClassRef
@property
def context(self):
return self._context
@context.setter
def context(self, value):
self._context = value
@context.deleter
def context(self):
del self._context
@property
def annotator(self):
if self._annotator is not None:
return 'itsrdf:taAnnotatorsRef <' + self._annotator + '> ;' + '\n\t'
return ''
@annotator.setter
def annotator(self, value):
self._annotator = value
@annotator.deleter
def annotator(self):
del self._annotator
@property
def mention(self):
if self._mention is not None:
return 'nif:anchorOf "' + self._mention + '" ;\n\t'
return ''
@mention.setter
def mention(self, value):
self._mention = value
@mention.deleter
def mention(self):
del self._mention
@property
def beginIndex(self):
if self._beginIndex is not None:
return 'nif:beginIndex "' + str(self._beginIndex) + '"^^xsd:nonNegativeInteger ;\n\t'
return ''
@beginIndex.setter
def beginIndex(self, value):
self._beginIndex = value
@beginIndex.deleter
def beginIndex(self):
del self._beginIndex
@property
def endIndex(self):
if self._endIndex is not None:
return 'nif:endIndex "' + str(self._endIndex) + '"^^xsd:nonNegativeInteger ;\n\t'
return ''
@endIndex.setter
def endIndex(self, value):
self._endIndex = value
@endIndex.deleter
def endIndex(self):
del self._endIndex
@property
def types(self):
return self._types
@types.setter
def types(self, value):
self._types = value
@types.deleter
def types(self):
del self._types
@property
def score(self):
if self._score is not None:
return 'itsrdf:taConfidence "' + str(self._score) + '^^xsd:double ;\n\t'
return ''
@score.setter
def score(self, value):
self._score = value
@score.deleter
def score(self):
del self._score
@property
def taIdentRef(self):
if self._taIdentRef is not None:
return 'itsrdf:taIdentRef <' + self._taIdentRef + '> .'
return ''
@taIdentRef.setter
def taIdentRef(self, value):
self._taIdentRef = value
@taIdentRef.deleter
def taIdentRef(self):
del self._taIdentRef
@property
def taClassRef(self):
return self._taClassRef
@taClassRef.setter
def taClassRef(self, value):
self._taClassRef = value
@taClassRef.deleter
def taClassRef(self):
del self._taClassRef
@property
def referenceContext(self):
if self._referenceContext is not None:
return 'nif:referenceContext <' + self._referenceContext + '> ;' + '\n\t'
return ''
@referenceContext.setter
def referenceContext(self, value):
self._referenceContext = value
@referenceContext.deleter
def referenceContext(self):
del self._referenceContext
@property
def reference(self):
return self._taIdentRef + '/#offset_' + str(self._beginIndex) + '_' + str(self._endIndex)
@property
def toClassRef(self):
result = ''
if self._taClassRef is not None:
for index, currentClassRef in enumerate(self._taClassRef):
if (index > 0):
result += '<' + currentClassRef + '> , '
return 'itsrdf:taClassRef ' + result + ' ;\n\t'
@property
def nifBeanProperty(self):
return 'a nif:OffsetBasedString , nif:Phrase ;' + '\n\t'
@property
def beanContext(self):
return '<' + self._context + '/#offset_' + str(self._beginIndex) + '_' + str(self._endIndex) + '>' + '\n\t'
@property
def turtle(self):
return self.beanContext + \
self.nifBeanProperty + \
self.mention + \
self.beginIndex + \
self.endIndex + \
self.referenceContext + \
self.taMsClassRef + \
self.annotator + \
self.toClassRef +\
self.score + \
self.taIdentRef