Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes re prefixOrder #19

Open
VladimirAlexiev opened this issue Sep 9, 2024 · 2 comments
Open

changes re prefixOrder #19

VladimirAlexiev opened this issue Sep 9, 2024 · 2 comments

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Sep 9, 2024

https://github.com/atextor/turtle-formatter/?tab=readme-ov-file#nice-and-configurable-formatting says

(1) Prefixes are sorted by common, then custom.

https://atextor.de/owl-cli/main/snapshot/usage.html#write-command says

--prefixOrder Sort order for prefixes (if they appear in a model) default [rdf, rdfs, xsd, owl]

But take https://www.entsoe.eu/Documents/CIM_documents/Grid_Model_CIM/IEC61970-600-2_CGMES_3_0_1_ApplicationProfiles.zip
eg this ontology v3.0/RDFSEd2Beta/IEC61970-600-2_CGMES_3_0_0_RDFS_501Ed2CD_EQ.rdf .

Both documents above agree, and the output conforms; the rest of the prefixes are sorted alphabetically.

But I question the usability of the result.
In the result below, I marked the "custom" prefixes with ###:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix cim: <http://iec.ch/TC57/CIM100#> . ###
@prefix cims: <http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#> . ###
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix eq: <http://iec.ch/TC57/ns/CIM/CoreEquipment-EU#> . ###
@prefix eu: <http://iec.ch/TC57/CIM100-European#> . ###
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

You see that the interesting (custom) prefixes are spread all over the place.
This is IMHO worse than alphabetically sorting all prefixes.
(That ontology doesn't reuse dcat, dct, skos: it just uses them for metadata.)

So my proposal is this:

  • rename prefixOrder to externalPrefixes
  • put externalPrefixes last since the interesting stuff should come first.
  • put a blank line before them
  • make the default value empty since what should be considered "external" (or "standard") is IMHO ontology-dependent.
@atextor
Copy link
Owner

atextor commented Sep 10, 2024

Hi @VladimirAlexiev,
thanks for bringing this up. I agree with you that this features needs to be better configurable. However I don't agree with you on which prefixes are "interesting" or where they should go; I personally prefer standard prefixes at the top, so reading prefixes from top to bottom always starts with the same things across different files. That's the reason I chose those prefixes as the default value.

The idea of prefixOrder therefore is to choose exactly what order you want, including both "standard" and "external" prefixes, so it does not only apply to the latter. The default value just happens to include "standard" prefixes.
By using a prefixOrder of e.g. cim, cims, eq, eu, rdf, rdfs, xsd, owl, dcat, dct, skos, you should be able to achieve what you want.

Allowing (configurable) blank lines to be inserted at certain places in the prefixes list is a nice idea.

@VladimirAlexiev
Copy link
Author

But see also the linked issue.
That's why I called them externalPrefixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants