Skip to content
New issue

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

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

Already on GitHub? # to your account

slot_usage induces new sub-slots, these should be hidden in many exports #48

Closed
cmungall opened this issue Aug 18, 2020 · 5 comments
Closed
Labels
generator-misc Pertaining to more than one generator, or perhaps one that doesn't exist yet

Comments

@cmungall
Copy link
Member

blml allows the usage of a slot to be refined (or even defined) on a per-class basis.

E.g The label slot may be generic for any kind of name. For a person class we may add documentation that states this should be a string that is typically first and last concatenated (OK, this would not be a very good rule for many names but you get the idea).

Originally I had conceived of information about a slot always being retrieved via a compound key of (class,slot). If there is a slot usage for a class, use that. Otherwise a superclass. Otherwise generic slot.

In the current implementation rather than compound key, a primary key is synthesized by concatenating class and slot. This is fine as an underlying implementation, but this should be hidden in many cases, as it causes confusion (e.g biolink/biolinkml#228).

here is a test example:

id: https://github.com/biolink/biolinkml/issues/228
name: test228
title: induced slots

types:
  string:
    base: str
    uri: xsd:string

  

classes:

  r1: {}
  r2:
    is_a: r1
  r3:
    is_a: r2
  
  c1:
    slots:
      - s
    slot_usage:
      s:
        description: s in c1
        range: r1
  c2:
    is_a: c1
    slots:
      - s
    slot_usage:
      s:
        description: s in c2
        range: r2
  c3:
    is_a: c2
    slots:
      - s
    slot_usage:
      s:
        description: s in c3
        range: r3
  d:
    slots:
      - s
    slot_usage:
      s:
        required: true

slots:
  s:
    description: >-
      generic s description     

markdown changes required:

currently this generates pages for c{1,2,3}_s, as well as s. Only pages for s should be generated. c1,2,3 specific usage can be included in the markdown file for s

All usages of the arrow notation in the generated markdown docs should be removed

owlgen changes required:

currently uris are made for c{1,2,3}_s. We should only have a uri for s.

class-specific ranges can be expressed using an owl subclass axiom

python changes:

reported separately by @wdduncan here: biolink/biolinkml#228 -- but I think current behavior may be ok, if a little confusing

json schema changes:

the current json schema generation is almost correct. There are no induced slots created - only s.

Currently gen-json-schema on the above makes:

{
   "$id": "https://github.com/biolink/biolinkml/issues/228",
   "$schema": "http://json-schema.org/draft-07/schema#",
   "definitions": {
      "C1": {
         "additionalProperties": false,
         "description": "",
         "properties": {
            "s": {
               "$ref": "#/definitions/R1",
               "description": "s in c1"
            }
         },
         "required": [],
         "title": "C1",
         "type": "object"
      },
      "C2": {
         "additionalProperties": false,
         "description": "",
         "properties": {
            "s": {
               "description": "generic s description",
               "type": "string"
            }
         },
         "required": [],
         "title": "C2",
         "type": "object"
      },
      "C3": {
         "additionalProperties": false,
         "description": "",
         "properties": {
            "s": {
               "$ref": "#/definitions/R3",
               "description": "s in c3"
            }
         },
         "required": [],
         "title": "C3",
         "type": "object"
      },
      "R1": {
         "additionalProperties": false,
         "description": "",
         "properties": {},
         "required": [],
         "title": "R1",
         "type": "object"
      },
      "R2": {
         "additionalProperties": false,
         "description": "",
         "properties": {},
         "required": [],
         "title": "R2",
         "type": "object"
      },
      "R3": {
         "additionalProperties": false,
         "description": "",
         "properties": {},
         "required": [],
         "title": "R3",
         "type": "object"
      }
   },
   "properties": {},
   "title": "test228",
   "type": "object"
}

this is pretty good. C1 and C3 are perfect. the localized use of s is correct. However, C2 is deferring to the generic slot, which is bizaarre

@cmungall
Copy link
Member Author

@cmungall
Copy link
Member Author

cmungall commented Jan 25, 2021

When running gen-markdown on the above

I get D.md as:

# Type: d




URI: [https://github.com/biolink/biolinkml/issues/228/D](https://github.com/biolink/biolinkml/issues/228/D)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[D|s:string])

## Referenced by class


## Attributes


### Own

 * [d➞s](d_s.md)  <sub>REQ</sub>
    * range: [String](types/String.md)

this is not good. The description has not been overridden, so the generic description should be used.

@hsolbrig hsolbrig transferred this issue from biolink/biolinkml Mar 25, 2021
cmungall added a commit to linkml/linkml-runtime that referenced this issue Aug 9, 2021
This provides a way to dynamically perform operations over a "raw"
schema object. It thus provides an alternative to loading schemas
using schemaloader, and also provides a more generic replacement
to https://github.com/biolink/biolink-model-toolkit/

schemaview implements a "facade" pattern over a schema object.
It allows us to access things like the inferred properties
of a slot, without altering the underlying schema object

The design is inspired partly by the OWLAPI, and all methods
are parameterized by an "imports" flag which indicates whether
the method should be resolved over the full imports closure
or just the main schema. No merging of imports necessary

It also provides ancestor/descendant methods. These by default
include mixins and is-as, but these methods can also be parameterized

We also took the cache design from bmt, but this should be robust to updates
E.g. if modifications to the underlying schema is made then the cache will
be rebuilt.

See:
     - linkml/linkml#59
     - linkml/linkml#144
     - linkml/linkml#48
     - linkml/linkml#270
@nlharris
Copy link
Contributor

nlharris commented Sep 7, 2022

is this fixed?

@nlharris nlharris added the generator-misc Pertaining to more than one generator, or perhaps one that doesn't exist yet label Oct 21, 2022
@vincentvialard
Copy link

owlgen changes required:

currently uris are made for c{1,2,3}_s. We should only have a uri for s.

class-specific ranges can be expressed using an owl subclass axiom

True for range (because the class specific range must be included in the inherited one), but you can not use an axiom for description, required, multivalued, etc.

So the class_slot uris are necessary.

@cmungall
Copy link
Member Author

Fixed

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
generator-misc Pertaining to more than one generator, or perhaps one that doesn't exist yet
Projects
None yet
Development

No branches or pull requests

3 participants