Ontology Oriented Programming in Go!

Transcription

1 Ontology Oriented Programming in Go! K.L. Clark F.G. McCabe Abstract In this paper we introduce the knowledge representation features of a new multi-paradigm programming language called Go! that cleanly integrates logic, functional, object oriented and imperative programming styles. Borrowing from L&O[1], Go! allows knowledge to be represented as a set of labeled theories incrementally constructed using multiple-inheritance. The theory label is a constructor for instances of the class. The instances are Go! s objects. A Go! theory structure can be used to characterize any knowledge domain. In particular, it can be used to describe classes of things, such as people, students, etc., their subclass relationships and characteristics of their key properties. That is, it can be used to represent an ontology. For each ontology class we give a type definition - we declare what properties, with what value type, instances of the class have - and we give a labeled theory that defines these properties. Subclass relationships are reflected using both type and theory inheritance rules. Following [2], we shall call this ontology oriented programming. This paper describes the Go! language and its use for ontology oriented programming, comparing its expressiveness with Owl, particularly Owl Lite[3]. The paper assumes some familiarity with ontology specification using Owl like languages and with logic and object oriented programming. 1 Introduction Go! has many features in common with the L&O[1] object oriented extension of Prolog. Both languages allow the grouping of a set of relation and function definitions into a lexical unit called a labeled theory that characterise some 1

2 1 INTRODUCTION 2 class of things. Go! extends L&O in also having action procedures defined by action rules. It also differs from L&O in having moded type declarations for programs with compile time type checking. Mercury[7] also has types and modes but these differ from Go! s. Go! is multi-threaded with asynchronous message communication between the threads using mailboxes. A mailbox is essentially a queue object shared by the communicating threads. Typically only one thread has read access to a given mailbox, while several threads can have write access. Go! has been primarily designed to allow fast development of intelligent agent based applications involving multi-threaded agents. A Go! agent typically comprises several threads that implement different aspects of the agent s behaviour and which share a set of updatable objects, usually dynamic relations or hash tables. These are used to represent the agent s changing beliefs, desires and intentions. As an example, the dancer agents described in [4] have the architecture depicted in the figure below. Dancer agent architecture beliefs desires intentions Memory stores Messages To/From DS Negotiation DS neg Interface thread Intention Execution exec thread Messages from Band Messages to/from other dancers Data flow Messages to/from other dancers In the dancer agent application beliefs are just a set of facts, but in a more complex agent application it is useful to structure the beliefs in terms of an ontology. The beliefs then record descriptions of individuals belonging to different ontology classes and must be consistent with the ontology. We can also augment the extensional held partial descriptions with inferences that are licensed by the ontology. For example, to infer that bill is a child of mary if we believe that mary is a parent of bill where the ontology tells us that child of and parent of are inverse properties. The emphasis of this paper is Go! s class type and labeled theory nota-

3 1 INTRODUCTION 3 tion and its use for representing ontological concepts. Its multi-therading and thread coordination and communication features are described in [4]. We introduce these ontology related features through a series of increasingly complex examples. As we do so, we shall compare the way ontological concepts can be represented in Go! with the way they can be represented in Owl Lite[5][3]. We use the Owl abstract syntax of [3] rather than the XML syntax of [5]. Owl Lite, and its extension Owl DL, are ontology definition languages in which classes of things are characterised in terms of subclass and identity relationships with other classes, and by restrictions on unary properties for instances of the class. They are based on description logics[6]. These are logics with fast tailored inference procedures that support reasoning about the subsumption relationships between classes - inferring that all instances of one class must also be instances of another given their respective class descriptions, as well as reasoning about individuals of a class. They are more declarative than Go!, but they are not general purpose programming languages 1. We shall mostly make comparisons with Owl Lite rather than Owl DL as the mapping between Owl Lite and Go! class notation is more direct, and, according to [6], Owl Lite has nearly all the expressive power of Owl DL. We shall see that in Go! many of the restrictions on property values that one can express in Owl Lite become type constraints for the properties captured in a type definition. These can be checked at compile time. Others become run-time constraints that are checked when we try to create instances of a class. Ontological concepts such as transitivity of a property are implemented in Go! as explicit recursive definitions of the closure relation. This approach to representing ontologies is what Goldman[2] calls ontology oriented programming. He shows how a hierarchy of ontology classes, and implementations of their respective interface properties, can be reflected in the class and interface type hierarchy of a C# or Java application. In the next section we give a brief introduction to the basic elements of Go!- introducing the different forms of definition and Go! s dynamic relations, which are objects. In section 3 we introduce labeled classes. In section 4 we illustrate the building of new classes as extensions of existing classes using 1 For example, a communicating agent that reasons using an ontology cannot be implemented in Owl. An Owl reasoner would have to be embedded inside an outer wrapper written in a language such as Java, Prolog or Go!. In contrast, the entire agent can be implemented in Go!.

4 2 BASE ELEMENTS OF GO! 4 inheritance. Section 5 gives an example of a recursive class - one that must make use of the very class concept it is defining. Section 6 covers multiple inheritance. In section 7 we introduce the use of dynamic relations in a class to give us objects with changeable state. In section 8 we investigate using Go! rules to define n-ary relations over objects allowing us to define relationships that can only be captured using a rule extension of Owl. We summarise and discuss related work in section 9. 2 Base elements of Go! Go! is a multi-paradigm language with a declarative subset of function and relation definitions and an imperative subset comprising action procedure definitions. 2.1 Function, relation and action rules Functions are defined using sequences of rewrite rules of the form: f (A 1,..,A k )::Test => Exp where the guard Test is omitted if not required. For each function there must also be an associated type definition of the form: f :[t 1,..,t k ]=>t where t i is the type of the i th argument and t is the type of the value. These must all be data types. Go! is not higher order but we can program in a higher order way by passing in and returning object values. As in most functional programming languages, the testing of whether a rule can be used to evaluate a function call uses matching not unification. The first function rule to match some function call, whose test also succeeds, is used to evaluate the call. Example function definitions are: father of:[person]=>person. father_of(c)::c.parent(f),f.gender()==male => F. number_of_children:[person]=>integer. number_of_children(p) => len({c P.child(C)}).

5 2 BASE ELEMENTS OF GO! 5 len:[list[t]]=>integer. len([]) => 0. len([hd,..tl]) => len(tl)+1. The operator :: can be read as such that. An expression of the form: {T Cond } is a set expression, it is Go! s equivalent to the Prolog findall. len is declared to be a polymorphic function from a list of any type T to an integer.,.. is Go! s list data constructor to be read as followed by. It is the same as the Prolog, which in Go! has other uses. Relation definitions comprise sequences of Prolog-style :- (if ) clauses of the form: r (A 1,..,A k ):- Cond 1,...,Cond n or sequences of :-- (iff ) committed chouice clauses of the form: r (A 1,..,A k )::Test :-- Cond 1,...,Cond n with an associated type definition of the form: r :[t 1,..,t k ]{} Prolog s cut (!) is not allowed 2 and evaluable expressions may be used as condition arguments inside the bodies of the clauses. The type expressions may be moded using annotations We can say that an argument of type t is input using t+, that it is output using t-. In a relation type expression no annotation means that the argument may be input or output, allowing multiple uses. In contrast, an un-annotated argument type in a function or action procedure type expression means that the argument is input. The mode information is used by the type inference system to reason about subtypes. For an input argument a sub-type value can be given in the call, for an output argument or a function value a sub-type value can be generated. The following is a single clause relation definition: 2 We have found that all our uses of the cut when programming in Prolog may be achieved in Go! using function rules, :-- clauses and other high level control features such as conditionals and single solution conditions.

6 2 BASE ELEMENTS OF GO! 6 takes_only_maths_courses:[student+]{}. takes_only_maths_courses(s) :- (S.takes(C) *> C.dept()= maths ). This defines a property that holds of any student S such that every C that S takes has dept() attribute maths 3. The preceding mode annotated type definition tells us that this is a test relation. The type expression student+ signals that the argument must be given when the relation is called and be an object of type student, or an object with a type that is a declared sub-type of student, say a married student. *> is Go! s forall. A condition: (Cond1 *> Cond2 ). holds if for every solution to Cond1, there exists a solution to Cond2. Cond1 and Cond2 typically share variables. The locus of action in Go! is a thread; each Go! thread executes an action procedure. These are defined using non-declarative action rules of the form: a (A 1,..,A k )::Test -> Action 1 ;...;Action n with associated type definitions of the form: a :[t 1,..,t k ]* * is the annotation for an action type. We use : rather than, to separate the action calls in the body of an action rule to emphasise the imperative aspect of the rule. As with equations, the first action rule that matches some call, and whose test is satisfied, is used; once an action rule has been selected there is no backtracking on the choice of rule should one of its actions fail. Failure to find a rule for an action call is a run-time error. The permissible actions of an action rule include: message dispatch and receipt, I/O, updating of dynamic relations, the calling of a procedure, and the spawning of any action, or sequence of actions, to create a new action thread. The new thread executes concurrently with the spawning thread. The two threads can communicate using shared objects - typically mailboxes. An example action procedure definition is: 3 Note that maths is singly quoted. This is because, unlike Prolog, Go! does not have a variable name convention - most identifiers can be used as variable names, so must be quoted when used as a symbol.

7 2 BASE ELEMENTS OF GO! 7 display info about:[person]*. display info about(p) -> case P.age() in (A::A>=18 -> stdout.outline(p.name()<>" is an adult") A::A>12 -> stdout.outline(p.name()<>" is a teenager") _ -> stdout.outline(p.name()<>" is a child"). This procedure is defined using one action rule. It is a procedure for displaying on the standard output channel, usually a terminal window, the values of the name and age attributes of any P that is a person or a sub-type of person. stdout is a Go! system object with various methods for sending strings to the standard output channel. <> is a polymorphic primitive for concatenating lists of any values. Go! strings are lists of single character symbols. 2.2 Go! dynamic relations In Prolog we can use assert and retract clauses to change the definition of a dynamic relation whilst a program is executing. The most frequent use of this feature is to modify a definition comprising a sequence of unconditonal clauses. In Go!, such a dynamic relation is an object with updateable state. It is an instance of a polymorphic system class with interface type dynamic[t], T being the type of the argument of the dynamic relation. All Go! dynamic relations are unary, but the unary argument can be a tuple of terms. The dynamic relations class has methods: add, for adding an argument term to the end of the current extension of the relation, del for removing the first argument term that unifies with a given term, delall for removing all argument terms unifying with a given term, mem, for accessing terms in the current extension using unification, and finally ext for retrieving the current extension as a list of terms. A dynamic relation object can be created and assigned to a variable as in: eats:dynamic[(symbol,symbol,integer)]. eats=$dynamic([( peter, apples,2),( john, icecream,1)]) The given list of 3-tuples is the initial extension. The preceding type declaration tells us that eats is a dynamic relation object comprising three-tuples - two symbols and an integer. We can now manipulate and query the relation using:

8 3 LABELED THEORIES 8 eats.del(( peter, apples,n)); deletes tuple, binds N to 2 eats.add(( peter, apples,n+1)); add new tuple (...,...,3) (eats.mem(( john,f,k)),k>1?......); The last action is a conditional action.? can be read as then, as else. State information can also be recorded in special cell obects and in hash table objects. cell objects have set and get methods for updating and accessing a single stored value. hash tables are like dynamic relations except that every stored value must have a unique associated key which can be used for fast access to the value. 3 Labeled theories The following set of definitions constitute a mini-theory of a person: Gender::= male female. person < {dayofbirth:[]=>day. age:[]=>integer. gender:[]=>gender. name:[]=>string. home:[]=>string. lives:[string]{}}. person:[string,day,gender,string]$=person. person(nm,born,sx,hm)..{ dayofbirth()=>born. age() => yearsbetween(now(),born). gender()=>sx. name()=>nm. home()=>hm. lives(pl) :- Pl=home(). yearsbetween:[integer,day]=>integer. yearsbetween(...) =>.. }. newperson:[string,day,gender,string]=>person. newperson(nm,born,sx,hm)=>$person(nm,born,sx,hm). The ::= rule defines a new algebraic type - a data type with only data constructors. The < rule defines an interface type - it tells us what properties are characteristic of a person and also gives us type constraints on these

9 3 LABELED THEORIES 9 properties. It tells us that age is a functional property with an integer value, that lives is a unary relation over strings, and that dayofbirth is a functional property with a value that is an object of type day 4 The $= type rule tells us that there is also a theory label, with the functor person, for a theory that defines the characteristic properties of the person type - implements the person interface - in terms of four given parameters of types string, day, Gender and string. This overloading of the type name person is allowed, but not required. We could equally have used personc, or any other name, as the label functor 5 The theory labeled person(nm,born,sx,hm) is an implementation of the person interface type. The label parameters Nm, Born, Sx, Hm, are global variables of the theory. Their values, given when an instance is created, transform the template theory into a mini-theory of a specific person. The characteristic properties dayofbirth, gender, name, home, age, and lives are defined in terms of these parameters. The compiler will check that the given definitions conform to the type signatures of the person type. yearsbetween is a function used to implement the changing age property. It is not an externally visible property of a person. now is a system function for returning the Unix time. The newperson function is not strictly necessary as a $label expression, as used in the function definition, can be used to generate an instance of any labeled theory. However, using expliclty defined functions to construct objects has certain advantages. For one thing it allows us to hide or add default values for some of the label parameters. We could, for example, also define newmaleperson and newfemaleperson that do not need to be given the Gender argument. Creating class instances We can create two instances of the person class, i.e. two person objects, and query them as follows: P1=newPerson("Bill",$day(1982,3,15),male,"London,England") P2=newPerson("Jane",$day(1980,11,23),female,"Cardiff,Wales") P1.name() returns name "Bill" of P1 4 This is an object type that we do not define. It will have interface properties year, month etc that are used by the yearsbetween utility function. 5 Go! allows us to give several different labeled theories implementing the same interface type, all with different labels. For purposes of this paper we shall only need one labeled theory per interface type so we shall always re-use the type name as the label functor.

10 3 LABELED THEORIES 10 P2.age() returns current age, say 25, of P2 P2.lives(Place) gives solution: Place="Cardiff,Wales" The expression: (P1.name(),P1.dayOfBirth().year(),P1.home()) will evaluate to the tuple: ("Bill",1982,"London,England") Ontological reading In ontological terms, the person interface type defines a person as a thing that has: a functional property dayofbirth with a value that belongs to the day class/type a functional integer valued property age a functional string valued property name a functional string valued property home a functional property gender with a value from the data type Gender a multi-valued property lives with values that are strings In addition, its associated labeled theory tells us that: the property age is dependent upon the value of their yearofbirth that one value for the lives property is the value for their home property 3.1 Class definition in Owl Using Owl Lite concrete abstract syntax[3], the above ontological reading can in part be captured by the Owl class axiom:

11 3 LABELED THEORIES 11 Class(person partial restriction(dayofbirth Cardinality(1) allvaluesfrom(day)) restriction(age Cardinality(1) allvaluesfrom(integer) restriction(name Cardinality(1) allvaluesfrom(string)) restriction(home Cardinality(1) allvaluesfrom(string)) restriction(lives Cardinality(1) allvaluesfrom(string)) restriction(gender maxcardinality(1) allvaluesfrom(gender)) Datatype(Gender). Alternatively, if we are prepared to globalise the cardinality and range constraints of the property names so that they apply to every use of these property names, in every class of the ontology, we can use a much simplified class axiom and several property axioms: Class(person partial) ObjectProperty(dayOfBirth range(day) Functional) DatatypeProperty(age range(number) Functional) DatatypeProperty(name range(string) Functional) DatatypeProperty(home super(lives) range(string) Functional) DatatypeProperty(lives range(string)) DatatypeProperty(gender range(gender) Functional) Datatype(Gender). In Owl a distinction is made between data valued properties, properties that have scalar values such as strings and numbers, and object properties which have instances of some ontology class as values. Note that in Owl Lite we can only say that values for the functional property gender are from a data type called Gender. We cannot further constrain this data set. In Owl DL we can; we can explicitly enumerate the two allowed values for the gender property: DatatypeProperty(gender range(oneof(male female)) Functional) For none of the property axioms have we given a domain restriction. This allows them to be used as properties of any Owl Lite class. The equivalent of this type of globalisation of property names in Go! is a self imposed constraint that whenever we use the same name, such as age, in a class interface type definition, we always give it the same type. However, Go! does not allow us to declare that age will always be functional with an integer value. As in

12 3 LABELED THEORIES 12 most OO programming languages, the same property/method name can be used with a quite different associated type in different class interface types. This is an intended feature of the language. The only constraint on re-use in Go! is in a sub-class definition. Any re-definition of age in a sub-class of the person class must define it to have the same type. Notice that in the first Owl formulation we do not capture the restriction that one value for the lives property is the value of the home property. We cannot express this sub-property relationship using the class specific property restrictions of Owl Lite or Owl DL. By using separate property axioms, we can capture it by saying that home has lives as a super-property. In other words, that every value of the home property of an object is a value of the lives property of that object. Capturing this restriction comes at the cost of globalising these two properties. As far as we understand, Owl does not allow us to express the restriction that age is functional dependent upon dayofbirth, we can only express the restriction that age is functional. In Owl we can tighten the restriction on the age attribute and say that its range is the data type nonnegativeinteger. Since nonnegativeinteger is not a base type of Go!, to capture this restriction we must add a constraint to the class label parameter Born. The theory label becomes: person(nm,(born::yearsbetween(now(),born)>=0),sx,hm) The test will be applied to the given Born value when an instance of the person class is created - when we instantiate the theory to describe a particular person. Note that the test uses the yearsbetween function defined inside the class which is in scope for the label. 3.2 Owl complete class axioms The class axiom for person has modality partial. In Owl this means that when an individual is known to be a member of the class we can infer that it belongs to any super-classes mentioned in the axiom, and that its properties satisfy the extra restrictions given in the class axiom. The other Owl class axiom modality is complete. This tells us that the membership of the super classes, and satisfaction of the restrictions given for the properties, may also be considered as defining restrictions - that any thing satisfying all the restrictions of the class axiom can be inferred to be an instance of the class. An example would be:

13 3 LABELED THEORIES 13 Class(marriedPerson complete person restriction(spouse Cardinality(1)) allvaluesfrom(marriedperson)) This says that a married person is a person with exactly one married person spouse. It also says that any person with a married person spouse is, ipso facto, a married person. It gives defining characteristics for a married person. So, even if some object is not known to be a marriedperson, it can be inferred to be one if they are known to be a person, perhaps because they belong to a subclass of person, and they have a spouse that is a marredperson. To define the marriedperson type in Go! we can use two < rules: marriedperson < person. marriedperson < {spouse:[]=> marriedperson}. The first rule says that marriedperson includes all the properties, with the same type signature, as the person type - that marriedperson is a subtype of person. The second says that, in addition, marriedperson includes a spouse functional property returning a marriedperson value. The first rule allows us to use a marriedperson object where ever a person object is required as a given value. The second marriedperson rule tells the compiler about the additional spouse property of a marriedperson object. The complete class concept of Owl does not have a direct mapping into Go!. In Go! programming terms it means that any other type that has all the properties of the marriedperson interface must be such that the Go! compiler treats it as a sub-type of marriedperson. Suppose we want to characterize in Go! some new class otherperson which happens to include all the properties of the marriedperson type as well as some additional properties. We could give a single interface type definition for otherperson that explicitly enumerates all its properties and associated types, but the Go! compiler would treat this as a completely separate type not related to the marriedperson type. To ensure that the compiler will treat objects of type otherperson as objects of type marriedperson, we must explicitly declare that otherperson is a sub-type marriedperson, and in a separate type rule enumerate its extra properties and their types. That is, we define the interface for otherperson indirectly by referring to the marriedperson type. So, the complete class concept of Owl is captured in Go! as an ontological programming pattern - always define a new interface type that includes all

14 3 LABELED THEORIES 14 the properties of a type that is completely characterized by its interface, by explicitly declaring that the new type is a sub-type of this complete type. As an example, suppose we want to characterize the marriedstudent class in Go!. Instead of using one type definition rule: marriedstudent < {dayofbirth:[]=>day. age:[]=>integer.... lives:[string]{}. spouse:[]=> marriedperson. college:[]=>string....}. or even the two rules: marriedstudent < person. marriedstudent < {spouse:[]=> marriedperson. college:string....}. that tell us marriedstudent is a sub-type of the person type, we define the marriedstudent interface type using: marriedstudent < person. marriedstudent < marriedperson. marriedstudent < {college:[]=>string....}. or, more concisely as: marriedstudent < marriedperson. marriedstudent < {college:string,...}. The two rule definition is equivalent to the three rule definition since: marriedstudent < person. can be inferred from: marriedstudent < marriedperson. marriedperson < person. by transitivity of <. This enables a marriedstudent object to be used wherever a marriedperson or a person object is required. The Go! compiler does this class membership inference using the type inheritance rules.

15 3 LABELED THEORIES Describing class instances in Owl In Owl, class instances, called individuals, are created and given properties as follows: Individual(person1 person value(name "Bill") value(dayofbirth Individual(day value(year 1982) value(month 3) value(day 15))) value(gender male) value(age 23) value(home "London,England")) The value terms give the property values for the instance. Giving an individual an indentifier, such as person1, is the analogue of assigning an object to a variable, such as P1 in Go!. Note that the individual that is the day is not given an identifier, it is an anonymous individual. Also note that age has to be given a value. Owl does not allow us to define the function that computes the value of age using dayofbirth, just as it does not allow us to state the functional dependency between age and dayofbirth. In this respect Owl is weaker than the frame concept for knowledge representation [8]. We do not need to give a value for the lives property if the Owl axiomatization with separate property axioms is used. An Owl inference engine will infer the value "London,England" for the lives property from the axiom: DatatypeProperty(home super(lives) range(string) Functional) by making use of the super(lives) declaration. This is the equivalent of Go! s use of the rule: lives(pl) :- Pl=home(). given in the person labeled theory to infer that the home location is a place where a person lives. 3.4 Querying on Owl Ontology There is no specific Owl query language but Owl-QL[9] is a recent proposal for a language that could be used to query an Owl ontology held inside some

16 3 LABELED THEORIES 16 ontology server. A Owl-QL query essentially comprises an answer template, which is usually a list of variables appearing inside the query pattern, and a query pattern, which is a list of query conditions. Variables are prefixed with?. A query condition is a term of the form: (propertyid propertyvalue propertyvalue) or the form: (type propertyvalue classid) An example query, in pseudo Owl-QL is: Answer Pattern: {(?N?Y?H)} Query Pattern: {(name person1?n)(dayofbirth person1?d) (year?d?y)(home person1?h)} This queries the description of the individual named person1 to find some of their property values. It is the equivalent of the Go! expression: (P1.name(),P1.dayOfBirth().year(),P1.home()) given earlier. More generally, in Owl-QL, one can use type conditions to find the property values of all the individuals of some class. Answer Pattern: {(?N?Y?H)} Query Pattern: {(type?p person)(name?p?n) (dayofbirth?p?d)(year?d?y)(home?p?h)} can be used to find the name, year of birth and home location of all instances of the person class described in the ontology. 3.5 Class search queries in Go! In Go!, to be able to find property values of all instances of a class, or to find all the instances that have particular property values, we need to be able to iterate over all the created objects of the class. One way to do this is to store each one, when it is created, in a dynamic relation: Person:dynamic[person]=$dynamic([]). isaperson(p) :- Person.mem(P).

17 4 THEORY AND TYPE INHERITANCE 17 Person:dynamic[person] declares the type of the global variable Person as a dynamic relation object holding person objects. We must now add each person object to the dynamic relation as it is created. We can do this by adding the action: ${Person.add(this)} to the person class. Any $ prefixed action, or action sequence, inside a class is executed each time an object of the class is created. this denotes the created object. The equivalent of the second Owl-QL query is now the succinct Go! set expression: {(P.name(),P.dayOfBirth().year(),P.home()) isaperson(p)} 4 Theory and type inheritance We may define a new class as a modification/extension of an existing class using inheritance. Below we give an interface type definition and a labeled theory characterizing the student class. The first type rule says that student is a subtype of person. The <= theory inheritance rule says that when an instance student(nm,born,sx,hm,, ) of the student labeled theory is created all the definitions for the instance person(nm,born,sx,hm) of the person labeled theory, not over-ridden in the student theory, are implicitly added to the student theory instance. In addition, any $ action of the person theory is to be executed before and in addition to any $ action of the student theory. There is a $ action inside the student theory that adds each new student to the extension of an associated Student dynamic relation. We also define an auxiliary class college - the class of values for the enrolled property of a student. student < person. student < {enrolled:[]=>college. studies:[string]{}}. student:[string,day,gender,string,college,list[string]]$= student. student(nm,born,sx,hm,, )<= person(nm,born,sx,hm). student(,,,,,cge,sbjs)..{

19 4 THEORY AND TYPE INHERITANCE 19 S1.studies(Sub) has two answers: Sub="computing", Sub="mathematics" {(S.name(),S.enrolled().name(),S.age(),{Sb S.studies(Sb)}) isastudent(s)} is list of 4-tuples giving name, enrolled college name, age and the list of study subjects of all current students Finding a person that is a student Every student can also be treated as a person because we have declared that student is a sub-type of person. In addition, because the student theory inherits from the person theory, each time we create a new student we will not only execute the $ action of the student theory, to add it to the Student dynamic relation, we shall also first execute the $ action of the person theory, which adds it to the Person dynamic relation. When we are searching for a person using isaperson we will thus have automatic access to the set of student objects - viewed as person objects. 4.1 Inheritance in Owl In Owl the student class could be axiomatised as: Class(student complete person restriction(studies restriction(enrolled Class(college partial restriction(location allvaluesfrom(string)) Cardinality(1) allvaluesfrom(college))) Cardinality(1)) allvaluesfrom(string))) Note that the above does not capture the information expressed in the go class that the location of a student s enrolled college is a value for their lives property. To capture this restriction we would have to lift the name and location properties of a college to make them direct properties of a student, perhaps naming them collegename and collegelocation. In a separate property axiom we can then say that collegelocation is a subproperty of lives. This is a bit convoluted and loses the separate concept of a college as a property value for a student.

20 5 RECURSIVE CLASSES, SYMMETRIC PROPERTIES 20 Class(student complete person restriction(studies allvaluesfrom(string)) restriction(collegename Cardinality(1) allvaluesfrom(string))) DatatypeProperty(collegeLocation super(lives) range(string) Functional) When querying an Owl ontology the condition (type?p person) will include all individuals declared to be instances of the class student because the student class axiom says that this is a sub-class of the person class. 5 Recursive classes, symmetric properties A married person is a person who has a spouse, that spouse being a married person. This is a recursive class since we cannot properly characterise a married person without making use of the concept being defined. spouse is also a symmetric property. Symmetry is a meta-property of a property that can be declared in an Owl axiom. The declaration enables an Owl reasoner to infer that "peter" is married to "mary", when all that is explicitly recorded is that "mary" is married to "peter". The following Go! marriedperson definition implicitly uses symmetry of the spouse property in the second rule for the spouse() function definition, as described below. Note the recursive characterisation of the type marriedperson in the second type rule. marriedperson < person. marriedperson < {spousename:[]=>string. spouse:[]=>marriedperson)}. marriedperson(string,day,gender,string,string)$= marriedperson. marriedperson(nm,born,sx,hm, )<=person(nm,born,sx,hm). marriedperson(nm,,sx,hm,spnm)..{ spousename()=>spnm. defaultspousefor:[marriedperson]=> marriedperson. defaultspousefor(mp)=> $person(spnm,$day(0,0,0),oppgender(sx),hm)..{

Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

The CLIPS environment The CLIPS environment CLIPS is an environment to develop knowledge based systems It defines a programming language that allows to represent declarative and procedural knowledge This

FAQs Introduction to Database Systems and Design Module 1: Introduction Data, Database, DBMS, DBA Q2. What is a catalogue? Explain the use of it in DBMS. Q3. Differentiate File System approach and Database

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

The IC Language Specification Spring 2006 Cornell University The IC language is a simple object-oriented language that we will use in the CS413 project. The goal is to build a complete optimizing compiler

Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the

SETS: A Basic Set Theory Package Francis J. Wright School of Mathematical Sciences Queen Mary and Westfield College University of London Mile End Road, London E1 4NS, UK. Email: F.J.Wright@QMW.ac.uk March

2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

Introduction Table of Contents About This Course...i Who Should Attend this Course...i How to Use this Book... ii Conventions Used in this Book... ii Lesson 1 Introduction to Object-Oriented Approach Object-Oriented

Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model The entity-relationship (E-R) model is a a data model in which information stored

The Import & Export of Data from a Database Introduction The aim of these notes is to investigate a conceptually simple model for importing and exporting data into and out of an object-relational database,

1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

Descrizione This course teaches participants how to develop Java programs. The course focuses on teaching the core Java language (J2SE), including essential object-oriented principles. In addition to Java,

C++ for Game Programmers Course Description C++ has become one of the favourite programming language for game programmers. Reasons for wide spread acceptability of C++ are plenty, but primary reasons are,

COMPUTER SCIENCE COMSC The computer science department offers courses in three general areas, each targeted to serve students with specific needs: 1. General education students seeking a computer literacy

The Entity-Relationship Model 221 After completing this chapter, you should be able to explain the three phases of database design, Why are multiple phases useful? evaluate the significance of the Entity-Relationship

Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

A Propositional Dynamic Logic for CCS Programs Mario R. F. Benevides and L. Menasché Schechter {mario,luis}@cos.ufrj.br Abstract This work presents a Propositional Dynamic Logic in which the programs are

Entity-Relationship Model Database Modeling (Part 1) A conceptual data model, which is a representation of the structure of a database that is independent of the software that will be used to implement

Software Engineering Architectural Design 1 Software architecture The design process for identifying the sub-systems making up a system and the framework for sub-system control and communication is architectural

Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing