Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 13: Petri Nets > 13.1 Data Definition Language for Petri Nets - Pg. 251

242 CHAPTER 13: PETRI NETS 13.1 Data Definition Language for Petri Nets Tables modeling Petri nets are simple. Because the tokens are entities, they get their own table. The graph is a relationship, so it is in a second table. Here is the initial code. CREATE TABLE Petri_Places (place_name CHAR(5)NOT NULL PRIMARY KEY, place_token SMALLINT DEFAULT 0 NOT NULL, CHECK (place_token IN (0, 1)) CREATE TABLE Petri_Transitions (transition_name CHAR(3) NOT NULL, input_place_name CHAR(5) NOT NULL REFERENCES Petri_Places (place_name), output_place_name CHAR(5) NOT NULL REFERENCES Petri_Places (place_name), PRIMARY KEY (transition_name, input_place_name, output_place_name)); Looking at the simple traffic light example, we can load the tables, thus: