University of Calgary
Rob Kremer
Individual Assignment 1: Ontology



CPSC 662/568: Agent Communication
(Formerly CPSC 601.68/599.68)
Fall 2012

Department of Computer Science
Computer
Science

Note: This is an individual assignment. You may brainstorm with other students, but the bulk of the work and the bulk of the ideas must be your own. That entails that you may not share a drawing by copy-and-paste or by any other means. If you do work with other students (or anybody else) you must cite that collaboration explicitly in your submitted assignment. This is good practice in any circumstances.

Your assignment is to create an ontology using CASA's ontology tool. You are to hand in a script file (pure text, Lisp code) named "assnOnt.lisp", which defines all the relations and assertions required.

To do the assignment, you will need to run a simple CASA agent and use its Command panel to read in the defining command script and to run tests on your ontology. You can download a current copy of CASA from the CASA web page's download page: http://kremer.cpsc.ucalgary/CASA/index.html. I will mark your assignment using JUnit with a test script that I will not reveal until after the assignment has been completed. However, I will provide an example JUnit script later on this page.

0. Simple (D)

The ontology you are going to create is about animals, and must follow this type ("isa") hierarchy:
isa hierarchy
Therefore, for example, the expressions (isa dog dog), (isa dog k9) and (isa dog animal) should return T (true), but the expressions (isa dog robot) and (isa k9 dog) should return NIL (false).

1. Fairly simple (C+)

Define the type doggy to be a synonym for dog. The two terms must be used interchangeably in all expressions, even those describing type in more detail. For example, the expression (isa <x> doggie) should always return the same value as (isa <x> dog), and the definition (ont.assert <x> <y> doggie) should always behave identically to (ont.assert <x> <y> dog).

2. Not so simple (C)

We need something to do with his hierarchy, so we will dabble in animal husbandry. We want to define a relation for a "mated pair": (mpair <individual-animal> <individual-animal>). That is, mpair is a binary relation where both of the domain and range are restricted to being a subtype of animal. Obviously, mpair will be a symmetric relation.

So, if we define (ont.individual "snoopy") (ont.assert isa snoopy dog) (ont.individual "lassy") (ont.assert isa snoopy dog), now we can define mated pairs using the expression (ont.assert mpair snoopy lassy), and then we expect the expressions (mpair snoopy lassy) and (mpair lassy snoopy) to return T. However we should not be able to assert things like (ont.assert mpair snoopy dog) because a dog is not an individual (it's a type).

3. Hard (B-)

However, we are oversimplifying! Clearly, a mated pair must be composed of a male and a female animal. But we don't have the concept of sex yet. So define a new relation (sex <individual-animal> <sex>) where the domain is restricted to being an animal, and the range is restricted to male or female. Now if we define (ont.assert sex snoopy male) (ont.assert sex lassy female), then the expression (sex snoopy male) should return T, but the expression (sex snoopy female) should return NIL. We should not be able to say (ont.assert sex lassy robot) or (ont.assert sex robot female).

4. Harder (B)

Now that we have the concept of sex, we should restrict mpair to pairs containing one each of a male animal and a female animal (in either order). So if (ont.individual "tiny") (ont.assert isa tiny dog) (ont.assert sex tiny female), then we expect to disallow (ont.assert mpair lassy tiny).

5. Harder still (A-)

But life is not that simple! Obviously a dog cannot mate with a cat (successfully, anyway). So we need to take that into account. You need to further restrict mpair to require the most-specific type of the animals in question to be the same type. (Hint: You can get the most-specific type of an individual using (proper-instance-of <individual> <type>), but this returns a list so you might prefer to use (car (proper-instance-of <individual> <type>)) if you know only a singleton list will be returned.) Thus, if we define (ont.individual "felix") (ont.assert isa felix cat) (ont.assert sex felix male), we shouldn't be able to write the expression (ont.assert mpair lassy felix).

6. Hardest (A)

But reality rears it's ugly head again! Dogs come in breeds, and generally, any breed of dog can successfully mate with any other breed of dogs, but there are exceptions. For example, a Great Dane cannot (I believe) successfully breed with a Chihuahua, event though they are both dogs. So what we want is some default reasoning: we generally accept that any animal can mate with any other animal of the same most-specific type, unless we know of an exception. Those exceptions will be defined by the relation (cant-breed <breed> <breed>). You should define the following breeds: beagle, chihuahua, great-dane, lab, tabby; where all of them are breeds of dog except the last, which is a breed of cat.

Hint: This is more complicated than you might think. Breeds are not just another type that can pin on the bottom of the isa lattice because we are using the isa lattice to determine default mate-ability. So we must define a separate part of the isa lattice rooted at breed and containing all the breeds as subtypes, e.g. (isa beagle breed). A further problem is that we don't want to mix up breeds of different animals, so we need another relation, (breed-of <breed> <animal-type>) so that we can say things like (bread-of beagle dog). Now, we an define the relation (breed <individual-animal> <breed>) to say things like (breed snoopy beagle).


What to hand in?

Email me your pure-text lisp file. Nothing more. I will mark it by running it through my JUnit test script. Any resources you use (including collaborations with other students [not copying!]) must be cited in comments.

Marking Scheme

Generally, the marking scheme is according to the levels of difficulty which correspond to parenthetical letter grades in the headings in the assignment description: if you pass every test in each level up and including "Harder still", but fail all or some of the tests at he "Hardest" level, you are (almost -- read on) guaranteed to get an A-. Marks may be adjusted up if you pass a lot of the tests at levels higher than your first failure or your code is particularly pleasant to read. Marks may be adjusted down if you do something untoward or silly in your code or your code is particularly difficult to comprehend.


AssnOntTest.java is a JUnit file that captures the examples used in the above assignment description. You can use it to help you debug your assignment. Note, however, that I will use a more extensive test suite to actually mark your assignment, so the results of this test do not guarantee you the mark indicated. You need to write a more extensive test suite yourself.

I have zipped my project file at CPSC568-AssignIndividual1.zip. You should be able to unzip it, and create a new project right over it. (Although I'm not guarenteeing you won't need to fudge around a bit with the configuration...)


UofC
CPSC 662/568: Agent Communication
Department of Computer Science

Last updated 2012-09-25 22:38
Rob Kremer