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

Vocabulary support for Map Types in Concerto #735

Closed
sanketshevkar opened this issue Oct 17, 2023 · 3 comments · Fixed by #755
Closed

Vocabulary support for Map Types in Concerto #735

sanketshevkar opened this issue Oct 17, 2023 · 3 comments · Fixed by #755
Milestone

Comments

@sanketshevkar
Copy link
Member

Feature Request 🛍️

Vocabulary support for Map Types in Concerto

Use Case

Vocabularies should be able to get applied on Map Types (MapDeclaration, MapKeyType, MapValueType).

Possible Solution

Context

Detailed Description

@Term("Dictionary")
map Dictionary {
  @Term("Key")
  o String
  @Term("Value")
  o Boolean
}

@Term("Dictionary")
map Employees {
  @Term("Employee Id")
  @Term_description("System generated Id for an employee")
  @Term_tooltip("Employee Identification Number")
  o String
  @Term("Employee Name")
  o String
}

@dselman
Copy link
Contributor

dselman commented Oct 17, 2023

Looks great. A design pattern that uses scalars for map keys would be good to test and promote:

@Term("Employee Id") 
scalar EmployeeId extends String

concept Employee identified by id {
   o EmployeeId id
   o String name
   o Integer age
}

@Term("Employee Directory")
map EmployeeDirectory {
   o EmployeeId
   o Employee
}

@sanketshevkar
Copy link
Member Author

sanketshevkar commented Oct 18, 2023

Need changes in VocabularyManager.js & Vocabulary.js.
In VocabularyManager the changes would be around the generateDecoratorCommands.
Since MapDeclarations have KeyType and ValueType which are different from Property, which might need to have separate method term resolution for them.

  • resolvePropertyTerms (previously resolveTerms)
  • resolvePropertyTerm (previously resolveTerm)
  • getPropertyTerms (previously getTerms )
  • getPropertyTerm(previously getTerm)
  • getMapKeyTerms
  • getMapKeyTerm
  • getMapPropertyTerms
  • getMapPropertyTerm

In Vocabulary.js the validate method needs to be updated to capture missing and additional terms for MapDeclaration, MapKey and MapValue.
Similar to VocabularyManager we might need different methods to get terms for properties, mapkeytypes and mapvaluetypes

We need to make sure that the above changes are backwards compatible and don’t break existing dependent programs. eg: wrap getTerms with getPropertyTerms

@sanketshevkar
Copy link
Member Author

Looks great. A design pattern that uses scalars for map keys would be good to test and promote:

@Term("Employee Id") 
scalar EmployeeId extends String

concept Employee identified by id {
   o EmployeeId id
   o String name
   o Integer age
}

@Term("Employee Directory")
map EmployeeDirectory {
   o EmployeeId
   o Employee
}

Will this mean that the key type of EmployeeId in the map inherits its vocabulary term from the Scalar type that we have defined above?
If yes,
We also need a Term decorator separately for a key type if its of String of dateTime value. In that case which term decorator should the scalar type key inherit? One defined at the Scalar declaration level or at key level?

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 a pull request may close this issue.

3 participants