Repository navigation
Conversation
Leaves the values of the named metamodel slots out of the element metadata, e.g. --exclude-metaslot from_schema drops skos:inScheme. Default output is unchanged; unknown names are an error. Closes linkml#3549
wkp-admin
left a comment
There was a problem hiding this comment.
Review of linkml#4297. The change is small and in the right place: the one guard in add_metadata covers classes, slots, enums, permissible values and the header, and the annotation-property declaration disappears with it because _declare_annotation_properties derives declarations from the predicates in use. The default output is unchanged. Locally the 8 new tests pass and upstream CI is green.
The three points below are non-blocking. I checked each one by running the generator on this head (97285f59f):
- Types are named but have no metadata to exclude.
add_typenever callsadd_metadata, so a type'stitle/descriptionis not written with eithertype_objectssetting. The docstring and the docs list types anyway. - Some valid metaslot names do nothing. The check accepts every metamodel slot. A slot mapped into
linkml:(e.g.is_a,slots) or a class-ranged one is never written, so--exclude-metaslot is_apasses the check and has no effect. - A bare string is split into characters in the Python API.
exclude_metaslots="from_schema"becomesfrozensetof single characters, and the error lists_, a, c, e, f, ....
The test gap is small: test_exclude_applies_to_every_element covers a permissible value but not the enum node itself.
| """Names of metamodel slots whose values are left out of the element metadata. | ||
|
|
||
| For example ``["from_schema"]`` leaves out ``skos:inScheme`` on every class and | ||
| property. This applies to the metadata of classes, slots, types, enums, permissible |
There was a problem hiding this comment.
add_type does not call add_metadata, so types carry no dcterms:title/skos:definition with type_objects on or off. I checked a type with title and description and got neither triple. Suggest dropping "types" here and in docs/generators/owl.rst:131 (and in the PR description), so nobody expects this option to do something for types. Whether types should get metadata is a separate issue.
| if self.xsd_anyuri_as_iri is not None: | ||
| deprecation_warning(XSD_ANYURI_AS_IRI_OPTION, stack_level=4) | ||
| self.exclude_metaslots = frozenset(self.exclude_metaslots) | ||
| unknown = self.exclude_metaslots - set(self.metamodel_schemaview.all_slots()) |
There was a problem hiding this comment.
Two small points about this check:
- It accepts every metamodel slot, but
add_metadatawrites only the slots mapped outsidelinkml:with a non-class range.exclude_metaslots=["is_a", "slots"]passes and does nothing. That goes against the intent "an unknown name is an error, not a silent no-op". You could either check against the slots that can actually be written, or document that slots in thelinkml:namespace are never written, so excluding them has no effect. exclude_metaslots="from_schema"(a str is a validIterable[str]) is split into characters:ValueError: Not metamodel slots, cannot exclude: _, a, c, e, f, h, m, o, r, s. A one-line guard,if isinstance(self.exclude_metaslots, str): self.exclude_metaslots = [self.exclude_metaslots], or a clearer error would fix it. The CLI is not affected, becausemultiple=Truealways passes a tuple.
| [ | ||
| URIRef(EX + "Person"), | ||
| URIRef(EX + "age"), | ||
| URIRef(EX + "Colour#red"), |
There was a problem hiding this comment.
Nit: the docs list enums, but only the permissible value is covered here. Adding URIRef(EX + "Colour") would need a title/description on Colour in SCHEMA.
Review copy of linkml#4297 by
matentzn, same head (97285f59f). Review comments forjdsikago here first; what holds up is carried to the upstream PR.gen-owl --exclude-metaslot NAME(repeatable) leaves the values of a metamodel slot out of the element metadata, e.g.--exclude-metaslot from_schemadropsskos:inSchemefrom every class and property. It applies to classes, slots, types, enums, permissible values and the ontology header; the annotation property declaration of an excluded predicate goes with it, andannotations:are not affected. An unknown name is an error. The default output does not change.The docs also point to
--ontology-uri-suffix ""for theskos:inSchemetarget not matching the ontology IRI.Refs linkml#3549