Equations are snippets of procedural code that provide instructions for computing an output from a set of inputs. These functions can be very important in modeling a domain. For example, many reasoners allow rules to have built-in functions to handle math operations, and without the ability to do math operations it may not be possible to construct a useful model.
The SADL grammar supports two kinds of equations, one in which the body of the function (the set of instructions for computing) is defined in the SADL statement, and another where the body of the function exists somewhere outside of the ontology. The first kind uses the Equation keyword.
Equation areaOfCircle (float radius) returns float: PI*radius^2 .
Equation volumeOfCylinder (float radius, float height) returns float: areaOfCircle(radius) * height.
As the example illustrates, one Equation may use another in its body. Here the volumeOfCircle Equation uses areaOfCircle in its body.
The second kind of equation uses the External keyword. This kind of equation needs a means of specifying where, outside of the ontology, the complete specification may be found. Consistent with W3C identity by URI, the instance of External is given an externalURI identity. It may also have an optional location to help code using the External to find it.
located at "java.lang.Math.abs".
The named functions declared with either the Equation or External keyword can be used in expressions in SADL or derivative grammars. Using the functions to do actual computation is a task for the reasoner or other related processors.
A list differs from a set in that the members of a list are in a specified order and there can be duplicate members. From a modeling perspective, this is a big difference. It is typical in many modeling languages to represent a list using a construct with two pointers: the first points to the current member of the list and the second points to a list which is the rest of the list. A typed list has further constraints to specify that members of the list must also be members of a specified class.
OWL does not have a standardized mechanism for typed lists. OWL builds on RDF which does have a list construct but an RDF list is not typed and, because of the way it is constructed, it’s use makes reasoning over a model theoretically undecidable. Because of the significant importance of lists in modeling many real-world domains, SADL provides a typed list construct defined in SadlListModel.owl, which is automatically added to the OwlModels folder of a project and automatically imported into any .sadl file (and its corresponding OWL file) that uses a typed list. The basic construct in SadlListModel.owl, in SADL syntax is:
uri "http://sadl.org/sadllistmodel" alias sadllist.
^List is a class
described by ^first,
described by rest with values of type ^List,
described by lengthRestriction with values of type int,
described by maxLengthRestriction with values of type int.
A typed list is created in a SADL ontology by referencing the type followed by the keyword List. (In the sadllist model above, the caret (^) in front of List tells the editor that this is not the SADL grammar keyword List but a user-defined concept named List.) Note that the property ^first is an RDF properties, as indicated by the more florescent green color, so that the members of the list can either be instances or data types. Since first is also a keyword in the SADL grammar it must be preceded by a caret. Below are two typed list declarations, the first with members from the Person class and the second a list of XSD strings.
In a SADL model using a list construct, the type list definition creates a subclass of sadllist:List with some additional restrictions.
· first can only have values of the specified type, e.g., Person or string in the above examples.
· rest can only have values of which belong to the class being defined, e.g., Person List or string List
Note that the other properties in the sadllist model (lengthRestriction, minLengthRestriction, maxLengthRestriction) are used to constrain the length of lists belonging to the defined sadllist:List subclass. These can only be added to named lists. For example,
ChildrenList is a type of Person List length 1-*.
creates a subclass of sadllist:List named ChildrenList and whose members can only be instances of Person and which must contain at least one element but can contain any number larger number of elements.
It is also possible to create declared instances of a typed list class. For example,
John is a Person. Sue is a Person. Craig is a Person.
JoesChildren is the ChildrenList [John, Sue, Craig].
creates an instance of ChildrenList with ordered members John, Sue, and Craig.
This part of the documentation does not address when and how one might use Lists. There are a number of list expressions which can be used where expressions are allowed, e.g., in Equations or in Rules. As an example, consider the following ontology snippet.
See also Implied Properties.
It is often the case in natural language that we leave out information that can easily be inferred by the recipient of the communication. For example, we might say “Sue is 23.” or “Joe is at least 250.” What we mean by these statements can probably correctly be inferred to be “Sue has age 23 years.” “The weight of Joe >= 250 lbs.” (See Unitted Quantities below.)
SADL tries to allow similar incompleteness as in these English examples, as long as it is not ambiguous, by supporting the concept of an implied property. Implied properties are defined in terms of a specific class using the impliedProperty annotation property defined in the SadlImplicitModel.
impliedProperty is a type of annotation.
This statement creates impliedProperty as an instance of owl:AnnotationProperty. Note that annotation properties in SADL are green but not bold.
Suppose that we created the following model.
The “i” to the left of line 9 is an information marker which, when moused over, displays the information
“Implied property 'age' used (left side of 'is') to pass type check”.
Whenever implied properties are applied in SADL to resolve type checking, an information marker is created to make the behavior more transparent to the user.
There are some limitations to the the use of implied properties in type checking. There must be no ambiguity. For example, if both age and weight were defined to be implied properties of Person, both with a numeric range, it would not be possible to know which implied property to apply in the example above so the expression would be ambiguous. This would therefore create an error.
Expanded properties are another application of implied properties, this time to the case of expanding both sides of a comparison or assignment statement. Instead of comparing or assigning the individual(s) matching the left and right hand sides of the statement, the statement is expanded to a set of statements adding the "expandedProperty" implied properties of the class being compared to the left and right side property chains. See Expanded Properties.
Suppose that we have a domain model defining age and weight as examples of data type properties.
Person is a class described by age with values of type decimal,
described by weight with values of type decimal.
We could use these properties in instance data statements like
George is a Person with age 23, with weight 165.
Jim is a Person with age 2, with weight 9.5.
The problem of course is that many numerical values require a specification of the unit in order to be unambiguous. These statements might more precisely be expressed as
George is a Person with age 23 years, with weight 165 lbs.
Jim is a Person with age 2 days, with weight 9.5 lbs.
The SADL grammar supports placing a unit designation after a numeric value in such statements. If the unit has spaces, e.g., “feet per second”, it must be placed in quotes.
The translation of such SADL statements to OWL depends upon a SADL preference setting. If the preference “Ignore Unitted Quantities (treat as numeric only) during translation” is checked, the translation will happen as if the units were not present.
If this preference is not checked, the definition of UnittedQuantity from the SadlImplicitModel.sadl is used. The basic unit model is
UnittedQuantity is a class,
described by ^value with values of type decimal,
described by unit with values of type string.
The translation to OWL is made as if the SADL statements were
George is a Person
with age (a UnittedQuantity with ^value 23, with unit "years"),
with weight (a UnittedQuantity with ^value 165, with unit "lbs").
Jim is a Person
with age (a UnittedQuantity with ^value 2, with unit "days"),
with weight (a UnittedQuantity with ^value 9.5, with unit "lbs").
SADL 3 supports the inclusion of imported models that are not in the current project in two ways.
To make a SADL project reference another project in the Eclipse environment:
To make an external OWL file available for import in a SADL project:
This will create a ".url" file if it doesn't exist and open it in the External URL editor. If it does already exist it can be opened directly from the Project Explorer. Once the ".url" file is open: