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

[Task] Add samm-cli command to display a model element's definition #570

Open
atextor opened this issue Apr 17, 2024 · 0 comments
Open

[Task] Add samm-cli command to display a model element's definition #570

atextor opened this issue Apr 17, 2024 · 0 comments
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. task

Comments

@atextor
Copy link
Contributor

atextor commented Apr 17, 2024

Is your task related to a problem? Please describe.
When I want to see the definition of a model element I know is present in my models root, but I don't know or remember in which namespace of file it is located, I currently can only do a text search (e.g. using grep or Windows Explorer). It would be much more convenient, if I can just have samm-cli show it.

Describe the solution you'd like
I would like a new samm-cli subcommand called "show" (or "explain", or similar), that prints a model element's definition. I want to be able to provide either a full URN or only a local name. Let's assume my current working directory is a models root, then the command should work something like this:

$ samm show temperature
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.1.0#> .
@prefix : <urn:samm:com.example.mycompany.mydomain:1.0.0#> .
:temperature a samm:Property ;
  samm:preferredName "Temperature"@en ;
  samm:description "The current temperature"@en ;
  samm:characteristic :CelsiusTemperature .

Possible additional options:

  • --fuzzy: Allows fuzzy search, e.g. also finds elements with non-identical but similar names
  • --details: Display details about where the model element was resolved from (e.g. absolut file path)
  • --closure: transitively include all referred elements as well, i.e. in the example also include the definition for :CelsiusTemperature

What should happen when multiple elements are found needs to be clarified. Possible options include:

  • Display only the latest version (if the namespace part of the URNs are identical)
  • Throw an error
  • Interactive selection
  • Display all of them, separated in some way
@atextor atextor added task acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. task
Projects
None yet
Development

No branches or pull requests

1 participant