13
13
from csvwlib .utils .rdf .RDFGraphUtils import RDFGraphUtils
14
14
from csvwlib .utils .url .PropertyUrlUtils import PropertyUrlUtils
15
15
from csvwlib .utils .url .UriTemplateUtils import UriTemplateUtils
16
- from csvwlib .utils .url .ValueUrlUtils import ValueUrlUtils
17
16
18
17
CSVW = Namespace ('http://www.w3.org/ns/csvw#' )
19
18
@@ -122,9 +121,9 @@ def _parse_row_data(self, atdm_row, subject, table_metadata, property_url, row_n
122
121
123
122
property_namespace = PropertyUrlUtils .create_namespace (property_url , table_metadata ['url' ])
124
123
predicate = self ._predicate_node (property_namespace , property_url , col_name )
125
- self ._parse_cell_values (values , col_metadata , subject , predicate )
124
+ self ._parse_cell_values (values , col_metadata , subject , predicate , atdm_row , table_metadata [ 'url' ] )
126
125
127
- def _parse_cell_values (self , values , col_metadata , subject , predicate ):
126
+ def _parse_cell_values (self , values , col_metadata , subject , predicate , atdm_row , tm_url ):
128
127
""" Parses single cell value, values if 'separator' is present"""
129
128
if 'ordered' in col_metadata and col_metadata ['ordered' ] is True and len (values ) > 1 :
130
129
next_item = BNode ()
@@ -140,13 +139,14 @@ def _parse_cell_values(self, values, col_metadata, subject, predicate):
140
139
self .graph .add ((subject , predicate , rdf_list ))
141
140
else :
142
141
for value in values :
143
- object_node = self ._object_node (value , col_metadata )
142
+ object_node = self ._object_node (value , col_metadata , atdm_row , tm_url )
144
143
self .graph .add ((subject , predicate , object_node ))
145
144
146
145
@staticmethod
147
- def _object_node (value , col_metadata ):
146
+ def _object_node (value , col_metadata , atdm_row , tm_url ):
148
147
if 'valueUrl' in col_metadata :
149
- return ValueUrlUtils .create_uri_ref (value , col_metadata ['valueUrl' ])
148
+ return UriTemplateUtils .insert_value_rdf (col_metadata ['valueUrl' ], atdm_row , col_metadata .get ('name' ), tm_url )
149
+ return ValueUrlUtils .create_uri_ref (value , col_metadata ['valueUrl' ], col_metadata )
150
150
else :
151
151
lang = col_metadata .get ('lang' )
152
152
if not datatypeutils .is_compatible_with_datatype (value , col_metadata .get ('datatype' )):
0 commit comments