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 derive a slot from https://rds.posccaesar.org/ontology/lis14/rdl/ #1281

Open
Silvanoc opened this issue Feb 6, 2023 · 5 comments
Open
Labels

Comments

@Silvanoc
Copy link
Contributor

Silvanoc commented Feb 6, 2023

Is your feature request related to a problem? Please describe.
I'm failing to create a slot derived from the ontology defined in https://rds.posccaesar.org/ontology/lis14/rdl/

Describe the solution you'd like
I would like to be able to write something like:

prefixes:
  rdl: https://rds.posccaesar.org/ontology/lis14/rdl/
[...]
slots:
  mySlot:
    is_a: rdl:hasFeature

rdl:hasFeature would resolve to https://rds.posccaesar.org/ontology/lis14/rdl/hasFeature

How important is this feature? Select from the options below:
• Low - it's an enhancement but not crucial for work

When will use cases depending on this become relevant? Select from the options below:
• Unclear, just experimenting

Additional context
The above mentioned is_a declaration fails with

ValueError: File "xyz.yaml", line 46, col 15 Slot: "asset__mySlot" - unknown is_a reference: rdl:hasFeature
@cmungall
Copy link
Member

cmungall commented Feb 6, 2023

The is_a should point to a slot that is in your schema.

If you want to declare that your slot has the same semtics as rdl:hasFeature then use slot_uri.

See:

https://linkml.io/linkml/schemas/uris-and-mappings.html#class-uri-and-slot-uri

@nlharris nlharris added the enhancement New feature or request label Feb 7, 2023
@Silvanoc
Copy link
Contributor Author

Silvanoc commented Feb 7, 2023

Thanks for the quick reply!

I don't want it to have exactly the same semantics, but inherited. Therefore not an "exact match", but a "sub-slot/property". I haven't added the differences on the subproperty for simplification, but there are some.

I'm looking for what gets mapped to rdfs:subPropertyOf rdl:hasFeature in an OWL file. Whereas with slot_uri I get skos:exactMatch rdl:hasFeature.

What is also weird is that though the subproperty_of slot of a SlotDefinition is declared to be have the URI of what I expect to get in the OWL (rdfs:subPropertyOf), it doesn't result in a rdfs:subPropertyOf in the resulting OWL. Whereas is_a does result in the expected rdfs:subPropertyOf, only limited to my schema.

I could always have a workaround like following, but it remains an ugly workaround:

slots:
  hasFeature:
    slot_uri: rdl:hasFeature
  my_slot:
    is_a: hasFeature

Background information: I'm experimenting with LinkML. I'm coming from Protégé to define my ontology. That's therefore my reference.

BTW, the same applies to subclasses, where I'd expect rdfs:subClassOf.

@Silvanoc
Copy link
Contributor Author

Silvanoc commented Feb 7, 2023

What I also wonder is why is_a is being converted to skos:exactMatch, when there are "mappings" for this purpose.

@turbomam
Copy link
Contributor

@Silvanoc can you share a link to whatever LinkML modeling you have at this point, even if it does generate some errors?

@Silvanoc
Copy link
Contributor Author

Silvanoc commented Feb 13, 2023

@Silvanoc can you share a link to whatever LinkML modeling you have at this point, even if it does generate some errors?

What I'm modelling at this point would have too much unneeded information for the matter of this discussion. Therefore I'm sharing an artificially built model that reproduces the different mentioned points.

Model:

id: https://example.org/broken/owl
prefixes:
  linkml: https://w3id.org/linkml/
  rdl: https://rds.posccaesar.org/ontology/lis14/rdl/
  browl: https://example.org/broken/owl#
default_curi_maps:
  - semweb_context
imports:
  - linkml:types
default_prefix: browl
default_range: string

classes:
  rdl__FunctionalObject:
    class_uri: rdl:FunctionalObject
  my_class:
    is_a: rdl__FunctionalObject

slots:
  rdl__hasFeature:
    slot_uri: rdl:hasFeature
  my_slot:
    is_a: rdl__hasFeature

  should_be_a_subprop:
    subproperty_of: rdl__hasFeature

You can see the resulting OWL with gen-owl v1.4.4 in the attached file broken.owl.ttl (extension changed from ttl to txt for GitHub to accept it).

Please notice that I would have liked to specify my_class is_a rdl:FunctionalObject, but LinkML does not allow me to do so. Therefore I'm using the rdl__ items as a workaround.

I'd like to highlight following from the result:

Index Pseudo LinkML Pseudo OWL
1 my_slot is_a rdl__hasFeature my_slot rdfs:subPropertyOf rdl:hasFeature
2 rdl__hasFeature slot_uri rdl:hasFeature rdl:hasFeature skos:exactMatch rdl:hasFeature
3 my_class is_a rdl__FunctionalObject MyClass rdfs:subClassOf RdlFunctionalObject
4 rdl__FunctionalObject class_uri rdl:FunctionalObject RdlFunctionalObject skos:exactMatch rdl:FunctionalObject
5 should_be_a_subprop subproperty_of rdl__hasFeature should_be_a_subprop rdfs:range linkml:String

Table line 1 shows what I was expecting when forced to use the workaround: since my_slot is a subclass of rdl_hasFeature and rdl__hasFeature has the slot_uri rdl:hasFeature, then my_slot is a sub-property of rdl:hasFeature.

The generated rdl:hasFeature skos:exactMatch rdl:hasFeature (see table line 2) is obviously broken. It isn't only an "exact match", both subject and object are the same!

Why the same doesn't happen with my_class (table lines 3 and 4) is not consistent at all. And not only that, but it's not showing as "smart" as the deduction taken for my_slot.

Then having the slot subproperty_of in SlotDefinition and not resulting in rdfs:subPropertyOf (see table line 5) was hopefully not intended, since it's completely counter-intuitive. The result is also quite unexpected.

Finally, the slot subclass_of in ClassDefinition fails with ValueError: Unknown argument: subclass_of = 'rdl__FunctionalObject'.

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

No branches or pull requests

5 participants