Giter Club home page Giter Club logo

duality's People

Contributors

mattkram avatar pre-commit-ci[bot] avatar

Stargazers

 avatar

Watchers

 avatar

duality's Issues

Namespace generation

duality models are represented by Python classes, so these can be composed very flexibly, because we have access to the import mechanism. However, when we export these models to DTDL for representation in ADT or another compatible backend, we need to give each model its own unique ID, which is a DTMI string.

Right now, I duality constructs the DTMI string this way:

  • prefix them all with "dtmi:"
  • followed by a model-specified prefix
  • followed by the class name, converted to camel_case
  • followed by the version number

For example:

class MyChildModel(MyModel, model_prefix="duality:child", model_version=1):
    my_string_property: str
    my_int_property: int

has the id: "dtmi:duality:child:my_child_model;1"

There should be a way to auto-generate the prefixes via the inheritance hierarchy, so the following classes wouldn't need to manually specify their own prefixes:

class MyModel(MyBaseModel, model_prefix="duality", model_version=2):
    my_parent_property: str


class MyChildModel(MyModel, model_prefix="duality:child", model_version=1):
    my_string_property: str
    my_int_property: int

The other issue is, we need a way to structure all of the models in the inheritance hierarchy in a folder structure, so that when the DTDL JSON documents are saved to a repository, they are represented by a folder structure, instead of a flat list of files. Potentially, this should just split the DTMI id string at the : character, replacing it with a /.

For example, "dtmi:duality:child:my_child_model;1" -> dtmi/duality/child/dtmi:duality:child:my_child_model;1.json.

We may also need to normalize the filenames by replacing : and ; with underscores.

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.