Giter Site home page Giter Site logo

Comments (22)

dselman avatar dselman commented on September 27, 2024 1

Great, it's all yours!

from concerto.

dselman avatar dselman commented on September 27, 2024 1

This may be helpful: https://concerto.accordproject.org/docs/reference/codegen/codegen-create-new
(note that the links in this page are incorrect, as the codgen package was recently moved) cc @jonathan-casey

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Hi @dselman,
Just wanted to clarify if this is what the requirement is?
For the following CTO file,

namespace [email protected]

abstract concept Person
{
    o String firstName
    o String lastName
}

concept Driver extends Person {
  o String favoriteColor
}

concept Car identified by vin
{
    o String vin
    o Person owner
}

If we do concerto vocab --model [email protected] should hit the new API in concerto-vocabulary to generate a bootstrap teamplate that uses englishMissingTermGenerator?
Example output YAML file:

locale: en
namespace: [email protected]
declarations:
  - Person: # Add your definition
    properties:
      - lastName: lastName of the Person
      - firstName: firstName of the Person
  - Driver: # Add your defination
    properties:
      - favoriteColor: favoriteColor of the Driver
  - Car: # Add your definition
    properties:
     - vin: vin of the Car
     - owner: owner of the Car

from concerto.

dselman avatar dselman commented on September 27, 2024

Close! What I was thinking was a new code generator, so we could run it using:

concerto compile --model [email protected] --target vocabulary

That saves creating a new CLI command etc.

The visitor for the code generator would create a voc file for each model file in the model manager.

The English Missing Term Generator will allow us to populate those # Add your definition with a machine generated term that people can then customise.

Would you like to work on this one?

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Yes sure.

The English Missing Term Generator will allow us to populate those # Add your definition with a machine generated term that people can then customise.

Just saw the method and edited the YAML file.

from concerto.

dselman avatar dselman commented on September 27, 2024

BTW - the English Missing Term Generator can also be applied to concept names (property name is optional).

from concerto.

dselman avatar dselman commented on September 27, 2024

Don't forget to register the new code generator here: https://github.com/accordproject/concerto-codegen/blob/main/lib/codegen/codegen.js

And add doc page here: https://github.com/accordproject/concerto-docs/tree/main/docs/reference/codegen

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Yes, sure will keep in mind. Thank you Dan. :)

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Hi @dselman,

I was testing the vocab file generated by the code generator I've written. While testing it on this repl https://replit.com/join/xeqmqanuuo-sanketshevkar
I'm not able able to add a command set to the model manager when any scalar value is present in the .cto file. In other cases it's working fine.
I am getting the following error.

TypeError: decl.getProperties is not a function
    at /home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:254:22
    at Array.forEach (<anonymous>)
    at /home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:230:40
    at Array.forEach (<anonymous>)
    at VocabularyManager.generateDecoratorCommands (/home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:229:38)
    at Object.<anonymous> (/home/runner/AccordProjectConcerto-Vocabulary/index.js:126:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
Hint: hit control+c anytime to enter REPL.

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Another question, how should I output vocab for Scalar type declarations?

from concerto.

dselman avatar dselman commented on September 27, 2024

We must have broken vocabulary management when we added scalars. Do you want me to fix that?

We can handle scalars in the vocabulary similar to concepts, just without properties.

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

If that's how the output should be. I can try to patch it up in the same PR?
I don't think it'll be a blocker for this particular PR. I'll investigate and let you know. If it feels like a small patch I can do it myself.

from concerto.

dselman avatar dselman commented on September 27, 2024

Ok, thanks - I will leave it to you.

from concerto.

dselman avatar dselman commented on September 27, 2024

Any progress on this or an ETA? I have a need for this.

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024
  1. Need handle case for relation and scalars.
  2. Write test cases.
    By when do you require this? Should be a few hours work at max. Sorry, kept it on hold, because I have an interview scheduled this week.
    If it's urgent for you I can prioritize it from my side.

from concerto.

dselman avatar dselman commented on September 27, 2024

If you create a draft PR with what you have then I can work on it as well.

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024
  1. Created a new issue in concerto-codegen
  2. Relationship and Scalar are now handled
  3. Need to write tests for field: (fields, enum values, relationships)

I'm trying to raise a PR on concerto-codegen but getting an error, regarding permission

remote: Permission to accordproject/concerto-codegen.git denied to sanketshevkar.
fatal: unable to access 'https://github.com/accordproject/concerto-codegen.git/': The requested URL returned error: 403

from concerto.

dselman avatar dselman commented on September 27, 2024

Strange. I see other PRs have been created: https://github.com/accordproject/concerto-codegen/branches
You need to fork the repo and then create your PR to merge from your fork back to the main branch.

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Ahh 😅
Hadn't forked the repo.
Here's the PR to be reviewed accordproject/concerto-codegen#22
Thanks @dselman

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

I have completed the tests, can you review the PR? @dselman

from concerto.

sanketshevkar avatar sanketshevkar commented on September 27, 2024

Documentation for vocabulary code generation
accordproject/concerto-docs#16

from concerto.

dselman avatar dselman commented on September 27, 2024

This has been implemented.

from concerto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.