fix: Adjust for generator yielding tuples #4
1 changed files with 5 additions and 3 deletions
|
|
@ -44,16 +44,18 @@ def _main():
|
|||
|
||||
g = Graph()
|
||||
for json_object in get_paginated(url_base, page_size=100, token=os.environ.get('DUMPTHINGS_TOKEN')):
|
||||
object_class = json_object.get('schema_type')
|
||||
# the generator yields tuples, thus the index
|
||||
json_obj = json_object[0]
|
||||
object_class = json_obj.get('schema_type')
|
||||
if object_class is None:
|
||||
raise ValueError(f'No schema_type in {json_object}')
|
||||
else:
|
||||
class_name = re.search('([_A-Za-z0-9]*$)', object_class).group(0)
|
||||
|
||||
try:
|
||||
ttl = converter.convert(json_object, class_name)
|
||||
ttl = converter.convert(json_obj, class_name)
|
||||
except ValueError as ve:
|
||||
print(f'WARNING: could not convert record {json_object["pid"]}: {ve}', file=sys.stderr, flush=True)
|
||||
print(f'WARNING: could not convert record {json_obj["pid"]}: {ve}', file=sys.stderr, flush=True)
|
||||
continue
|
||||
g.parse(io.StringIO(ttl), format='n3')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue