linkml icon indicating copy to clipboard operation
linkml copied to clipboard

gen-graphviz no duplicate classes

Open andrecastro0o opened this issue 3 years ago • 2 comments

I was wondering if it would be possible to add, to gen-graphviz the capacity to avoid duplicating classes, when they are referred more than once in the following example, where Person, is a class, but also the range or slot parent.

id: https://w3id.org/linkml/examples/personinfo
name: personinfo
prefixes:
  linkml: https://w3id.org/linkml/
imports:
  - linkml:types
default_range: string
classes:
  Person:
    slots:
      - full_name
      - parent
slots:
  full_name:
  parent:
    range: Person

the generated graphviz image contains 2 classes Person. gen-graphviz -f png person.yaml -o person

person

gen-graphviz -f dot person.yaml -o person

digraph {
	graph [bb="0,0,147.99,123"];
	node [label="\N"];
	Person	 [height=0.5,
		label=Person,
		pos="71.547,105",
		width=0.95686];
	full_name	 [color=blue,
		height=0.5,
		label=string,
		pos="30.547,18",
		width=0.84854];
	Person -> full_name	 [color=blue,
		label=full_name,
		lp="63.547,61.5",
		pos="e,29.4,36.257 51.943,90.09 45.644,84.232 39.325,76.991 35.547,69 32.254,62.032 30.617,53.941 29.892,46.283",
		style=solid];
	parent	 [color=blue,
		height=0.5,
		label=Person,
		pos="113.55,18",
		width=0.95686];
	Person -> parent	 [color=blue,
		label=parent,
		lp="114.55,61.5",
		pos="e,106.44,35.663 81.669,87.608 84.948,81.761 88.518,75.159 91.547,69 95.318,61.334 99.114,52.866 102.47,45.07",
		style=solid];
}

How important is this feature? • Low - it's an enhancement but not crucial for work

andrecastro0o avatar Aug 02 '22 13:08 andrecastro0o

Hi @andrecastro0o - thanks for the issue; to clarify, the optional parameter would suppress the display of self-referential classes altogether, or that the blue arrowed line currently pointing to the second person circle, instead pointed back to the first (to show the self-reference relationship to the parent slot)?

sierra-moxon avatar Aug 02 '22 14:08 sierra-moxon

Hi @sierra-moxon, thank you for the question. I think the latter, the blue arrowed line pointing back to the first (to show the self-reference relationship to the parent slot)

I think something like this: person_selfreferrence


digraph {
	graph [bb="0,0,147.99,123"];
	node [label="\N"];
	Person	 [label=Person];
	full_name	 [color=blue, label=string];
	Person -> full_name	 [color=blue, label=full_name];
        Person -> Person [color=blue, label=parent]; 
}

does it make sense? Perhaps it will become a bit cluttered, but I think could help in better grasping the model at fist glance

andrecastro0o avatar Aug 05 '22 06:08 andrecastro0o

Hi @andrecastro0o - just wanted to make sure we posted back here that our current development efforts have moved away from graphviz representations and into mermaid representations for the schema. I think the self-referential arrows are really important and are part of that implementation.

I'm going to close this for now, but please reopen if the mermaid implementations don't work for you? :)

sierra-moxon avatar Feb 10 '23 20:02 sierra-moxon