johanwk / elot

Emacs Literate Ontology Tool
GNU General Public License v3.0
6 stars 3 forks source link

tweaking rdfpuml/plantuml layout and appearance #31

Open VladimirAlexiev opened 3 months ago

VladimirAlexiev commented 3 months ago

graphs tend to grow large and need tweaking. Some alternatives could be added for the tool. I need to get some examples out to show what I mean. Coming up.

rdfpuml can already tweak arrow direction, length and appearance; and node stereotypes. Eg here's an example from a Crunchbase model. I keep it in a separate puml.ttl that I concat to the real model.

####################

# superclass and class hierarchy (lattice)
<agent/(uuid)> a cb:Agent.
<agent/(person_uuid)>       puml:up-tri-dashed <agent/(uuid)>.
<agent/(organization_uuid)> puml:up-tri-dashed <agent/(uuid)>.
<agent/(investor_uuid)>     puml:up-tri-dashed <agent/(person_uuid)>.
<agent/(investor_uuid)>     puml:up-tri-dashed <agent/(organization_uuid)>.

# Colored circles: agent=red, relation=pink, financial=yellow, static=lightgreen
cb:Acquisition     puml:stereotype "(A,yellow)".
cb:Agent           puml:stereotype "(A,red) abstract superclass".
cb:Degree          puml:stereotype "(D,pink)".
cb:Event           puml:stereotype "(E,lightgreen)".
cb:EventAppearance puml:stereotype "(A,pink)".
cb:Fund            puml:stereotype "(F,red)".
cb:FundingRound    puml:stereotype "(F,yellow)".
cb:IPO             puml:stereotype "(I,yellow)".
cb:Investment      puml:stereotype "(I,yellow)".
cb:Investor        puml:stereotype "(I,red)".
cb:Job             puml:stereotype "(J,pink)".
cb:Organization    puml:stereotype "(O,red)".
cb:Person          puml:stereotype "(P,red)".
skos:Concept       puml:stereotype "(C,lightgreen)".

# Relation directions
cb:acquiree                puml:arrow puml:up.
cb:acquirer                puml:arrow puml:up.
cb:entity                  puml:arrow puml:up.
cb:event                   puml:arrow puml:up.
cb:featuredJobOrganization puml:arrow puml:up.
cb:institution             puml:arrow puml:up.
cb:investor                puml:arrow puml:up.
cb:participant             puml:arrow puml:up.
cb:partner                 puml:arrow puml:up.

# All links to Org and Person should be `up` except Job which uses `left/right` (nested between them)
#cb:organization            puml:arrow puml:up.
#cb:person                  puml:arrow puml:up.
cb:featuredJobOrganization puml:arrow puml:left.
<job/(uuid)>                         puml:right <agent/(person_uuid)>; puml:left <agent/(org_uuid)>.
<degree/(uuid)>                      puml:up    <agent/(person_uuid)>.
<funding_round/(funding_round_uuid)> puml:up    <agent/(org_uuid)>.
<ipo/(uuid)>                         puml:up    <agent/(org_uuid)>.

# Inlined external URLs
cb:cbUrl            a puml:InlineProperty.
cb:eventUrl         a puml:InlineProperty.
cb:facebookUrl      a puml:InlineProperty.
cb:homepageUrl      a puml:InlineProperty.
cb:linkedinUrl      a puml:InlineProperty.
cb:logoUrl          a puml:InlineProperty.
cb:registrationUrl  a puml:InlineProperty.
cb:twitterUrl       a puml:InlineProperty.

# Inlined thesaurus values. Alternative: display them as skos:Concepts
cb:acquisitionType  a puml:InlineProperty.
cb:appearanceType   a puml:InlineProperty.
cb:cbIndustry       a puml:InlineProperty.
cb:degreeType       a puml:InlineProperty.
cb:employeeCount    a puml:InlineProperty.
cb:eventRole        a puml:InlineProperty.
cb:gender           a puml:InlineProperty.
cb:investmentType   a puml:InlineProperty.
cb:investorType     a puml:InlineProperty.
cb:jobType          a puml:InlineProperty.
cb:organizationRole a puml:InlineProperty.
cb:primaryRole      a puml:InlineProperty.
cb:status           a puml:InlineProperty.
#skos:broader        a puml:InlineProperty.
skos:inScheme       a puml:InlineProperty.
johanwk commented 3 months ago

I have sometimes found a need to add very specific commands to the output of rdfpuml, and did this with a hack: arguments "addtext" and "addtextend" to the org-babel block rdfpumlblock. I need to look for some examples, otherwise I guess this will not make a lot of sense .. this is just to mention that there may be a need in some cases to add explicit plantuml statements.

VladimirAlexiev commented 3 months ago
johanwk commented 3 months ago

I'll be more than happy to give the details of the hacks I needed to get IDO diagrams right!

Maybe the most important is to not inline some cases of rdf:type, for cases where I want to draw attention to "this individual is a member of this class and that class".

:prologue and :epiloguearen't suitable for these cases, since (as I've found) the hacks require addition to the puml code, which is only available after rdfpuml has done its job, and I don't usually want to have puml blocks in the document.

If we have time tomorrow, we can look at the rdfpuml-block code block in elot-lob, which I think will make it easy to see what I've been up to. I have parameters for adding to the start of the puml code, and at the end (iirc, adding to the end is for overriding defaults).

For rdfpuml configuration, there's an org-babel block rdfpuml-config in elot-lob where the settings for coloured circles, etc. is written. There's some variant configs as well.

VladimirAlexiev commented 3 months ago

Ok @johanwk , that's https://github.com/VladimirAlexiev/rdf2rml/issues/14 and I'll try to do it in the next few days. Fixing it in the puml is way too hard (or as we say "dentistry through the ass": no wonder Bulgarians used it be called Vulgars in historic times :-)