Open VladimirAlexiev opened 2 months ago
Just saw the mention, will comment quickly (I have no strong opinion to remember at the moment).
While I don't know (maybe not even exist single person) who come with the nice formatting, its really, really fantastic both the formatting (at least compared with how was done 15~20 years ago) and... have some way to force programs (even if optional) to try hard keep a a consistent output, because it helps when doing diffs.
One of my use cases for this was run same scripts that get data (for example, Wikidata, also converting tables from open data sources) and generating some formats (and RDF is one of then) and if anything minimal changes, is possible also explore the diffs.
About the specific suggestions of @VladimirAlexiev, I have no opinion on very specific details (but I do agree with the general idea). Also, its not merely aesthetics , but helps with diffs.
(And I also would be okay if any of the programs I'm using at some point would change the defaults)
atextor/turtle-formatter is a Jena/Java tool specifically for this purpose
@VladimirAlexiev @fititnt: I wrote the small changes into RDFLib to make the longturtle format. I can think of further enhancements that could be made to make it even better, and which are likely entirely inline with the suggestions above. Also, I would also like to make longturtle the default turtle format for RDFLib 8.x, which may come out later this year.
Yes, I too read turtle all day and care about how it looks!
So consider longturtle as being under active development and I'll take this Issue as input into improvements for it.
I do want to follow up with the work done in the recent (current?) W3C canonical serialization WG to see if there are better things developed there that we could so in serialization here. Again, suggestions/pointers welcome.
I currently use the atextor tools (owl-cli and turtle-format) but it would be nice to have competition from python.
Afaik, RDF Canonicalization deals with numbering of blanks nodes, not any other layout issues.
@nicholascar, @fititnt, maybe @gwhigs The main purpose of longturtle is to facilitate better diffs. Sorting has a lot to do with stability (diff minimization), so I'll share more experience.
Call me weird, but I prefer to read reasonably small ontologies (up to 50 classes, 100 props) in turtle rather than in an ontology editor. So each time I get some ontology, I convert it to turtle (using
riot --formatted=ttl
) and then :nsN:
prefixes<
sections
below)### Ontology
### Classes
### Properties
### Individuals
### External Terms
Note: the (*) items are harder to implement, so they are optional.
Related links:
AFAIK, rdflib and TQ are the only software that care about the aesthetics of turtle output. If this and https://github.com/RDFLib/rdflib/issues/2881 are implemented, I'll switch from jena riot to rdflib.