Inferences in SHOE Ontologies
Ontologies don't just declare hierarchical categories and valid relationships. They may also declare things that may be inferred from existant claims. Let's say we wanted to add to our cs-dept-ontology the inference that if someone claims to be a member of an organization, and that organization is a suborganization of a second organization, then the person is also a member of that second organization. This would save people from claiming that they're both a member of a research group and its department, for example.
To do this, we should first lay this inference out in a logical format called a Horn Clause. A Horn clause consists of a head and a body, separated with a ":-". In the head and body are claims; the body can have more than one claim, joined with a "^", which means "and". Claims in a Horn clause usually contain variables, which are wildcards that can be matched against anything, so long as variables of the same name are matched to the same thing. Here's our inference in a Horn Clause (we'll put question marks in front of variables):
member(?org2,?person) :- member(?org1,?person) ^ subOrganizationOf(?org1,?org2)
This is read as: "?person is a member of ?org2 if ?person is a member of ?org1 and ?org1 is a suborganization of ?org2". In the cs-dept-ontology, this would be written as follows:
Note the 1 and 2 syntax, not the TO and FROM syntax. TO and FROM are only a convenience for SHOE authors to annotate their web page: the advantage of TO and FROM over 1, 2, 3, ... etc. is that either TO or FROM may be omitted. Inside an inference, this is not permitted; if an inference uses TO or FROM in a binary relation(which it may, but it's bad style), both must be declared. It's strongly suggested to use the numeric syntax at all times for inferences.
As you might guess, you can also use categories in addition to rules. We can also include constant data, not just variables. We might say that if someone is an undergraduate student, and he is a member of the U Maryland CS Department, then his advisor is always Professor John Doe:
As you can see, constant data is differentiated from variables by omitting the "USAGE=VAR". In fact, you're free to describe constant data with "USAGE=CONST". However, CONST is the default assumption when the USAGE attribute is ommitted, so it's unneccessary. There are a variety of variable rules for valid inferences; you should check with the SHOE spec to make sure your inferences are correct.
Lastly, inferences contain a set of "special" comparisons that can only be used within the bounds of an inference. These special comparisons are used to compare variables with constants, and include "equal", "notEqual", "greaterThan", and "lessThan". For example, suppose we had a special "canEnter" relation, and wanted to say (for some reason) that if an person is over 18, that he may enter the university, but if his age is under 18, then he may not enter the university. We could say it as follows: