Naming policy

Places, transitions, and pages in CP-nets have names. These names are (possibly empty) strings of characters. Names are simply labels that are used to identify objects. Names do not influence the semantics of CP-nets, and, in general, names of these kinds of objects do not have to be unique. However when using the state space tool, there are a number of syntax restrictions for names.

Monitors also have names. These names are non-empty strings of characters. The names of monitors are used to identify the monitors, they are used when generating code for the monitors, and they may be used for other purposes, such as for file names. There are a number of syntax restrictions for monitor names.

In the following, we will differentiate between name inscriptions and ML names.

A name inscription is a user-defined text string, and it can contain any sequence of characters, including letters, numbers, punctuation, and white space. Name inscriptions are shown in the GUI, and they are saved when you Save a net. There are four kinds of name inscriptions: place name inscriptions, transition name inscriptions, page name inscriptions, and monitor name inscriptions. In the example below, there are 5 name inscriptions.

Three kinds of name inscriptions

Name inscriptions can be modified by adding/editing inscriptions, or by editing the text of a page name or monitor name in the index.

An ML name is a text string that is obtained from a name inscription according to a method described below. During syntax checking the GUI converts name inscriptions to ML names which are used in the simulator and state space tool. The ML names of the objects in the figure above are: “Top_page”, “p1”, “t1”, “place” and “trans”. An ML name is either an empty string or a CPN ML identifier. ML names must be CPN ML identifier because they are used as function and structure names when code is generated when you enter the state space tool.

Converting name inscriptions to ML Names

A name inscription is converted to an ML name using the following method:

  1. Take the longest (possibly empty) prefix of the name inscription that contains only letters, digits, white spaces, apostrophes ('), and underscores (_).
  2. Remove all white space at the beginning and end of the string obtained in step 1.
  3. If the string obtained in step 2. is empty or starts with something other than a letter, then the ML name is the empty string, otherwise continue with step 4.
  4. Replace all sequences of white spaces with a single underscore. The resulting string is the ML name.

Syntax restrictions on ML names

There are some syntax restrictions on names when you use state space tool and when monitoring a CP-net.

State Space Tool

The following criteria must be met in order to Enter the state space tool:

  • All pages must have unique ML names
  • All places on a page must have unique ML names. (Places on different pages may have the same ML name.)
  • All transitions on a page must have unique, non-empty ML names. (Transitions on different pages may have the same ML name.)

Note that a place and a transition on the same page may have the same ML name.

Monitors

The following criteria must be met when monitoring a CP-net:

  • All monitors must have unique, non-empty ML names
  • All pages associated with a monitor must have unique, non-empty ML names
  • All places on a given page that are associated with a monitor must have unique, non-empty ML names
  • All transitions on a given page that are associated with a monitor must have unique, non-empty ML names

Naming Conflicts

If two places or transitions have the same ML name, then there will be a dark red halo on one of the nodes indicating a naming conflict.

nameconflict.jpg

In this example, the ML name of the two places is “Send”. If the hyphen is removed from each of the name inscriptions, then the ML names of the places will be “Send_Msg” and “Send_Ack”.

Related Pages