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

How to handle comments? #12

Open
hoijui opened this issue Aug 31, 2024 · 0 comments
Open

How to handle comments? #12

hoijui opened this issue Aug 31, 2024 · 0 comments

Comments

@hoijui
Copy link
Contributor

hoijui commented Aug 31, 2024

The issue

In Rust, there are documentation comments, which are always unambiguously associated with a part of the code (a specific function, a module, ...), and there are other comments, which (at regarding machine-readability) can not be clearly associated with a specific part of the code.
In RDF, doc comments would have to come in the form of regular triples/quads, while all the regular comments would be of the later type, that can not be unambiguously associated with a piece of code.

This later type poses a problem for auto-formatters in any format, including RDF.
This issue gets worse the heavier formatting one applies, e.g. when sorting subjects, predicates and objects.

Possible Solutions

I can think of two solutions:

  1. Avoid using this type of comments
  2. Create/Use a kind of meta-standard that defines positioning rules plus extra syntax to be used within the content of these comments, that allows them to be automatically and unambiguously associated with a part of the code.

The later is a huge undertaking and probably a bad idea anyway. Either way, it is out of scope for this project, I would say.

I personally opt for the first option in the Turtle I write and maintain myself, by converting comments to triples.
So far I use mostly the predicates rdfs:comment, schema:comment and vaem:todo.
Some comments that mark a section of the Turtle file, including multiple subjects, I converted into a separate subject being a skos:Concept, and then made all the subjects in that section refer to this new subject with skos:member.
This is not perfect yet, but I am pretty happy with this general approach, as it allows for machine-readability, unambiguous association of the comments, and it retains the comments when converting to other RDF serializations, or when loading the data into a DB like oxigraph. One could also easily filter out comments when converting or loading into a DB, if desired. A clear downside is, that it is less flexible this way, as comments can only be associated to subjects. I was also not able to find an ontolgy specifically made for this purpose, so for example I have not found a "FIXME" and "HACK" equivalent in RDF.

Proposed Changes

I imagine a section in the README of this project, dedicated to comments. It could introduce the issue and give suggestions for how to handle it.

We could also include a CLI switch that enables the issuing of warnings for comments in the input, either always, or only when certain formatting options are enabled that are likely to miss-place comments.

Motivation

I manage a few projects that mainly consist of an ontology that many people are meant to be contributing to. Many of these people are non-techies, but there is always also at least one tech person present. The optimal way to handle this situation (In my opinion). is to host the ontology as a turtle file in git, and allow people to freely choose the way to edit it. Some would edit it as-is, in textual form, while others would use GUI editors ( ... dum di dum ....). For this to work smoothly, both auto-formatting and the concise handling of comments is essential.
I would love this to be somewhat standardized and though about and discussed by more minds, even if very unofficially in a section of this projects README and in issues.


An example ontology where I try to practice "comments as triples":
https://github.com/iop-alliance/OpenKnowHow/blob/master/src/spec/okh.ttl

an affected PR (but not solving this): #9

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

1 participant