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

Add mapping capabilities #34

Merged
merged 3 commits into from
Aug 1, 2022
Merged

Conversation

pablo-de-andres
Copy link
Member

No description provided.

@pablo-de-andres pablo-de-andres linked an issue Jul 6, 2022 that may be closed by this pull request
@pablo-de-andres pablo-de-andres marked this pull request as draft July 6, 2022 15:39
@pablo-de-andres
Copy link
Member Author

pablo-de-andres commented Jul 6, 2022

@csadorf I would say it is now ready for you to review/extend it :)

@csadorf csadorf self-assigned this Jul 6, 2022
@pablo-de-andres
Copy link
Member Author

I won't push any more to avoid conflicts, but I just thought we might want to make clearer that the mapping name will be used as an id.

Copy link
Member

@yoavnash yoavnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablo-de-andres, could you provide examples for the responses of listMappings and getMapping?

@pablo-de-andres
Copy link
Member Author

Based on the SimPARTIX example:

  • listMappings a list of the included mapping schema names/ids:
["SimpartixOutput", "SomeOtherSchema"]
  • getMapping/<SimpartixOutput> returns one specific mapping schema:
{
        "name": "SimpartixOutput",
        "type": "dlite",
        "properties": {
            "temperature": "http://emmo.info/emmo#EMMO_affe07e4_e9bc_4852_86c6_69e26182a17f",
            "group": "http://emmo.info/emmo#EMMO_0cd58641_824c_4851_907f_f4c3be76630c",
            "state_of_matter": "http://emmo.info/emmo#EMMO_b9695e87_8261_412e_83cd_a86459426a28",
        }
}

@yoavnash
Copy link
Member

yoavnash commented Jul 8, 2022

Some questions:

  • What is the meaning of the mapping names? Can a machine know that they are associated to other capabilities or are they just meant for humans as a description?
  • Why are the mappings associated with a specific schema? Why aren't they global for the entire app?
  • Why does the type mention DLite? Do the mappings depend on a specific tool? (I believe they shouldn't)
  • It may be that an app provider would like to map a term to multiple ontology concepts (as alternatives). It seems not to be possible at the moment. Could we add a way to support it?
  • For the case of EMMO, how can a human get the labels of the classes in an easy way? (it may defeat the purpose if not possible)

@pablo-de-andres
Copy link
Member Author

pablo-de-andres commented Jul 8, 2022

What is the meaning of the mapping names? Can a machine know that they are associated to other capabilities or are they just meant for humans as a description?

The name is what the response header will use to identify which mapping should be used for the data being sent.

Why are the mapping associated with a specific schema? Why aren't they global for the entire app?

To allow some flexibility/modularity. Could be that the app returns different kinds of data and/or schemas (dlite, cuds, sth else). So you will be told which one applies to the data you received.

Why does the type mention DLite? Are the mappings depend on a specific tool? (I believe they shouldn't)

I thought this could be useful for the person to know how to interpret the rest of the fields. For example, knowing it is dlite I will know that the mappings apply to the objects inside the properties key

It may be that an app provider would like to map a term to multiple ontology concepts (as alternatives). It seems not to be possible at the moment.

You can always return a list as the value:

"temperature": ["IRI1", "IRI2"]
For the case of EMMO, how can a human get the labels of the classes in an easy way? (it may defeat the purpose if not possible)

I assume browsing the ontology -> Look for IRI -> read label. But if this is not very user friendly I would say the responsibility lays more in the ontology side (e.g. FOAF has human readable IRIs)

@pablo-de-andres
Copy link
Member Author

Thinking about it, the type of the schema (dlite, ...) could also be best sent as part of the response header (with the data), to keep the mapping cleaner. But I think it should be somewhere.


@router.get(
"/mappings/{mapping_id}",
operation_id="getMapping",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: getSemanticMapping

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, endpoint name and operation id should be consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here: #34 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would potentially need to be changed to /semanticMappings/{semantic_mapping_id} and getSemanticMapping.


@router.get(
"/mappings",
operation_id="listMappings",
Copy link
Member

@yoavnash yoavnash Jul 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: getSemanticMappingIds

Copy link
Member

@yoavnash yoavnash Jul 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By looking at the other capabilities, it seems listSemanticMappings would be more consistent, and that's also ok for me, although I do think getSemanticMappingIds is somewhat more descriptive.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the route and the operation id somewhat consistent so unless we switch this to /semantic-mappings, I'd recommend to stick to the current implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. In that case I'd personally go with /semantic-mappings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor remark: on the global search route we use camelcase (/globalSearch). I'd encourage following only one style.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally prefer to stick to mappings instead of semanticMappings, but, agreed, if we decide to change it then the endpoint should be /semanticMappings and the operationId should be listSemanticMappings.

@pablo-de-andres Do you want to break the tie?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After an offline discussion with Yoav, I see how the semantic prefix brings some extra information which might be worth the extra characters. I would go with that one.

@pablo-de-andres
Copy link
Member Author

pablo-de-andres commented Jul 8, 2022

Summary of the off-line discussion:

  • The mapping names are just identifiers, useful when different mappings are applicable to different scenarios.
  • The type of the schema (dlite, cuds...) should not be part of the mapping, but rather of the headers sent with the data itself.
  • There is no real need to explicitly indicate the ontology, as there could be different ones being used. If needed, inspect the IRIs.
  • For multiple mapping possibilities, multiple groups should be used. These can then be explicitly listed in the header with the data.
  • Labels are not necessarily as unique or permanent as IRIs, so they will not be included.

Bonus:

  • How does versioning of ontologies affect IRIs?

@pablo-de-andres
Copy link
Member Author

What is the status of this? Any support needed?

@csadorf
Copy link
Collaborator

csadorf commented Jul 19, 2022

What is the status of this? Any support needed?

No, I simply had not had the chance to work on this yet.

Copy link
Collaborator

@csadorf csadorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablo-de-andres I think this is actually more or less done. I just have a few quick questions.

marketplace_standard_app_api/models/object_storage.py Outdated Show resolved Hide resolved
marketplace_standard_app_api/models/object_storage.py Outdated Show resolved Hide resolved
@csadorf
Copy link
Collaborator

csadorf commented Jul 21, 2022

@yoavnash @pablo-de-andres I have commented on the outstanding question regarding the endpoint and operationId names. I don't feel strongly either way so I suggest that the two of you make a decision and then we can move on.

@csadorf csadorf marked this pull request as ready for review July 25, 2022 07:19
@pablo-de-andres pablo-de-andres merged commit b5d2f64 into main Aug 1, 2022
@pablo-de-andres pablo-de-andres deleted the capability-for-semantic-mappings branch August 1, 2022 13:05
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

Successfully merging this pull request may close these issues.

New capability for mappings to semantic entities
3 participants