Commit 541cebbb authored by Jonas Smedegaard's avatar Jonas Smedegaard

Support optional explicit outfile as 2nd argument.

parent 1f2f11df
......@@ -36,7 +36,7 @@ rdfpuml - convert RDF to PlantUML diagrams
=head1 SYNOPSIS
B<rdfpuml> [options] F<infile>
B<rdfpuml> [options] F<infile> [F<outfile>]
=head1 DESCRIPTION
......@@ -142,10 +142,14 @@ pod2usage(1) if ($opt{help});
Read from this Turtle file.
=back
=item B<outfile>
Write to this PlantUML file. Optional.
PlantUML output is written to file with a name stemming from B<infile>,
existing suffix F<.ttl> removed (if it existed) and suffix F<.puml> added.
Default is B<infile> filename
with optional suffix F<.ttl> removed and suffix F<.puml> added.
=back
=cut
......@@ -153,7 +157,7 @@ pod2usage("$0: Missing input filename.\n")
unless (@ARGV);
my $infile = path($ARGV[0]);
my $outfile = path( $infile->basename('.ttl') . '.puml' );
my $outfile = path( $ARGV[1] || $infile->basename('.ttl') . '.puml' );
my $prefixfile = path('prefixes.ttl');
my $prefixes = $prefixfile->exists ? $prefixfile->slurp_utf8 : "";
......
  • What is the benefit of this? Can you think of a useful scenario where you wouldn't want to call it .puml ?

    A related idea: batching up would be useful, I added this to TODO (excuse the orgmode markup)

    • Batch a number of ~ttl~ files to one ~puml~ file
      • Rationale: plantuml is slow to start up, so putting several diagrams in one file will make things faster:
        @startuml file1.png
          # made from file1.ttl
        @enduml
        @startuml file2.png
          # made from file2.ttl
        @enduml
    • However, this interferes with ~make~ processing that regenerates only ~png~ for changed ~ttl~ files. So we need a smarter ~Makefile~ that batches up only the changed ~ttl~ for processing.
    • ~rdfpuml~ should take multiple input files, and write a single output
    • It would also be useful to take a whole folder of ~ttl~ tiles as input
  • Quoting Vladimir Alexiev (2018-12-06 16:45:45)

    What is the benefit of this? Can you think of a useful scenario where you wouldn't want to call it .puml ?

    Defaults make sense but tools should not hardcode naming.

    Maybe user environment dictates a different suffix - e.g. ".tmp.puml" or ".uml".

    A related idea: batching up would be useful, I added this to TODO

    Ahh, good point.

    I am not convinced batching is sensible to support in rdfpuml (seems that is better handled in a script actually calling PlanUML), but the very notion that other features may want to use arguments instead of outfile it quite relevant - also because it is not really important to use argument to pass output filename (using option --filename is fine).

    I will revert this!

    (excuse the orgmode markup)

    You are excused - for now, but I want to discuss that later... ;-)

    • However, this interferes with ~make~ processing that regenerates only ~png~ for changed ~ttl~ files.

    Makefile can adapt to however syntax we decide for the core scripts.

    • Jonas

    signature.asc

  • mentioned in commit 29ef61bb

    Toggle commit list
  • Reverted!

  • smarter Makefile that batches up only the changed ttl Makefile can adapt to however syntax we decide for the core scripts

    Where is it better to put these smarts? Perhaps another perl script because Makefile features have a steep learning curve, and to avoid another strong dependency.

    • How to call it, rdfpumls (too similar to rdfpuml) or rdfpuml-many (sounds stupid)
    • Need a rdfpuml option to write out filename after @startuml
    • this MUST use the input filename as base, and could add an output folder
    • I think we need a design for this first, because there'll be too many incompatible options, and we'll get the user confused
  • Quoting Vladimir Alexiev (2018-12-07 11:31:38)

    smarter Makefile that batches up only the changed ttl Makefile can adapt to however syntax we decide for the core scripts

    Where is it better to put these smarts?

    Very interesting question but unrelated to this (later reverted) commit.

    Let's discuss that separately either loosely by email, or (if you want) I can enable issue tracker here on Salsa for us to use, or if you prefer then create issues at Github.

    signature.asc

  • mentioned in commit a44b81bb

    Toggle commit list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment