-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTurtleStatement.py
More file actions
29 lines (26 loc) · 1.11 KB
/
Copy pathTurtleStatement.py
File metadata and controls
29 lines (26 loc) · 1.11 KB
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
import string_utilities as su
class TurtleStatement(object):
def __init__(self, skos_predicates, values = None):
self.ttl_object = ''
self.subject = ''
self.predicates = ''
for col in range(0,len(skos_predicates)):
if skos_predicates[col] == 'URI':
if values[col].find('http://') > 0:
self.subject = su.enclose(values[col])
else:
self.subject = values[col]
else:
if values[col]!= '':
self.predicates = ''.join([self.predicates,
'\t\t',
skos_predicates[col],
' ',
su.mapEnclose(values[col]),
';\n'])
self.predicates = self.predicates[:-2]+'.\n'
self.ttl_object = ''.join([self.subject,' ', self.predicates])
def get_subject(self):
return self.subject.encode('UTF-8')
def __str__(self):
return self.ttl_object.encode('UTF-8')