RDFLib / pyLODE

An OWL ontology documentation tool using Python and templating, based on LODE
BSD 3-Clause "New" or "Revised" License
175 stars 70 forks source link

Inconsistencies regarding the display of annotations / descriptions for graphs and properties #136

Open sk-hdm opened 3 years ago

sk-hdm commented 3 years ago

This is perhaps two separate issues, so apologies if they should be separated. I'm having trouble getting multiple annotation properties to display, either for the ontology itself or for individual properties. I believe this is similar to https://github.com/RDFLib/pyLODE/issues/92, but different enough that it seems to remain an issue.

For the ontology, the property used to generate the (html) output of 'Description' changes depending on the input .ttl. For one, dc:description or dcterms:description is used, but the rdfs:comment is ignore. For another file with a dcterms:description and two rdfs:comment properties, one of the rdfs:comment properties is used instead.

As for the property descriptions, several properties have a skos:definition and an rdfs:comment, but the latter is ignored in all cases. I'm not sure if only showing one annotation property is expected behavior, but I think ideally the output should display any accompanying annotations per property.

Any assistance with these issues would be appreciated.

nicholascar commented 3 years ago

the property used to generate the (html) output of 'Description' changes depending on the input .ttl. For one, dc:description or dcterms:description is used, but the rdfs:comment is ignore. For another file with a dcterms:description and two rdfs:comment properties, one of the rdfs:comment properties is used instead.

pyLODE treats all dc:description, dcterms:description, skos:definiton & rdfs:comment properties on the ontology as equivalent and "builds out" the internal graph of the ontology to ensure that any of those properties is replaces with dcterms:description, see ontdoc.py#L257. This means you can use any of those properties for the ontology descriptions but not several of them at the same time - it will only "see" one of them and the order is undefined since RDF graphs don't natively have ordering for multiple values of the same property.

As for the property descriptions, several properties have a skos:definition and an rdfs:comment, but the latter is ignored in all cases.

Same reason as above!

I'm not sure if only showing one annotation property is expected behavior,

Yes, for description, although there are other properites for which multiple values are allowed, such as dcterms:creator.

If I enable multiple values for dcterms:description, and thus for euivalent properties too (see the list above in my first answer), I still won't be able to order them.

So I take the outcome of this issue to be to allow multiple values for dcterms:description. Will that do?

graybeal commented 3 years ago

I believe a fair number of ontologists deliberately use 2 or more of these concepts differently and independently, certainly with respect to documenting concepts. I would say rdfs:comment and skos:definition definitely have different connotations than the two description terms, so they should not be collapsed/treated as equivalent.

I'm aware of a few cases where people put the same text in multiple annotation concepts, but I would still hope to see both annotations present, to accurately reflect the original ontology. (Often I just want to quickly check if a particular annotation was specified, but if it gets replaced, I won't be able to do that.)

sk-hdm commented 3 years ago

@nicholascar - Thanks for the detailed response. As for the proposed fix:

So I take the outcome of this issue to be to allow multiple values for dcterms:description. Will that do?

I think @graybeal is correct. Occasionally, some annotation terms seem to be used interchangeably, but as mentioned, ones such as rdfs:comment and skos:definition are fairly distinct and used for different purposes.

In my use case, the ability for properties to display these separately in the output would be ideal, but failing that, multiples of a single dcterms:description may be helpful.

nicholascar commented 3 years ago

OK, I'm going to go with multiple dcterms:description values initially and then think about @graybeal's point. I do acknowledged it - I've seen ontologies using dcterms:description alongside rdfs:comment etc. but the reason I haven't implemented them separately is because the semantics are un-clear: what does rdfs:comment mean alongside dcterms:description? I can work out what rdfs:comment means alongside skos:definition - the latter actually defines the class/prperty, the former is just an additional note - but I'd like a single, cohesive set of annotations to be used in general.

I think the best bet is to suggest use of skos:definition for the defining text and then other SKOS properties with defined intentions - skos:historyNote, skos:scopeNote being the main ones. Since all the SKOS *Note properties are subPropertyOf rdfs:comment, I'd then strongly discourage people from using rdfs:comment and SKOS properties!

I'm thinking of submitting pyLODE to a semantic web workshop later in the year and, if I do, I'll need to tidy up all this theory. I should tidy up the theory regardless of course... Still, I will eventually write up these thoughts and then put it to users to see what they make of them.

sk-hdm commented 3 years ago

Alright, looking forward to the change, thank you!

I agree that the differentiation between rdfs:comment and dcterms:description is a bit unclear, so no real answer for that. I'll most likely end up cleaning up the use of them for the ontology description since now it's a bit messy. As for skos:definition and rdfs:comment, the distinction is a bit more clear as you say, and perhaps there is more reasonable way to go about using multiple annotations for single properties.

I think the best bet is to suggest use of skos:definition for the defining text and then other SKOS properties with defined intentions - skos:historyNote, skos:scopeNote being the main ones. Since all the SKOS *Note properties are subPropertyOf rdfs:comment, I'd then strongly discourage people from using rdfs:comment and SKOS properties!

Since I haven't tried this specifically (as I was using rdfs:comment), does pyLODE currently display multiple skos annotations properties (e.g. a skos:definition, along with a skos:scopeNote) for a single property, or is this also a change that will be implemented? If it's currently implemented, I could easily change my rdfs:comments to a skos property and solve the issue.

nicholascar commented 3 years ago

...does pyLODE currently display multiple skos annotations properties (e.g. a skos:definition, along with a skos:scopeNote) for a single property...

Have a look at https://github.com/rdflib/pyLODE/#what-pylode-understands and yes, pyLODE understands skos:historyNote at the ontology/vocabulary level and scos:scopeNote at the elements (Class & Property) level. See this DecProv ontology class for a skos:scopeNote example alongside a description.

graybeal commented 3 years ago

There are two reasons people would be using rdfs:comment rather than SKOS properties: there isn't a SKOS property that applies; or, they don't want to entail or even reference SKOS in what is explicitly a logic model and not a vocabulary. So I expect many people do use rdfs:comment with disciplined intent.

Keep in mind that all of these allow multiple uses per subject anyway (partly for language reasons, partly to allow multiple independent annotations of a type), so there should not be a case IMHO where you only show one of several.

I confess using the properties dc: and dcterms:description is something I'm most familiar with at the ontology level, but because they can be applied to any entity, I suppose they need to be taken into account throughout. The practice for describing non-SKOS ontological concepts is likely pretty diverse.

nicholascar commented 3 years ago

Well at the moment rdfs:comment, dc:description, dcterms:description & skos:definition are all catered for, so people are quite able to keep using rdfs:comment if they wish (as many/most do).

Definitely will enable multiple uses per subject! And I do need to work on multiple language rendering. Probably need a setting to indicate a primary language and then support all others.

I think I can do better regarding the description of what's supported and also allow people to ask for more things to be supported (sdo:description perhaps??) since the main goal for pyLODE's structure is to be easy to update.

dr-shorthair commented 3 years ago

@graybeal skos:note is the general case. All the other annotations are sub-properties of that.

nicholascar commented 3 years ago

skos:note isn't catered for (see ontdoc.py#L257) but should be, so I'll add it when making the change to handle multiple values.

smrgeoinfo commented 3 years ago

One way I've handled these multiple text blobs is to just prefix Description sections with the property name used in the source, e.g.

Description

dc:description: This owl ontology is designed to duplicate the intention of the CGI SimpleLithology201001 vocabulary. It provides an OWL view of the vocabulary ........


rdfs:comment: To see the hierarchy of categories, open in protege (or similar owl-enable software with some inferencing capabilities). In Protege, run 'Pellet' o......