Skip to content

Commit d481099

Browse files
committed
- add namespace
- warn for term in missing namespace
1 parent 7fe1b13 commit d481099

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

csvwlib/converter/ToRDFConverter.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ def parse_virtual_columns(self, row_node, atdm_row, table_metadata):
7070
continue
7171
subject = URIRef(UriTemplateUtils.insert_value(virtual_column['aboutUrl'], atdm_row, '',
7272
table_metadata['url']))
73+
7374
predicate = Namespaces.get_term(virtual_column['propertyUrl'])
74-
obj = UriTemplateUtils.insert_value(virtual_column['valueUrl'], atdm_row, '', table_metadata['url'])
75-
obj = CommonProperties.expand_property_if_possible(obj)
76-
self.graph.add((subject, predicate, URIRef(obj)))
77-
if self.mode == CONST_STANDARD_MODE:
78-
self.graph.add((row_node, CSVW.describes, subject))
75+
if predicate:
76+
obj = UriTemplateUtils.insert_value(virtual_column['valueUrl'], atdm_row, '', table_metadata['url'])
77+
obj = CommonProperties.expand_property_if_possible(obj)
78+
self.graph.add((subject, predicate, URIRef(obj)))
79+
if self.mode == CONST_STANDARD_MODE:
80+
self.graph.add((row_node, CSVW.describes, subject))
81+
else:
82+
print(f"term {virtual_column['propertyUrl']} not in namespaces")
7983

8084
def _add_file_metadata(self, metadata, node):
8185
language = JSONLDUtils.language(self.metadata['@context'])

csvwlib/utils/rdf/Namespaces.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def all():
2525
'org': Namespace('http://www.w3.org/ns/org#'),
2626
'owl': Namespace('http://www.w3.org/2002/07/owl#'),
2727
'prov': Namespace('http://www.w3.org/ns/prov#'),
28+
'qudt': Namespace('http://qudt.org/1.1/schema/qudt#'),
2829
'qb': Namespace('http://purl.org/linked-data/cube#'),
2930
'rdf': Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
3031
'rdfa': Namespace('http://www.w3.org/ns/rdfa#'),

0 commit comments

Comments
 (0)