VladimirAlexiev / rdf2rml

RDF by Example: rdfpuml for True RDF Diagrams, rdf2rml for R2RML Generation
39 stars 5 forks source link

rdfpuml: don't mangle `(...)` to `[...]` #21

Closed VladimirAlexiev closed 1 year ago

VladimirAlexiev commented 1 year ago

Take a simple model with field names embedded in URL and attribute;

<person/(id)> a s:Person;
  s:additionalType <type/(type)>;
  s:name "(name)".

<type/(type)> a puml:InlineProperty.

rdfpuml mangles (...) to [...] to avoid parasitic compartments (horizontal lines), since PlantUML assumes a field name with parens to be a method and moves it in a compartment above attributes:

The system checks for parenthesis to choose between methods and fields.

@startuml
hide empty members
hide circle
skinparam classAttributeIconSize 0
class _person_id_ as "<person/(id)>"
_person_id_ : a s:Person
_person_id_ : s:additionalType <type/[type]>
_person_id_ : s:name "[name]"
@enduml

Which results in this (notice the square brackets):

image


We can use this new feature from https://github.com/plantuml/plantuml/issues/536#issuecomment-823422527:

You can use {field} and {method} modifiers to override default behaviour of the parser about fields and methods.

@startuml
hide empty members
hide circle
skinparam classAttributeIconSize 0
class _person_id_ as "<person/(id)>"
_person_id_ : {field} a s:Person
_person_id_ : {field} s:additionalType <type/(type)>
_person_id_ : {field} s:name "(name)"
@enduml

Which results in this (notice the parens): image