@@ -91,19 +91,23 @@ const rdfGraphToNodes = (store: rdflib.Store): GraphData => {
9191 // Create links for relevant relationships
9292 const includesElement = CONFIG . relationProperties . some ( ( item : string ) => pred . includes ( item ) ) ;
9393 if ( includesElement ) {
94- const group = predToGroup ( pred ) ;
95- if ( group !== "" ) {
96- safeUpdateElement ( obj , undefined , group ) ;
94+ const isLiteral = statement . object . termType === "literal" ;
95+
96+ if ( ! isLiteral ) {
97+ const group = predToGroup ( pred ) ;
98+ if ( group !== "" ) {
99+ safeUpdateElement ( obj , undefined , group ) ;
100+ }
101+ if ( ! nodesMap . has ( subj ) ) {
102+ nodesMap . set ( subj , { id : subj , label : subj , group : "" } ) ;
103+ }
104+ if ( ! nodesMap . has ( obj ) ) {
105+ nodesMap . set ( obj , { id : obj , label : obj , group : "" } ) ;
106+ }
107+ // set as source color, if not set target color, if not set default color gray
108+ const linkColor = nodesMap . get ( subj ) ?. color ?? nodesMap . get ( obj ) ?. color ?? "gray" ;
109+ edges . push ( { source : subj , target : obj , label : pred , color : linkColor } ) ;
97110 }
98- if ( ! nodesMap . has ( subj ) ) {
99- nodesMap . set ( subj , { id : subj , label : subj , group : "" } ) ;
100- }
101- if ( ! nodesMap . has ( obj ) ) {
102- nodesMap . set ( obj , { id : obj , label : obj , group : "" } ) ;
103- }
104- // set as source color, if not set target color, if not set default color gray
105- const linkColor = nodesMap . get ( subj ) ?. color ?? nodesMap . get ( obj ) ?. color ?? "gray" ;
106- edges . push ( { source : subj , target : obj , label : pred , color : linkColor } ) ;
107111 }
108112 } ) ;
109113
0 commit comments