RDF Formatter Contribution by fkleedorfer · Pull Request #2261 · diffplug/spotless

Adds a formatter for RDF

In its current form, only the TTL format can be formatted using turtle-formatter. All other formats could be handled with Jena, but are currently not implemented.

The PR contains code for a maven plugin, but not a gradle/sbt plugin.

Options are:

  • failOnWarnings: fail if the Jena parser warns
  • verify: after formatting, parse both input and formatted output to a jena Model and compares them. If they are not isomorphic, outputs an error message
  • turtle: a list of style options for the turtle-formatter as documented in the turtle-formatter README Not all options are supported, though.

The PR includes smoke tests that use input/output folders containing files with identical names, for which a utility method was added to the ResourceHarness.