@@ -311,7 +311,7 @@ def _add_nested_annotations(self, annotation_key, annotation_value, e: ProvEntit
311
311
nested_entity = self .document .entity (nested_id )
312
312
e .add_attributes ({annotation_key : nested_entity .identifier })
313
313
for nested_key in annotation_value :
314
- nested_value = annotation_value [nested_key ]
314
+ nested_value = annotation_value [nested_key ]
315
315
nested_entity = self ._add_nested_annotations (nested_key , nested_value , nested_entity )
316
316
return e
317
317
@@ -377,7 +377,7 @@ def declare_file(self, value: CWLObjectType) -> Tuple[ProvEntity, ProvEntity, st
377
377
if "additionalType" in s :
378
378
additional_type = schema_annotations [s ].split (sep = '/' )[- 1 ] # find better method?
379
379
entity .add_attributes ( {PROV_TYPE : SCHEMA [additional_type ]})
380
- else :
380
+ else : # add support for CommentedSeq
381
381
entity = self ._add_nested_annotations (s , schema_annotations [s ], entity )
382
382
383
383
# Transfer format annotations to provenance:
@@ -489,18 +489,17 @@ def declare_directory(self, value: CWLObjectType) -> ProvEntity:
489
489
490
490
coll .add_attributes (coll_attribs )
491
491
coll_b .add_attributes (coll_b_attribs )
492
+
493
+ # Identify all schema annotations
494
+ schema_annotations = dict ([(v , value [v ]) for v in value .keys () if 'schema.org' in v ])
492
495
493
- # Propagate input data annotations
494
- if SCHEMA ["Dataset" ].uri in value :
495
- # coll_annotations = [ (PROV_TYPE, SCHEMA["Dataset"]) ]
496
- coll .add_attributes ([ (PROV_TYPE , SCHEMA ["Dataset" ]) ])
497
-
498
- dataset = value [SCHEMA ["Dataset" ].uri ]
499
-
500
- for annotation in dataset :
501
- if isinstance (dataset [annotation ], (str , bool , int , float )): # check if these are all allowed types
502
- coll .add_attributes ({annotation : dataset [annotation ]})
503
-
496
+ # Transfer SCHEMA annotations to provenance
497
+ for s in schema_annotations :
498
+ if "additionalType" in s :
499
+ additional_type = schema_annotations [s ].split (sep = '/' )[- 1 ] # find better method?
500
+ coll .add_attributes ( {PROV_TYPE : SCHEMA [additional_type ]})
501
+ elif "hasPart" not in s :
502
+ coll = self ._add_nested_annotations (s , schema_annotations [s ], coll )
504
503
505
504
# Also Save ORE Folder as annotation metadata
506
505
ore_doc = ProvDocument ()
0 commit comments