Archive for July, 2010

Counting in OWL: Flowers with Exactly Four Petals

July 4, 2010

the flower anatomy has thrown up at least one interesting little bit of OWL. This is to do with counting. Let us say a flower

hasPart some Petal

(reasonable as some flowers have only one petal). A cruciate flower has exactly four petals (and so looks like a cross). We can make a defined class in the usual way:

Class: CruciateFlower
	EquivalentTo: Flower
		that hasPart exactly 4 Petal

(My flower anatomy is not described in this way — I’ve shortened it for ease.) If I then have a class for a particular flower like:

Class: SpringCabbageFlower
	SubClassOf: Flower
		that hasPart exactly 4 Petal

this is recognised as a cruciate flower (all cabbages, such as spring cabbage and wall flowers are cruciate.). However, if we start saying things about each of the petals, such as shape, this no longer works as expected. For example:

Class: SomeFlower
	SubClassOf: Flower
		that hasPart exactly 2 (Petal that hasShape some Ovate)
		and hasPart exactly 2 (Petal that hasShape some Obovate)

isn’t classified as a cruciate flower, even though we think we’ve described it as having four petals. The reason is the "open world assumption". If we just say

hasPart exactly 4 Petal

we know that there are four petals. If, however, we say that exactly two of them are ovagte and exactly two are obovate shaped, we don’t know about petals that might be of some other shape; we might also have exactly two petals that ar lancealate and so on. So, we have to close off our description of petals by saying something like:

hasPart only ((Petal that hasShape some Obovate) or (Petal that hasShape some Ovate)) 

Having explicitly said that the "SomeFlower" flower has exactly two of one shape and two of another shape and only petals of that shape, then we know that it has exactly four petals in total. There is a little sample ontology to look at. It is worth running the reasoner both with and without the closure axiom in question — the closure axiom really slows down the reasoner.

Advertisements

A Cube of Cubes

July 3, 2010

Albert Berger and I were talking about navigating around an animal’s body parts using relationships. we wanted to be able to move from part to part using adjacency and so on, rather than just by moving from part to part by how they are put together. So, for example, going down the oesophagus to the stomach and turning left to find the pancreas. the pancreas is not directly connected to the stomach, but is nearby.

anyway, to help think this through I made a "cube of cubes". That is, a cube represents a body part and it is next to lots of other cubes. I used this as a highly styalised body — very styalised indeed. (sort of voxel like)
In a cube of cubes, a cube not at a face is surrounded by a cube on each face; a cube aligned on an edge and a cube touching each corner. This makes a total of 8 + 12 + 8 = 28 cubes. cubes at the edge have fewer adjacent cubes in the expected ways.

This is obviously hard work to do by hand; putting in up to 28 adjacency relationships by hand. So, I used inverses and sub-property chains to do most of the work for me. For a single, non-face cube I asserted an "up", "right" and "forward" property. Each of these properties has an inverse. So, for an individual cube A we asert a forward property to an individual cube B; the inverse of "forward" is "backward" and we automatically infer the inverse from the individual B. In this way, we can infer the missing three "face" relationships and have up/down; left/right and forward/backward for a non-face cube.

we can do sub-property chains for all the remaining adjacencies

  • For an individual non-face cube A we can go forwards and left to find the cube that fits on the edge and lies between the forward cube and the cube to the left. we can say "forward O left implies front left&quote;
  • We can carry on doing this for all the cubes on the edges of the cube in question: Front right; back left; back right; up left; up right; up front; and so on.
  • For a cube at a " point" we can go &quotfront O up O left" to get the cube on the top left hand corner of the cube in question.
  • again, we can do a series of sub-property chains based on up, left, and front (together with their inverses) to infer all these extra relationships.

this works fine. You can find a five by five cube ontology here. It has one class "cube" and a disproportionally complex property hierarchy. Each cube is an individual asserted to connect to only three neighbours. All other neighbour relationships are inferred. I wrote a little PERL script to generate the TBox and ABox in Manchester OWL Syntax. This script is in the zip file containing the cube ontology; I rarely programme these days and I had to get some rusty wheels turning again. One corner is the individual c000 and the diagonally opposite corner is, in this case, c444, with c222 being the central cube.

Here is the generated Manchester syntax for cube c222:

Individual: c222

    Types: [in cubes.owl]
        Cube
    
    Facts:  [in cubes.owl]
        hasNextFrontFace  c221,
        hasNextRightFace  c212,
        hasNextTopFace  c122

Of course, there is more than one route from a given cube to a neighbouring cube. For the cube at the top right of a given cube, we can go:

  • Front right and up;
  • Front up and right;
  • Right, front and up;
  • Right, up and front;
  • Up, front and right;
  • Up, right and front;
  • and many more that take routes longer than three — down, front, right, up and up, will also get you there.

this is all fine; it works. the properties for edges and corners have lots of sub-property chains (I think I have them all). what doesn’t work is having these properties functional. I want a constraint that a given cube can have only one cube touching each corner on the diagonal. a functional characteristic, however, makes a property non-simple. this means that sub-property chains will not work.

below are the inferences made on one of the cubes (c222, the central one):

hasNextFrontFace c221
hasNextTopFace c122
hasNextRightFace c212
hasFrontTopLeftCorner c131
hasBackBottomLeftCorner c333
hasBackTopRightCorner c113
hasFrontBottomLeftCorner c331
hasBackBottomEdge c323
hasBackTopLeftCorner c133
hasBottomRightEdge c312
hasNextBackFace c223
hasNextEdge c211
hasNextEdge c231
hasNextEdge c132
hasNextEdge c312
hasNextEdge c121
hasNextEdge c233
hasNextEdge c112
hasNextEdge c213
hasNextEdge c332
hasNextEdge c323
hasTopRightEdge c112
hasFrontRightEdge c211
hasFrontTopRightCorner c111
hasBottomLeftEdge c332
hasBackRightEdge c213
hasBackLeftEdge c233
hasFrontBottomRightCorner c311
hasBackBottomRightCorner c313
hasNextCube c012
hasNextCube c122
hasNextCube c131
hasNextCube c034
hasNextCube c314
hasNextCube c044
hasNextCube c123
hasNextCube c322
hasNextCube c222
hasNextCube c003
hasNextCube c310
hasNextCube c130
hasNextCube c240
hasNextCube c243
hasNextCube c224
hasNextCube c411
hasNextCube c042
hasNextCube c303
hasNextCube c320
hasNextCube c441
hasNextCube c030
hasNextCube c041
hasNextCube c124
hasNextCube c112
hasNextCube c413
hasNextCube c024
hasNextCube c110
hasNextCube c114
hasNextCube c013
hasNextCube c031
hasNextCube c113
hasNextCube c443
hasNextCube c234
hasNextCube c430
hasNextCube c340
hasNextCube c423
hasNextCube c444
hasNextCube c332
hasNextCube c242
hasNextCube c420
hasNextCube c032
hasNextCube c343
hasNextCube c341
hasNextCube c312
hasNextCube c212
hasNextCube c233
hasNextCube c313
hasNextCube c344
hasNextCube c321
hasNextCube c324
hasNextCube c334
hasNextCube c213
hasNextCube c424
hasNextCube c133
hasNextCube c301
hasNextCube c302
hasNextCube c232
hasNextCube c001
hasNextCube c304
hasNextCube c223
hasNextCube c330
hasNextCube c421
hasNextCube c103
hasNextCube c134
hasNextCube c011
hasNextCube c014
hasNextCube c210
hasNextCube c142
hasNextCube c412
hasNextCube c433
hasNextCube c000
hasNextCube c244
hasNextCube c401
hasNextCube c431
hasNextCube c434
hasNextCube c403
hasNextCube c020
hasNextCube c342
hasNextCube c432
hasNextCube c230
hasNextCube c323
hasNextCube c200
hasNextCube c414
hasNextCube c004
hasNextCube c333
hasNextCube c040
hasNextCube c101
hasNextCube c023
hasNextCube c410
hasNextCube c021
hasNextCube c102
hasNextCube c400
hasNextCube c220
hasNextCube c043
hasNextCube c010
hasNextCube c104
hasNextCube c241
hasNextCube c422
hasNextCube c211
hasNextCube c404
hasNextCube c141
hasNextCube c311
hasNextCube c022
hasNextCube c002
hasNextCube c214
hasNextCube c111
hasNextCube c442
hasNextCube c231
hasNextCube c132
hasNextCube c143
hasNextCube c140
hasNextCube c120
hasNextCube c204
hasNextCube c033
hasNextCube c202
hasNextCube c100
hasNextCube c331
hasNextCube c300
hasNextCube c203
hasNextCube c402
hasNextCube c201
hasNextCube c221
hasNextCube c121
hasNextCube c440
hasNextCube c144
hasFrontTopEdge c121
hasNextCorner c113
hasNextCorner c331
hasNextCorner c333
hasNextCorner c311
hasNextCorner c313
hasNextCorner c131
hasNextCorner c111
hasNextCorner c133
hasNextBottomFace c322
hasNextFace c232
hasNextFace c122
hasNextFace c212
hasNextFace c221
hasNextFace c223
hasNextFace c322
hasFrontLeftEdge c231
hasNextLeftFace c232
hasTopLeftEdge c132

Notice that that we have lots of entailments like "hasNextCube" due to the superproperties of all the properties also being entailled on a cube.
The inferences for cube c000 are:

hasBackLeftEdge c011
hasBackBottomLeftCorner c111
hasNextEdge c011
hasNextEdge c101
hasNextEdge c110
hasBackBottomEdge c101
hasNextCube c012
hasNextCube c122
hasNextCube c131
hasNextCube c034
hasNextCube c314
hasNextCube c044
hasNextCube c123
hasNextCube c322
hasNextCube c222
hasNextCube c003
hasNextCube c310
hasNextCube c130
hasNextCube c240
hasNextCube c243
hasNextCube c224
hasNextCube c411
hasNextCube c042
hasNextCube c303
hasNextCube c320
hasNextCube c441
hasNextCube c030
hasNextCube c041
hasNextCube c124
hasNextCube c112
hasNextCube c413
hasNextCube c024
hasNextCube c110
hasNextCube c114
hasNextCube c013
hasNextCube c031
hasNextCube c113
hasNextCube c443
hasNextCube c234
hasNextCube c430
hasNextCube c340
hasNextCube c423
hasNextCube c444
hasNextCube c332
hasNextCube c242
hasNextCube c420
hasNextCube c032
hasNextCube c343
hasNextCube c341
hasNextCube c312
hasNextCube c212
hasNextCube c233
hasNextCube c313
hasNextCube c344
hasNextCube c321
hasNextCube c324
hasNextCube c334
hasNextCube c213
hasNextCube c424
hasNextCube c133
hasNextCube c301
hasNextCube c302
hasNextCube c232
hasNextCube c001
hasNextCube c304
hasNextCube c223
hasNextCube c330
hasNextCube c421
hasNextCube c103
hasNextCube c134
hasNextCube c011
hasNextCube c014
hasNextCube c210
hasNextCube c142
hasNextCube c412
hasNextCube c433
hasNextCube c000
hasNextCube c244
hasNextCube c401
hasNextCube c431
hasNextCube c434
hasNextCube c403
hasNextCube c020
hasNextCube c342
hasNextCube c432
hasNextCube c230
hasNextCube c323
hasNextCube c200
hasNextCube c414
hasNextCube c004
hasNextCube c333
hasNextCube c040
hasNextCube c101
hasNextCube c023
hasNextCube c410
hasNextCube c021
hasNextCube c102
hasNextCube c400
hasNextCube c220
hasNextCube c043
hasNextCube c010
hasNextCube c104
hasNextCube c241
hasNextCube c422
hasNextCube c211
hasNextCube c404
hasNextCube c141
hasNextCube c311
hasNextCube c022
hasNextCube c002
hasNextCube c214
hasNextCube c111
hasNextCube c442
hasNextCube c231
hasNextCube c132
hasNextCube c143
hasNextCube c140
hasNextCube c120
hasNextCube c204
hasNextCube c033
hasNextCube c202
hasNextCube c100
hasNextCube c331
hasNextCube c300
hasNextCube c203
hasNextCube c402
hasNextCube c201
hasNextCube c221
hasNextCube c121
hasNextCube c440
hasNextCube c144
hasBottomLeftEdge c110
hasNextLeftFace c010
hasNextCorner c111
hasNextBottomFace c100
hasNextFace c100
hasNextFace c001
hasNextFace c010
hasNextBackFace c001

boring to work out if it is right, but I think it is.