@@ -414,42 +414,56 @@ fn test_ontoenv_dag_structure() -> Result<()> {
414414 let closure = env. get_closure ( & ont_graph, -1 ) . unwrap ( ) ;
415415 assert_eq ! ( closure. len( ) , 2 ) ;
416416 let union = env. get_union_graph ( & closure, None , None ) ?;
417- assert_eq ! ( union . len( ) , 3 ) ;
418- let union = env. get_union_graph ( & closure, None , Some ( false ) ) ?;
419417 assert_eq ! ( union . len( ) , 4 ) ;
418+ let union = env. get_union_graph ( & closure, None , Some ( false ) ) ?;
419+ assert_eq ! ( union . len( ) , 5 ) ;
420420
421421 // ont3 => {ont3, ont2, ont1}
422422 let ont3 = NamedNodeRef :: new ( "http://example.org/ontology3" ) ?;
423423 let ont_graph = env. resolve ( ResolveTarget :: Graph ( ont3. into ( ) ) ) . unwrap ( ) ;
424424 let closure = env. get_closure ( & ont_graph, -1 ) . unwrap ( ) ;
425425 assert_eq ! ( closure. len( ) , 3 ) ;
426426 let union = env. get_union_graph ( & closure, None , None ) ?;
427- assert_eq ! ( union . len( ) , 4 ) ;
427+ assert_eq ! ( union . len( ) , 5 ) ;
428428 let union = env. get_union_graph ( & closure, None , Some ( false ) ) ?;
429- assert_eq ! ( union . len( ) , 6 ) ;
429+ assert_eq ! ( union . len( ) , 8 ) ;
430430
431431 // ont5 => {ont5, ont4, ont3, ont2, ont1}
432432 let ont5 = NamedNodeRef :: new ( "http://example.org/ontology5" ) ?;
433433 let ont_graph = env. resolve ( ResolveTarget :: Graph ( ont5. into ( ) ) ) . unwrap ( ) ;
434434 let closure = env. get_closure ( & ont_graph, -1 ) . unwrap ( ) ;
435435 assert_eq ! ( closure. len( ) , 5 ) ;
436436 let union = env. get_union_graph ( & closure, None , None ) ?;
437- assert_eq ! ( union . len( ) , 6 ) ;
437+ assert_eq ! ( union . len( ) , 7 ) ;
438438 let union = env. get_union_graph ( & closure, None , Some ( false ) ) ?;
439439 // print the union
440- assert_eq ! ( union . len( ) , 10 ) ;
440+ assert_eq ! ( union . len( ) , 14 ) ;
441441
442442 // check recursion depths
443443 let closure = env. get_closure ( & ont_graph, 0 ) . unwrap ( ) ;
444444 assert_eq ! ( closure. len( ) , 1 ) ;
445+ let closure_names: std:: collections:: HashSet < String > =
446+ closure. iter ( ) . map ( |ont| ont. name ( ) . to_string ( ) ) . collect ( ) ;
447+ assert ! ( closure_names. contains( "<http://example.org/ontology5>" ) ) ;
445448
446449 let closure = env. get_closure ( & ont_graph, 1 ) . unwrap ( ) ;
447- assert_eq ! ( closure. len( ) , 3 ) ; // ont5, ont4, ont3
450+ assert_eq ! ( closure. len( ) , 4 ) ; // ont5, ont4, ont3, ont2
451+ let closure_names: std:: collections:: HashSet < String > =
452+ closure. iter ( ) . map ( |ont| ont. name ( ) . to_string ( ) ) . collect ( ) ;
453+ assert ! ( closure_names. contains( "<http://example.org/ontology5>" ) ) ;
454+ assert ! ( closure_names. contains( "<http://example.org/ontology4>" ) ) ;
455+ assert ! ( closure_names. contains( "<http://example.org/ontology3>" ) ) ;
456+ assert ! ( closure_names. contains( "<http://example.org/ontology2>" ) ) ;
457+
458+ let closure = env. get_closure ( & ont_graph, -1 ) . unwrap ( ) ;
459+ assert_eq ! ( closure. len( ) , 5 ) ; // ont5, ont4, ont3, ont2, ont1
448460 let closure_names: std:: collections:: HashSet < String > =
449461 closure. iter ( ) . map ( |ont| ont. name ( ) . to_string ( ) ) . collect ( ) ;
450- assert ! ( closure_names. contains( "http://example.org/ontology5" ) ) ;
451- assert ! ( closure_names. contains( "http://example.org/ontology4" ) ) ;
452- assert ! ( closure_names. contains( "http://example.org/ontology3" ) ) ;
462+ assert ! ( closure_names. contains( "<http://example.org/ontology5>" ) ) ;
463+ assert ! ( closure_names. contains( "<http://example.org/ontology4>" ) ) ;
464+ assert ! ( closure_names. contains( "<http://example.org/ontology3>" ) ) ;
465+ assert ! ( closure_names. contains( "<http://example.org/ontology2>" ) ) ;
466+ assert ! ( closure_names. contains( "<http://example.org/ontology1>" ) ) ;
453467
454468 Ok ( ( ) )
455469}
0 commit comments