@@ -537,6 +537,9 @@ def test_indirect_data_entity(tmpdir):
537537 d2_e = crate .dereference ("d1/d2" )
538538 assert d2_e
539539 assert d2_e in crate .data_entities
540+ f1_e = crate .dereference ("d1/d2/f1" )
541+ assert f1_e
542+ assert f1_e in crate .data_entities
540543
541544
542545@pytest .mark .filterwarnings ("ignore" )
@@ -597,3 +600,62 @@ def test_from_dict(tmpdir):
597600 crate .write (out_path )
598601 with pytest .raises (ValueError ):
599602 ROCrate (metadata , init = True )
603+
604+
605+ def test_no_data_entity_link_from_file ():
606+ metadata = {
607+ "@context" : "https://w3id.org/ro/crate/1.1/context" ,
608+ "@graph" : [
609+ {
610+ "@id" : "ro-crate-metadata.json" ,
611+ "@type" : "CreativeWork" ,
612+ "about" : {"@id" : "./" },
613+ "conformsTo" : {"@id" : "https://w3id.org/ro/crate/1.1" }
614+ },
615+ {
616+ "@id" : "./" ,
617+ "@type" : "Dataset" ,
618+ "hasPart" : [
619+ {"@id" : "d1" },
620+ {"@id" : "packed.cwl" }
621+ ]
622+ },
623+ {
624+ "@id" : "d1" ,
625+ "@type" : "Dataset"
626+ },
627+ {
628+ "@id" : "packed.cwl" ,
629+ "@type" : [
630+ "File" ,
631+ "SoftwareSourceCode" ,
632+ "ComputationalWorkflow"
633+ ],
634+ "hasPart" : [
635+ {"@id" : "packed.cwl#do_this.cwl" },
636+ {"@id" : "packed.cwl#do_that.cwl" }
637+ ]
638+ },
639+ {
640+ "@id" : "packed.cwl#do_this.cwl" ,
641+ "@type" : "SoftwareApplication" ,
642+ },
643+ {
644+ "@id" : "packed.cwl#do_that.cwl" ,
645+ "@type" : "SoftwareApplication" ,
646+ }
647+ ]
648+ }
649+ crate = ROCrate (metadata )
650+ d1 = crate .dereference ("d1" )
651+ assert d1
652+ assert d1 in crate .data_entities
653+ assert d1 not in crate .contextual_entities
654+ wf = crate .dereference ("packed.cwl" )
655+ assert wf
656+ assert wf in crate .data_entities
657+ assert wf not in crate .contextual_entities
658+ t1 = crate .dereference ("packed.cwl#do_this.cwl" )
659+ assert t1
660+ assert t1 not in crate .data_entities
661+ assert t1 in crate .contextual_entities
0 commit comments