Outline
Instead of writing codes in a text field, composing axioms now involves identifying a template, making minor adjustments to its pattern, and filling in specific values. The first step usually requires the most effort as it often involves experimenting with several templates and value specifications before deciding the 'correct' one to use. We recommend the following strategy for template identification:
Try to express the thought about slot/frame relationships in a complete English sentence.
Use the property-based filter to eliminate unlikely templates and/or level-of-difficulty selection tool to hide more difficult templates (top left corner).
Once the list reduces to a manageable size (bottom left), read the examples (top right) and experiment by filling values into different templates (bottom right). The specified value for a template will not be lost if one switch to another template so one can always switch to another and then come back to continue work on a template.
Simple Example
We will first present a walkthrough for encoding a simple axiom with the tab. Suppose we want to express the idea 'every advertisement on the same page must be authored by a different salesperson' for the newspaper ontology that comes with every Protégé installation. In other words, we want to say 'Every instance of advertisement that shares the same value in slot page_number cannot share the same value in slot ad_salesperson. First, we examine the list of properties: We see this constraint fits the property description 'Values of a slot constrain other slot values for the same instances' perfectly since the constraining slot page_number and the constrained slot ad_salesperson both belong to the same instance. In addition, we see the the evaluation of the axiom must also involve cross-comparisons of instances for the class Advertisement, so the property 'Multiple constraining slots or multiple constrained slots' also applies. After selecting the two properties, we see there is only one template remaining. Experimenting with different values, we see that if we fill in Advertisement for the class box, and page_number and ad_salesperson for the remaining two boxes, the idea 'every instance of Advertisement that share a value in slot page_number cannot share a value in slot ad_salesperson ' is exactly what we want to express! Finally, clicking on the now-enabled 'translate' button should produce a dialog box. Assign an arbitrary name, and we will have just created a template-based axiom. To evaluate the axiom, switch to PAL-Constraint Tab and click '+.' The new axiom should show as an instance of EZPal-Constraint, and can be evaluated in the same way as a non-template axiom.
[Please click the picture for full view]
Properties and Level of Difficulty Selection Tools
The property template-filter can greatly reduce the search space if used correctly. The tools modulates the size of the template list in display by showing only those that satisfy all the selected properties on the top panel. Therefore, by choosing 'multiple constraining slots or multiple constrained slots,' the list now displays only those templates that can generate a pattern that involves more than one slot with values constrained by the statement, and those with more than one slot reference in the 'if' clause of the constraining statement. Checking another slot will further trim the list as not all templates listed will satisfy another property.

A condition constrains values of a slot for all instances of one class - applies when the constraint needs to apply a comparison across values of the same slot for instances of the same class e.g. slot ___ must contain a unique value.
Value(s) of a slot constrain slot values for related instances - applies when a slot value for one class restricts value for another slot that belongs to a different but related class e.g. If instance I1 of class ___ contains another instance I2 of class ___ in slot ___, then I2 must contain value ___ in its slot ___.
Value(s) of a slot constrain other slot values for the same instances - applies when a slot value of one instance restricts the slot value of another slot for the same instance e.g. For every instance, slot ___ and slot ___ cannot contain the same value.
Multiple constraining slots or multiple constrained slots - applies when the conditions needed to invoke a particular constraint and/or there are more than one slot whose value needs constraints e.g. For every instance of class ___ whose slot ___ contains value ___, slot ___ must contain value ___ and slot ___ must contain value ___.
The level of difficulty selection tool gives users the ability to 'hide' more complicated templates by selecting 'novice mode', whereas 'expert mode' shows every viewable templates that satisfy the Property Filter mechanism.
Template Value Specification
There are 3 major types of values one needs to specify: class, slot, and (slot) value.
Class: A class value is the most commonly countered type one needs to specify. By clicking on the 'Class' button one can choose any class within the scope of classes visible to user’s project.
Slot: A slot type allows one to specify the name of the slot for a class type. Because of this association, the slot-button is disabled until the related class is specified.
Value: A value allows one to specify a constraint/condition for the value of a slot. Likewise, one needs to specify the associated slot before one can enter the value; the value entry section will adjust automatically with respect to the value-type of the chosen slot.
Consider the following example where we sequentially enter the information:
A screenshot showing parts of a template with no value filled in for the class, slot, and value information. Note that the slot is tied to the class, and value tied to the slot information.
![]()
Once a class is chosen, the related slot button adjacent to the class information is enabled.
![]()
After selecting the salary slot of class Employee, the value space will automatically expand to the float-value entry form.
![]()
We would like to express the constraining clause 'Every instance of Employee whose slot 'salary' has value less than 10,000,000,000 (!).... Note that the value field expands with the size of the value entered.
![]()
Variations
There are several types of variations that allow one to fine-tune a template pattern. For example, one common requirement is the specification of more than one slot value condition in the constraining clause. Thus, some templates have built-in N-Variation mechanism that allows one to specify an arbitrary number of constraining clauses such as:

the clause now includes another condition for name-slot with value 'Smith.' More conditions can be produced by clicking on the 'More' button and 'Fewer' for the opposite effect. The 'and' pull-down menu implies that the condition requires both statements to be true, but choosing 'or' instead replaces the 'and' within the sentence with 'or.'
Other straightforward pull-down menus exist as part of the template, including options for choosing between 'every/ at least one,' 'is/is not,' etc, giving users more flexibility.
Translation
Once the user enters all the necessary information, the translate button at the bottom of the interface will be enabled. Clicking on the button produces an EZPal-Constraint (subclass of :PAL-Constraint) instance for the axiom, and the user will be able to name/evaluate the constraint just as for a normal PAL axiom.
Previously Encoded Axioms
A list of previously encoded axioms based on the template on display is shown above the 'fill-in-the-blanks' panel. Double-clicking the axioms will open the instance in another window for inspection. 'Deletion' Button allows users to delete the highlighted EZPal-axiom.
Intermediate Example
We will now attempt to encode the axiom shown on the introductory page for EZPal, 'every editor makes more money than those employees for whom he/she is responsible' for the newspaper example as shown in figure 1. Looking at the tables of properties, we see that 'values of a slot constrain slot values for related instances' describes our axioms, thus we check the option to reduce the size of the list. The list is still rather long, so we also check 'values of a slot constrains another slot of the same instance' since slot values of responsible_for slot (the employees) constrain the values of salary slot for the editor. After browsing through the examples, we see that 'If instance I1 of class ___ has instance I2 of class ___ in slot ___, then slot ___ of I1 has a value (>,=,<) to slot ___ of I2' fits our description very well. We fill in the corresponding classes into the template spaces, in our case I1–Editor and I2 – employee. Now the slot buttons should show up. The first slot space asks for the slot of I1(editor) in which I2(employee) may be found, so we choose responsible_for. For the remaining spaces, we fill in 'salary' for the values to be compared. Now we want the salary of I1(editor) to be greater than that of I2(employee), so click on the pull-down menu to select 'is greater than,' then we will have created the axiom we wanted from the template.
Template Design Techniques (for advanced users)
Adding to the current template library is not very difficult; the hard part is obtaining a preexisting PAL axiom which is a potential instance of the template one tries to make, and the English equivalent of the template. We model each template as a subclass of class 'Template,' and properties as instances of class 'Property.' The translation engine simply reads the 'Machine Readable Expression' value of a template class, then performs macro-expansions to form the template shown in the interface. Likewise, to instantiate an axiom the engine looks for the expression again to do another macro-expansion to form an axiom. Therefore, the major task in designing a new template involves substituting specific frame references with 'generalized frame variables,' to be illustrated with an example below.
Suppose we want to make a template which says:
Every instance of class ___ whose (slot ___ has value ___) must contain values in slot ___ that are instances of class ___.
We want to find an instance of the template. Since we already have an axiom that expresses:
If a student is tired, he is only involved in leisure activities, which translates to
PAL-RANGE:
PAL-STATEMENT:
Now we systematically replace the specific references with generalized variables. We replace a frame reference with
Student -> {Class A}
where A is an arbitrary variable name. We replace the associated slot reference with
activities -> {Slot A 0}
where A indicates that the slot is a slot of Class A. '0’ is a slot ID (must be numerical) needed in case more than one slot references needed for a particular slot.
For the variables in the source axiom, we may replace each variable reference with the generalized variables with ? attached to them. For example,
Since naming the instance variables can be somewhat arbitrary, we can also have
?activity -> ?{Class A}-SlotValue
The translation engine simply does a search and replace after one fills in the variables on the interface. Therefore, ?{Class A} will not be confused with ?{Class A}-SlotValue. Furthermore, one can attach any phrase one wants so the choice of what follows ?{Class A} (in this case –SlotValue) can be replaced with anything. If one adopts this alternate strategy, the generalized variable may be translated to ?student-SlotValue where as in the first case it may be translated to ?activities following the student/activities example.
One can then substitute parts of the source axiom where alterations may be needed with reserved phrases. For example, currently in the conditional statement the restricting clause is (is-tired ?student) which can be generalized to
(is-tired ?student) -> {Value A 1}
where {Value A 1} will allow substitution of any slot/slot value test phrases concerned with any slot /slot valueof instances of {Class A}, and the slot value may be of any type. This means that it is possible to use the translation engine to automatically generate other conditional clauses such as (> 20 (total-units ?student)). Note: We cannot use {Value A 0} in this case since {Slot A 0} already occupies the 0th slot. The more flexible version of the reserved phrase is {NVariation A 1} which allows one to generate any arbitrary number of conditional-test phrases. Since it also shares the same queue with {Slot} and {Value} phrases it is also subject to the ordering restriction (so 0 is not allowed because it is already reserved by slot A 0).
One can also replace the enumeration parts of the source-axiom with {Enumeration e0} to indicate that at least one/forall are both possible here. In this case, e0 is a name given to that particular instance of variation, and doesn’t have to be numerical. {Equality e1} can be used to indicate the choice of >,>=,=,<=,< if it cannot be captured by using {Value} or {NVariation} statements. Again, e1 can be anything. To indicate that a phrase may be true or false, one can use {Boolean b1} where b1 is yet another arbitrary name. Examples of each is shown below.
Note: One can see that ! could easily have been in place of {Boolean b1}
Now we can put the modified source-axiom into the slot named Axiom Translation, we first write the statement for PAL-RANGE, then use ^ before filling in the PAL-STATEMENT. For this example we get:
The second part of a template design involves generating the English statement on the interface. This can be done by substituting the original English sentence with the specific generalized variables one used for the Axiom Translation code. For example, to generate the template which expresses:
Every instance of class ___ whose (slot ___ has value ___)(N-Var) must have values in slot ___ that are instances of class ___.
With all the selectable variations on the interface, we can write:
Every instance of {Class A} whose {NVariation A 0} must have values in {Slot A 0} that are instances of {Class B}.
In the Machine-Readable Template Code slot. After choosing instances of Property, we for the Properties slot, and filling in an example for the Sample Usage slot, a new template will have been born!
Contact: Johnson Hou