Exemplo n.º 1
0
    def __init__(self):
        Configuration.__init__(self)
        self.addEntityClass(1, "human", "Human", "H**o Sapiens", [
                makeAttribute("name", "Name", "Name of a human", self.TYPE_STRING, ""),
                makeAttribute("age", "Age", "Age of a human", self.TYPE_INTEGER, 0),
                makeAttribute("weight", "Weight", "Weight of a human", self.TYPE_DOUBLE, 0.0),
            ])
        self.addEntityClass(2, "animal", "Animal", "Just animals", [
                makeAttribute("name", "Name", "Name of an animal", self.TYPE_STRING, ""),
                makeAttribute("weight", "Weight", "Weight of an animal", self.TYPE_DOUBLE, 0),
                makeAttribute("test", "Test", "Weight of an animal", self.TYPE_DOUBLE, 0),
                makeAttribute("test2", "Test", "Weight of an animal", self.TYPE_DOUBLE, 0),
            ])

        self.addRelationClass(101, "friendship", "Friendship", "Friendship relations", [
                makeAttribute("strength", "Strength", "Strength of friendship", self.TYPE_DOUBLE, 0.0),
            ], [
                makeAllowedRelation(
                    {"cname":"human", "multiplicity" : self.MUL_ONE},
                    {"cname":"human", "multiplicity" : self.MUL_ZERO_OR_MORE}
                ),
                makeAllowedRelation(
                    {"cname":"human", "multiplicity" : self.MUL_ZERO_OR_MORE},
                    {"cname":"animal", "multiplicity" : self.MUL_ZERO_OR_MORE}
                ),
            ])
Exemplo n.º 2
0
    def __init__(self):
        Configuration.__init__(self)
        self.addEntityClass(1, "human", "Human", "H**o Sapiens", [
            makeAttribute("name", "Name", "Name of a human", self.TYPE_STRING,
                          ""),
            makeAttribute("age", "Age", "Age of a human", self.TYPE_INTEGER,
                          0),
            makeAttribute("weight", "Weight", "Weight of a human",
                          self.TYPE_DOUBLE, 0.0),
        ])
        self.addEntityClass(2, "animal", "Animal", "Just animals", [
            makeAttribute("name", "Name", "Name of an animal",
                          self.TYPE_STRING, ""),
            makeAttribute("weight", "Weight", "Weight of an animal",
                          self.TYPE_DOUBLE, 0),
        ])

        self.addRelationClass(
            101, "friendship", "Friendship", "Friendship relations", [
                makeAttribute("strength", "Strength", "Strength of friendship",
                              self.TYPE_DOUBLE, 0.0),
            ], [
                makeAllowedRelation(
                    {
                        "cname": "human",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "human",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "human",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }, {
                        "cname": "animal",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
            ])
Exemplo n.º 3
0
    def __init__(self):
        Configuration.__init__(self)

        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name",
                          "For rapid people understanding", self.TYPE_STRING,
                          ""),
            makeAttribute("name", "Unique API Name",
                          "For automated scripts, should be permanent",
                          self.TYPE_STRING, ""),
            makeAttribute("description", "Description",
                          "Additional information and comments",
                          self.TYPE_STRING, "No description"),
        ]
        base_attributes_bottom = [
            makeAttribute(
                "note", "Note",
                "For people, for example, some errors history notes",
                self.TYPE_TEXT, ""),
        ]

        # addEntityClass(cid, name, readable_name, description, attributes_list)
        self.addEntityClass(1, "bus", "Bus", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(2, "bus_controller", "Bus Controller", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(
            3, "bus_controller_type", "Bus Controller Type", "",
            base_attributes_top + [
                makeAttribute(
                    "config_format", "Configuration String Format",
                    "Format of the configuration string to be used by driver",
                    self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(4, "bus_type", "Bus Type", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(
            5, "device", "Device", "", base_attributes_top + [
                makeAttribute("addr", "Address",
                              "Address of the Device at the Bus",
                              self.TYPE_STRING, ""),
                makeAttribute("init_str", "Initialize String",
                              "String to initialize the Device by the driver",
                              self.TYPE_STRING, ""),
                makeAttribute(
                    "sequence_number", "Sequence Number",
                    "Sequence number for sorting devices during export",
                    self.TYPE_INTEGER, ""),
                makeAttribute("bigc_info", "Big Channel Info",
                              "Big channel information [should be temporal]",
                              self.TYPE_TEXT, ""),
                makeAttribute("main_info", "Main Info", "Main information",
                              self.TYPE_STRING, "No main info"),
            ] + base_attributes_bottom)

        self.addEntityClass(
            6, "device_channel", "Device Channel", "", base_attributes_top + [
                makeAttribute(
                    "group_num", "Group Number",
                    "Address of Channel group at Device channel groups (by its Device Type)",
                    self.TYPE_INTEGER, ""),
                makeAttribute(
                    "needs_init", "Needs Initialization",
                    "Is the initialization required by the channel or not",
                    self.TYPE_INTEGER, ""),
                makeAttribute(
                    "init_value", "Initialization Value",
                    "The Value to be used if initialization is needed",
                    self.TYPE_TEXT, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(
            7, "device_channel_group", "Device Channel Group", "",
            base_attributes_top + [
                makeAttribute("is_writable", "Writable",
                              "If channels of the group is writable",
                              self.TYPE_INTEGER, ""),
                makeAttribute("quantity", "Quantity",
                              "The number of channels in the group",
                              self.TYPE_INTEGER, ""),
                makeAttribute("group_number", "Group Number",
                              "The priority for group sorting",
                              self.TYPE_INTEGER, ""),
            ] + base_attributes_bottom)

        #        self.addEntityClass(8, "device_type", "Device Type", "", base_attributes_top + [
        #            makeAttribute("bigc_info", "Big Channel Info", "Big channel information [should be temporal]", self.TYPE_TEXT, ""),
        #            ] + base_attributes_bottom)

        self.addEntityClass(9, "server", "Server", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(
            10, "layer_info", "Layer Info", "", base_attributes_top + [
                makeAttribute("info", "Info", "Information of the layer",
                              self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        ############ EDGES #############
        # addRelationClass(cid, name, readable_name, description, attributes_list, allowed_relations)
        self.addRelationClass(
            101,
            "physical",
            "Physical",
            "Physical connections",
            [
                # makeAttribute("cable_length", "Cable length", "Relation attribute example", self.TYPE_STRING, ""),
            ],
            [
                makeAllowedRelation(
                    {
                        "cname": "server",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "bus_controller",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "bus_controller",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "bus",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                #            makeAllowedRelation(
                #                {"cname":"bus", "multiplicity" : self.MUL_ONE},
                #                {"cname":"bus_device", "multiplicity" : self.MUL_ZERO_OR_MORE}
                #            ),
            ])

        self.addRelationClass(102, "type", "Types", "Typification links", [], [
            makeAllowedRelation({
                "cname": "bus",
                "multiplicity": self.MUL_ONE
            }, {
                "cname": "bus_type",
                "multiplicity": self.MUL_ZERO_OR_MORE
            }),
            makeAllowedRelation(
                {
                    "cname": "bus_controller",
                    "multiplicity": self.MUL_ONE
                }, {
                    "cname": "bus_controller_type",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }),
        ])

        self.addRelationClass(103, "logical", "Logical", " Logical links", [],
                              [
                                  makeAllowedRelation(
                                      {
                                          "cname": "device",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "device_channel",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "server",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "layer_info",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "device",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "device_channel_group",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                              ])

        self.addRelationClass(
            104,
            "responsibilities",
            "Responsibilities",
            "Responsibilities",
            [],
            [
                # Dev-Connection-Dev
                makeAllowedRelation(
                    {
                        "cname": "server",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }, {
                        "cname": "device",
                        "multiplicity": self.MUL_ONE
                    }),
            ])
Exemplo n.º 4
0
    def __init__(self):
        Configuration.__init__(self)



        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name", "For rapid people understanding", self.TYPE_STRING, ""),
            makeAttribute("name", "Unique API Name", "For automated scripts, should be permanent", self.TYPE_STRING, ""),
            makeAttribute("description", "Description", "Additional information and comments", self.TYPE_STRING, "No description"),
            ]
        base_attributes_bottom = [
            makeAttribute("note", "Note", "For people, for example, some errors history notes", self.TYPE_TEXT, ""),
            ]



        # addEntityClass(cid, name, readable_name, description, attributes_list)
        self.addEntityClass(1, "bus", "Bus", "", base_attributes_top + [
            ] + base_attributes_bottom)

        self.addEntityClass(2, "bus_controller", "Bus Controller", "", base_attributes_top + [
            ] + base_attributes_bottom)

        self.addEntityClass(3, "bus_controller_type", "Bus Controller Type", "", base_attributes_top + [
            makeAttribute("config_format", "Configuration String Format",
                          "Format of the configuration string to be used by driver", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(4, "bus_type", "Bus Type", "", base_attributes_top + [
            ] + base_attributes_bottom)

        self.addEntityClass(5, "device", "Device", "", base_attributes_top + [
            makeAttribute("addr", "Address", "Address of the Device at the Bus", self.TYPE_STRING, ""),
            makeAttribute("init_str", "Initialize String", "String to initialize the Device by the driver", self.TYPE_STRING, ""),
            makeAttribute("sequence_number", "Sequence Number", "Sequence number for sorting devices during export", self.TYPE_INTEGER, ""),
            makeAttribute("bigc_info", "Big Channel Info", "Big channel information [should be temporal]", self.TYPE_TEXT, ""),
            makeAttribute("main_info", "Main Info", "Main information", self.TYPE_STRING, "No main info"),

            ] + base_attributes_bottom)

        self.addEntityClass(6, "device_channel", "Device Channel", "", base_attributes_top + [
            makeAttribute("group_num", "Group Number", "Address of Channel group at Device channel groups (by its Device Type)",
                          self.TYPE_INTEGER, ""),
            makeAttribute("needs_init", "Needs Initialization", "Is the initialization required by the channel or not", self.TYPE_INTEGER, ""),
            makeAttribute("init_value", "Initialization Value", "The Value to be used if initialization is needed", self.TYPE_TEXT, ""),
            ] + base_attributes_bottom)


        self.addEntityClass(7, "device_channel_group", "Device Channel Group", "", base_attributes_top + [
            makeAttribute("is_writable", "Writable", "If channels of the group is writable", self.TYPE_INTEGER, ""),
            makeAttribute("quantity", "Quantity", "The number of channels in the group", self.TYPE_INTEGER, ""),
            makeAttribute("group_number", "Group Number", "The priority for group sorting", self.TYPE_INTEGER, ""),
            ] + base_attributes_bottom)

#        self.addEntityClass(8, "device_type", "Device Type", "", base_attributes_top + [
#            makeAttribute("bigc_info", "Big Channel Info", "Big channel information [should be temporal]", self.TYPE_TEXT, ""),
#            ] + base_attributes_bottom)

        self.addEntityClass(9, "server", "Server", "", base_attributes_top + [
            ] + base_attributes_bottom)

        self.addEntityClass(10, "layer_info", "Layer Info", "", base_attributes_top + [
            makeAttribute("info", "Info", "Information of the layer", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        
	    ############ EDGES #############
        # addRelationClass(cid, name, readable_name, description, attributes_list, allowed_relations)
        self.addRelationClass(101, "physical", "Physical", "Physical connections", [
            # makeAttribute("cable_length", "Cable length", "Relation attribute example", self.TYPE_STRING, ""),
            ], [
            makeAllowedRelation(
                {"cname":"server", "multiplicity" : self.MUL_ONE},
                {"cname":"bus_controller", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"bus_controller", "multiplicity" : self.MUL_ONE},
                {"cname":"bus", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
#            makeAllowedRelation(
#                {"cname":"bus", "multiplicity" : self.MUL_ONE},
#                {"cname":"bus_device", "multiplicity" : self.MUL_ZERO_OR_MORE}
#            ),
            ])

        self.addRelationClass(102, "type", "Types", "Typification links", [
        ], [
            makeAllowedRelation(
                {"cname":"bus", "multiplicity" : self.MUL_ONE},
                {"cname":"bus_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"bus_controller", "multiplicity" : self.MUL_ONE},
                {"cname":"bus_controller_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            ])


        self.addRelationClass(103, "logical", "Logical", " Logical links", [
        ], [
            makeAllowedRelation(
                {"cname":"device", "multiplicity" : self.MUL_ONE},
                {"cname":"device_channel", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"server", "multiplicity" : self.MUL_ONE},
                {"cname":"layer_info", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"device", "multiplicity" : self.MUL_ONE},
                {"cname":"device_channel_group", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            ])

        self.addRelationClass(104, "responsibilities", "Responsibilities", "Responsibilities", [
        ], [
            # Dev-Connection-Dev
            makeAllowedRelation(
                {"cname":"server", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"device", "multiplicity" : self.MUL_ONE}
            ),

            ])
Exemplo n.º 5
0
    def __init__(self):
        Configuration.__init__(self)

        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name",
                          "For rapid people understanding", self.TYPE_STRING,
                          ""),
            makeAttribute("name", "Unique API Name",
                          "For automated scripts, should be permanent",
                          self.TYPE_STRING, ""),
        ]
        base_attributes_bottom = [
            makeAttribute("description", "Description",
                          "For people some additional information",
                          self.TYPE_TEXT, ""),
        ]

        # addEntityClass(cid, name, readable_name, description, attributes_list)
        # basic type classes
        self.addEntityClass(1, "object_type", "Object type", "",
                            base_attributes_top + base_attributes_bottom)

        self.addEntityClass(2, "pin_type", "Pin type", "",
                            base_attributes_top + base_attributes_bottom)

        self.addEntityClass(
            3, "socket_type", "Socket type", "", base_attributes_top + [
                makeAttribute("direction", "Links direction",
                              "in or out or none", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(4, "link_type", "Link type", "",
                            base_attributes_top + base_attributes_bottom)

        # templates
        self.addEntityClass(5, "template", "Template", "",
                            base_attributes_top + base_attributes_bottom)

        self.addEntityClass(6, "template_socket", "Template Socket", "",
                            base_attributes_top + [] + base_attributes_bottom)

        # instances
        self.addEntityClass(7, "object", "Object", "",
                            base_attributes_top + base_attributes_bottom)

        self.addEntityClass(8, "pin", "Pin", "",
                            base_attributes_top + base_attributes_bottom)

        self.addEntityClass(9, "socket", "Socket", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(10, "link", "Link", "",
                            base_attributes_top + [] + base_attributes_bottom)

        # view attributes
        self.addEntityClass(11, "view", "View", "",
                            base_attributes_top + [] + base_attributes_bottom)

        self.addEntityClass(
            12, "coords", "Coordinates", "", base_attributes_top + [
                makeAttribute("x", "x", "X coordinate on view",
                              self.TYPE_DOUBLE, ""),
                makeAttribute("y", "y", "Y coordinate on view",
                              self.TYPE_DOUBLE, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(
            13, "display_attrs", "Display Attributes", "",
            base_attributes_top + [
                makeAttribute("shape", "Shape",
                              "Circle, Square or something else",
                              self.TYPE_STRING, ""),
                makeAttribute("color", "Color", "#ffffff", self.TYPE_STRING,
                              ""),
                makeAttribute("size", "Size", "Should be > 0",
                              self.TYPE_INTEGER, ""),
                makeAttribute("image", "Image", "Should be an url",
                              self.TYPE_STRING, ""),
                makeAttribute("scale", "Scale", "Should be > 0",
                              self.TYPE_DOUBLE, ""),
            ] + base_attributes_bottom)

        # tag class
        self.addEntityClass(149, "tag", "tag", "", base_attributes_top + [])

        ############ EDGES #############
        self.addRelationClass(102, "instanceof", "Instance of",
                              "Instance of type", [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "template",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "object_type",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "object",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "template",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "pin",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "pin_type",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "template_socket",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "socket_type",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "socket",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "template_socket",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "link",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "link_type",
                                          "multiplicity": self.MUL_ONE
                                      }),
                              ])

        self.addRelationClass(103, "composition", "Composition",
                              "Composition links", [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "object_type",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "pin",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "socket_type",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "pin_type",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "template_socket",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "pin",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "template",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "template_socket",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "object",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "socket",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                              ])

        self.addRelationClass(104, "attributes", "Attributes",
                              "Additional attribute instance", [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "object",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "coords",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "template_socket",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "coords",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "socket_type",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "display_attrs",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "template",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "display_attrs",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                              ])

        self.addRelationClass(105, "logical", "Logical", "Logical connections",
                              base_attributes_top + [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "coords",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "view",
                                          "multiplicity": self.MUL_ONE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "display_attrs",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "view",
                                          "multiplicity": self.MUL_ONE
                                      }),
                              ])

        self.addRelationClass(106, "connectable", "Connectable",
                              "Connection is allowed",
                              base_attributes_top + [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "pin_type",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }, {
                                          "cname": "pin_type",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                              ])

        self.addRelationClass(107, "from_link", "From Link",
                              "Link connection: from_socket",
                              base_attributes_top + [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "link_type",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "socket_type",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "link",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "socket",
                                          "multiplicity": self.MUL_ZERO_OR_ONE
                                      }),
                              ])

        self.addRelationClass(108, "to_link", "To Link",
                              "Link connection: to_socket",
                              base_attributes_top + [], [
                                  makeAllowedRelation(
                                      {
                                          "cname": "link_type",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "socket_type",
                                          "multiplicity": self.MUL_ZERO_OR_MORE
                                      }),
                                  makeAllowedRelation(
                                      {
                                          "cname": "link",
                                          "multiplicity": self.MUL_ONE
                                      }, {
                                          "cname": "socket",
                                          "multiplicity": self.MUL_ZERO_OR_ONE
                                      }),
                              ])

        self.addRelationClass(1149, "tag_link", "tag_link", "Tag link", [], [
            makeAllowedRelation(
                {
                    "cname": "object",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }, {
                    "cname": "tag",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }),
        ])
Exemplo n.º 6
0
    def __init__(self):
        Configuration.__init__(self)

        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name",
                          "For rapid people understanding", self.TYPE_STRING,
                          ""),
            makeAttribute("name", "Unique API Name",
                          "For automated scripts, should be permanent",
                          self.TYPE_STRING, ""),
        ]
        base_attributes_bottom = [
            makeAttribute(
                "note", "Note",
                "For people, for example, some errors history notes",
                self.TYPE_TEXT, ""),
        ]

        # addEntityClass(cid, name, readable_name, description, attributes_list)
        self.addEntityClass(
            1, "server", "Server", "", base_attributes_top + [
                makeAttribute("address", "IP or Domain Name", "",
                              self.TYPE_STRING, "0.0.0.0"),
            ] + base_attributes_bottom)

        self.addEntityClass(
            2, "ioc", "IOC", "", base_attributes_top + [
                makeAttribute("template", "Template",
                              "Template file for generating IOC's config",
                              self.TYPE_STRING, "ioc.tmpl"),
            ] + base_attributes_bottom)

        self.addEntityClass(
            3, "device", "Device", "", base_attributes_top + [
                makeAttribute("params", "Parameters",
                              "A set of device parameters",
                              self.TYPE_DICTIONARY, {}),
            ] + base_attributes_bottom)

        self.addEntityClass(
            4, "device_type", "Device Type", "", base_attributes_top + [
                makeAttribute("params", "Parameters",
                              "A set of device type parameters",
                              self.TYPE_DICTIONARY, {"PSy": "BR"}),
                makeAttribute(
                    "template", "Template",
                    "Template dir name to use for generating IOC's config",
                    self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(
            5, "channel", "Channel", "", base_attributes_top + [
                makeAttribute("default_value", "Default Value",
                              "Default value of the channel", self.TYPE_DOUBLE,
                              0.0),
            ] + base_attributes_bottom)

        self.addEntityClass(6, "link", "Link", "",
                            base_attributes_top + [] + base_attributes_bottom)

        # Tiny class without base attributes
        self.addEntityClass(7, "connection", "Connection", "", [])

        self.addEntityClass(8, "connection_type", "Connection Type", "",
                            base_attributes_top + [] + base_attributes_bottom)

        # Tiny class without base attributes
        self.addEntityClass(9, "connection_type_part", "Connection Type Part",
                            "", [])

        self.addEntityClass(
            10, "channel_type", "Channel Type", "", base_attributes_top + [
                makeAttribute("type", "Type", "Type of the Channel",
                              self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        ############ EDGES #############
        # addRelationClass(cid, name, readable_name, description, attributes_list, allowed_relations)
        #self.addRelationClass(101, "physical", "Physical", "Physical connections", [
        #    ], [
        #    makeAllowedRelation(
        #        {"cname":"server", "multiplicity" : self.MUL_ONE},
        #        {"cname":"ioc", "multiplicity" : self.MUL_ZERO_OR_MORE}
        #    ),
        #    makeAllowedRelation(
        #        {"cname":"ioc", "multiplicity" : self.MUL_ONE},
        #        {"cname":"device", "multiplicity" : self.MUL_ZERO_OR_MORE}
        #    ),
        #    ])

        self.addRelationClass(102, "type", "Types", "Typification links", [], [
            makeAllowedRelation(
                {
                    "cname": "device",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }, {
                    "cname": "device_type",
                    "multiplicity": self.MUL_ONE
                }),
            makeAllowedRelation(
                {
                    "cname": "connection",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }, {
                    "cname": "connection_type",
                    "multiplicity": self.MUL_ONE
                }),
            makeAllowedRelation(
                {
                    "cname": "channel",
                    "multiplicity": self.MUL_ZERO_OR_MORE
                }, {
                    "cname": "channel_type",
                    "multiplicity": self.MUL_ONE
                }),
        ])

        self.addRelationClass(
            103,
            "composition",
            "Compositions",
            "Compositions links",
            [],
            [
                makeAllowedRelation(
                    {
                        "cname": "device_type",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "link",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "device_type",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "channel",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                # ConnectionT-ConnectionTP
                makeAllowedRelation(
                    {
                        "cname": "connection_type",
                        "multiplicity": self.MUL_ZERO_OR_ONE
                    }, {
                        "cname": "connection_type_part",
                        "multiplicity": self.MUL_ONE
                    }),
            ])

        self.addRelationClass(
            104,
            "logical",
            "Logical",
            "Logical connections",
            [],
            [
                makeAllowedRelation(
                    {
                        "cname": "server",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "ioc",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "ioc",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "device",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),

                # Dev-Connection-Dev
                makeAllowedRelation(
                    {
                        "cname": "device",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "connection",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "connection",
                        "multiplicity": self.MUL_ZERO_OR_ONE
                    }, {
                        "cname": "device",
                        "multiplicity": self.MUL_ONE
                    }),

                # DevT-ConnectionT-DevT
                makeAllowedRelation(
                    {
                        "cname": "device_type",
                        "multiplicity": self.MUL_ONE
                    }, {
                        "cname": "connection_type",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "connection_type",
                        "multiplicity": self.MUL_ZERO_OR_ONE
                    }, {
                        "cname": "device_type",
                        "multiplicity": self.MUL_ONE
                    }),

                # TODO: make it     L -> CTP -> Ch
                # Link-ConnectionTP-channel
                makeAllowedRelation(
                    {
                        "cname": "connection_type_part",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }, {
                        "cname": "link",
                        "multiplicity": self.MUL_ONE
                    }),
                makeAllowedRelation(
                    {
                        "cname": "connection_type_part",
                        "multiplicity": self.MUL_ZERO_OR_MORE
                    }, {
                        "cname": "channel",
                        "multiplicity": self.MUL_ONE
                    }),
            ])
Exemplo n.º 7
0
    def __init__(self):
        Configuration.__init__(self)





        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name", "For rapid people understanding", self.TYPE_STRING, ""),
            makeAttribute("name", "Unique API Name", "For automated scripts, should be permanent", self.TYPE_STRING, ""),
            ]
        base_attributes_bottom = [
            makeAttribute("note", "Note", "For people, for example, some errors history notes", self.TYPE_TEXT, ""),
            ]

        # addEntityClass(cid, name, readable_name, description, attributes_list)
        self.addEntityClass(1, "server", "Server", "", base_attributes_top + [
            makeAttribute("address", "IP or Domain Name", "", self.TYPE_STRING, "0.0.0.0"),
            ] + base_attributes_bottom)

        self.addEntityClass(2, "ioc", "IOC", "", base_attributes_top + [
            makeAttribute("template", "Template", "Template file for generating IOC's config", self.TYPE_STRING, "ioc.tmpl"),
            ] + base_attributes_bottom)

        self.addEntityClass(3, "device", "Device", "", base_attributes_top + [
            makeAttribute("params", "Parameters", "A set of device parameters", self.TYPE_DICTIONARY, {}),
            ] + base_attributes_bottom)

        self.addEntityClass(4, "device_type", "Device Type", "", base_attributes_top + [
            makeAttribute("params", "Parameters", "A set of device type parameters", self.TYPE_DICTIONARY, {"PSy" : "BR"}),
            makeAttribute("template", "Template", "Template dir name to use for generating IOC's config", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(5, "channel", "Channel", "", base_attributes_top + [
            makeAttribute("default_value", "Default Value", "Default value of the channel", self.TYPE_DOUBLE, 0.0),
            ] + base_attributes_bottom)

        self.addEntityClass(6, "link", "Link", "", base_attributes_top + [
            ] + base_attributes_bottom)

        # Tiny class without base attributes
        self.addEntityClass(7, "connection", "Connection", "", [])

        self.addEntityClass(8, "connection_type", "Connection Type", "", base_attributes_top + [
            ] + base_attributes_bottom)

        # Tiny class without base attributes
        self.addEntityClass(9, "connection_type_part", "Connection Type Part", "", [])

        self.addEntityClass(10, "channel_type", "Channel Type", "", base_attributes_top + [
            makeAttribute("type", "Type", "Type of the Channel", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)




        ############ EDGES #############
        # addRelationClass(cid, name, readable_name, description, attributes_list, allowed_relations)
        #self.addRelationClass(101, "physical", "Physical", "Physical connections", [
        #    ], [
        #    makeAllowedRelation(
        #        {"cname":"server", "multiplicity" : self.MUL_ONE},
        #        {"cname":"ioc", "multiplicity" : self.MUL_ZERO_OR_MORE}
        #    ),
        #    makeAllowedRelation(
        #        {"cname":"ioc", "multiplicity" : self.MUL_ONE},
        #        {"cname":"device", "multiplicity" : self.MUL_ZERO_OR_MORE}
        #    ),
        #    ])

        self.addRelationClass(102, "type", "Types", "Typification links", [
        ], [
            makeAllowedRelation(
                {"cname":"device", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"device_type", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"connection", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"connection_type", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"channel", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"channel_type", "multiplicity" : self.MUL_ONE}
            ),
            ])

        self.addRelationClass(103, "composition", "Compositions", "Compositions links", [
        ], [
            makeAllowedRelation(
                {"cname":"device_type", "multiplicity" : self.MUL_ONE},
                {"cname":"link", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"device_type", "multiplicity" : self.MUL_ONE},
                {"cname":"channel", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            # ConnectionT-ConnectionTP
            makeAllowedRelation(
                {"cname":"connection_type", "multiplicity" : self.MUL_ZERO_OR_ONE},
                {"cname":"connection_type_part", "multiplicity" : self.MUL_ONE}
            ),
            ])

        self.addRelationClass(104, "logical", "Logical", "Logical connections", [
        ], [
            makeAllowedRelation(
                {"cname":"server", "multiplicity" : self.MUL_ONE},
                {"cname":"ioc", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"ioc", "multiplicity" : self.MUL_ONE},
                {"cname":"device", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),

            # Dev-Connection-Dev
            makeAllowedRelation(
                {"cname":"device", "multiplicity" : self.MUL_ONE},
                {"cname":"connection", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"connection", "multiplicity" : self.MUL_ZERO_OR_ONE},
                {"cname":"device", "multiplicity" : self.MUL_ONE}
            ),

            # DevT-ConnectionT-DevT
            makeAllowedRelation(
                {"cname":"device_type", "multiplicity" : self.MUL_ONE},
                {"cname":"connection_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"connection_type", "multiplicity" : self.MUL_ZERO_OR_ONE},
                {"cname":"device_type", "multiplicity" : self.MUL_ONE}
            ),

            # TODO: make it     L -> CTP -> Ch
            # Link-ConnectionTP-channel
            makeAllowedRelation(
                {"cname":"connection_type_part", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"link", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"connection_type_part", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"channel", "multiplicity" : self.MUL_ONE}
            ),
            ])
Exemplo n.º 8
0
    def __init__(self):
        Configuration.__init__(self)

        ############ NODES #############
        base_attributes_top = [
            makeAttribute("readable_name", "Readable Name", "For rapid people understanding", self.TYPE_STRING, ""),
            makeAttribute("name", "Unique API Name", "For automated scripts, should be permanent", self.TYPE_STRING, ""),
            ]
        base_attributes_bottom = [
            makeAttribute("description", "Description", "For people some additional information", self.TYPE_TEXT, ""),
            ]

        # addEntityClass(cid, name, readable_name, description, attributes_list)
        # basic type classes
        self.addEntityClass(1, "object_type", "Object type", "", base_attributes_top + base_attributes_bottom)

        self.addEntityClass(2, "pin_type", "Pin type", "", base_attributes_top + base_attributes_bottom)

        self.addEntityClass(3, "socket_type", "Socket type", "", base_attributes_top + [
                makeAttribute("direction", "Links direction", "in or out or none", self.TYPE_STRING, ""),
            ] + base_attributes_bottom)

        self.addEntityClass(4, "link_type", "Link type", "", base_attributes_top + base_attributes_bottom)

        # templates
        self.addEntityClass(5, "template", "Template", "", base_attributes_top + base_attributes_bottom)

        self.addEntityClass(6, "template_socket", "Template Socket", "", base_attributes_top + [
            ] + base_attributes_bottom)
        
        # instances
        self.addEntityClass(7, "object", "Object", "", base_attributes_top + base_attributes_bottom)

        self.addEntityClass(8, "pin", "Pin", "", base_attributes_top + base_attributes_bottom)

        self.addEntityClass(9, "socket", "Socket", "",  base_attributes_top + [
            ] + base_attributes_bottom)
        
        self.addEntityClass(10, "link", "Link", "",  base_attributes_top + [
            ] + base_attributes_bottom)
        
        # view attributes
        self.addEntityClass(11, "view", "View", "",  base_attributes_top + [
            ] + base_attributes_bottom)
        
        self.addEntityClass(12, "coords", "Coordinates", "",  base_attributes_top + [
                makeAttribute("x", "x", "X coordinate on view", self.TYPE_DOUBLE, ""),
                makeAttribute("y", "y", "Y coordinate on view", self.TYPE_DOUBLE, ""),
            ] + base_attributes_bottom)
        
        self.addEntityClass(13, "display_attrs", "Display Attributes", "",  base_attributes_top + [
                makeAttribute("shape", "Shape", "Circle, Square or something else", self.TYPE_STRING, ""),
                makeAttribute("color", "Color", "#ffffff", self.TYPE_STRING, ""),
                makeAttribute("size", "Size", "Should be > 0", self.TYPE_INTEGER, ""),
                makeAttribute("image", "Image", "Should be an url", self.TYPE_STRING, ""),
                makeAttribute("scale", "Scale", "Should be > 0", self.TYPE_DOUBLE, ""),
            ] + base_attributes_bottom)
        
        # tag class
        self.addEntityClass(149, "tag", "tag", "",   base_attributes_top + [
            ])

        ############ EDGES #############
        self.addRelationClass(102, "instanceof", "Instance of", "Instance of type", [
        ], [
            makeAllowedRelation(
                {"cname":"template", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"object_type", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"object", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"template", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"pin", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"pin_type", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"template_socket", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"socket_type", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"socket", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"template_socket", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"link", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"link_type", "multiplicity" : self.MUL_ONE}
            ),
            ])

        self.addRelationClass(103, "composition", "Composition", "Composition links", [
        ], [
            makeAllowedRelation(
                {"cname":"object_type", "multiplicity" : self.MUL_ONE},
                {"cname":"pin", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"socket_type", "multiplicity" : self.MUL_ONE},
                {"cname":"pin_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"template_socket", "multiplicity" : self.MUL_ONE},
                {"cname":"pin", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"template", "multiplicity" : self.MUL_ONE},
                {"cname":"template_socket", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"object", "multiplicity" : self.MUL_ONE},
                {"cname":"socket", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            ])

        self.addRelationClass(104, "attributes", "Attributes", "Additional attribute instance", [
        ], [
            makeAllowedRelation(
                {"cname":"object", "multiplicity" : self.MUL_ONE},
                {"cname":"coords", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"template_socket", "multiplicity" : self.MUL_ONE},
                {"cname":"coords", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"socket_type", "multiplicity" : self.MUL_ONE},
                {"cname":"display_attrs", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"template", "multiplicity" : self.MUL_ONE},
                {"cname":"display_attrs", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
        ])
        
        self.addRelationClass(105, "logical", "Logical", "Logical connections", base_attributes_top+[
        ], [
            makeAllowedRelation(
                {"cname":"coords", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"view", "multiplicity" : self.MUL_ONE}
            ),
            makeAllowedRelation(
                {"cname":"display_attrs", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"view", "multiplicity" : self.MUL_ONE}
            ),
       ])
        
        self.addRelationClass(106, "connectable", "Connectable", "Connection is allowed", base_attributes_top+[
        ], [
            makeAllowedRelation(
                {"cname":"pin_type", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"pin_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
       ])
        
        self.addRelationClass(107, "from_link", "From Link", "Link connection: from_socket", base_attributes_top+[
        ], [
            makeAllowedRelation(
                {"cname":"link_type", "multiplicity" : self.MUL_ONE},
                {"cname":"socket_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"link", "multiplicity" : self.MUL_ONE},
                {"cname":"socket", "multiplicity" : self.MUL_ZERO_OR_ONE}
            ),
       ])
        
        self.addRelationClass(108, "to_link", "To Link", "Link connection: to_socket", base_attributes_top+[
        ], [
            makeAllowedRelation(
                {"cname":"link_type", "multiplicity" : self.MUL_ONE},
                {"cname":"socket_type", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
            makeAllowedRelation(
                {"cname":"link", "multiplicity" : self.MUL_ONE},
                {"cname":"socket", "multiplicity" : self.MUL_ZERO_OR_ONE}
            ),
       ])
        
        self.addRelationClass(1149, "tag_link", "tag_link", "Tag link", [
        ], [
            makeAllowedRelation(
                {"cname":"object", "multiplicity" : self.MUL_ZERO_OR_MORE},
                {"cname":"tag", "multiplicity" : self.MUL_ZERO_OR_MORE}
            ),
        ])