Open
Description
@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 :
- add prefixes for all used props.
- I don't use
nsN:
prefixes - I first consult https://prefix.cc
- (*) If not, I make a reasonable prefix myself.
- I don't use
- sort prefixes alphabetically
- (*) but the own ontology prefix first
- I also align namespaces on
<
- sort turtle blocks (subjects) alphabetically by prefixed name, not full URL
- It's better to first sort by kind (see
sections
below) - but the ontology node first
- (*) also author records and any other subsidiary nodes describing the ontology
- (*) any external terms last
- It's better to first sort by kind (see
- I also add comments to delineate the sections. They come in this order:
### Ontology
### Classes
### Properties
### Individuals
### External Terms
- You could also sort them by kind, but then do you make 3 sections per external ontology?
- Since there are usually few external terms, better to keep them all in one section.
Note: the (*) items are harder to implement, so they are optional.
Related links:
- @fititnt in MVP of RDF/Turtle canonization/file formatting for generated dictionaries EticaAI/lexicographi-sine-finibus#46 describes similar enhancements they have done.
- Another nice idea: emit multiple values as separate lines
- Sort multiple langStrings by lang rather than value
- Graham Higgins in https://groups.google.com/g/rdflib-dev/c/EUW2fawv4mw mentions that some tools preserve order of triples, but rdflib is not mentioned as one of them, and this cannot be relied upon
AFAIK, rdflib and TQ are the only software that care about the aesthetics of turtle output.
If this and #2881 are implemented, I'll switch from jena riot to rdflib.
Metadata
Metadata
Assignees
Labels
No labels