• Keine Ergebnisse gefunden

8.4 Conditions in ACA rules

9.2.1 Basic Concepts

Objects

The basic building blocks in F-Logic are objects. They have an object name (that can be used in order to address them) and an object identifier (for internal representation). Id-termsare terms composed of function symbols and constants and serve as names of classes, objects and attributes. Here, only function-free id-termsare considered. Following the classic convention in logic programming, constants are denoted by names beginning with a lowercase letter (whereas variable names always start with an upper-case letter). In F-Logic, entities, described viaid-terms, act at the same time asclasses,objects, and methods.

Following the object-oriented paradigm, objects can be organised by declar-ing them bedeclar-ing members of classes, whereas the relationships between objects are realised byattributes.

Atoms and Molecules

In F-Logic, a basic expression consists of ahost object, anattribute name, and a result object, all denoted byid-terms. Such expressions are calleddata-F-atoms.

Data-F-atomsprovide information about objects. It is also possible to collect information about one object in anF-Molecule:

Example 9.1

s u s a n : mother [ h a s C h i l d >> { j o h n , p e t e r }] .

This molecule defines that susan belongs to the class mother and gives a set of objects names (john and peter) that are result objects for the attribute hasChild. This F-molecule makes use of an isa-F-atom (susan : mother), that defines the relationship of an object (susan) to a class (mother). Besides that, there are subclass-F-atoms that define the hierarchical relationships of classes (e.g.mother ::person).

In addition to that there are also P-molecules that allow for the usage of predicate symbols in such a way as in predicate logic: a symbol followed by one

or moreid-terms. The expression peter[hasMother->susan] is equivalent to the P-molecule hasMother(peter,susan).

Attributes and Signatures

Attributes can be either single-valued (like inpeter[hasMother->susan]), denoted by a single-headed arrow "->", or multi-valued, denoted by a double-headed arrow "->>" like in Example 9.1. In order to define which attributes are ap-plicable to which classes (and their instances),signature F-atoms can be used.

For signatures, the"->" and "=>" symbols are used (as with data-F-atoms a single or a double arrowhead indicates functional or multi-valued attributes).

Signature-F-atoms are definitions, in contrast to DL, where restrictions on do-main and range of a property actually are assertions. There are implementations of F-Logic, which give a semantics to thesignature-F-atomssuch that they can be used as constraints. But this is not the case for all F-Logic implementations.

Queries

An F-Logic knowledge base can be queried in a simple way by putting variables in appropriate syntactic positions ofF-atoms. Both schema information associ-ated with classes and the structure of individual objects can be queried in this way.

Queries are given by a conjunction of (possibly negated) P-molecules and F-molecules. The beginning of a query is denoted by "?-", any of theid-terms can be replaced by a variable. For example, consider the following queries:

?− X : mother

?− s u s a n [ h a s C h i l d >> Y ] .

?− s u s a n [ X>>Y ] .

The first query returns (given the programme from Example9.1) the following result:

X/ s u s a n

The second query returns all objects that are related tosusanby the multi-valued attributehasChild(johnandpeter). The last query returns tuples binding attribute names to object names for every multi-valued attribute that can be applied to the objectsusan:

X/ h a s C h i l d Y/ j o h n X/ h a s C h i l d Y/ p e t e r

There is a special kind of variables that can be used in rules that are called don’t-care-variables that begin with an underscore followed by an upper-case letter. They can be used as join variables in the query but are not considered in the answer to that query.

Rules

In contrast to DL, derivation of new facts is not based on assertions but on the use of derivation rules. They consist, like in Datalog, of a rule head and a rule body. The rule body is a query, the rule head (the conclusion) is a conjunction of P-molecules or F-molecules. If the query is true then also the head is true (head :- body). A rule may contain variables, it is then called a non-ground

rule. Variables may occur in both the head and the body of a rule. If these variable bind tuples in the body of a rule, the same tuples are also bound in the head. Hereby, new attributes or additional values to an existing (multi-valued) attribute can be assigned to an object.

X : mother , Y : c h i l d :−

Y [ hasMother >X ] .

For every host object Y that has ahasMother-attribute with a result object X, the rule derives, thatXis amotherandYis achild. For instance, ifsusan,peter are bound to the variablesX,Y, then these variable bindings are available in the rule head, such thatsusan : motherand peter : child can be added to the fact base.

Similarly, the attribute hasChild of an object can be defined by the use of deductive rules instead of an explicit specification:

X [ h a s C h i l d >>Y]

:−

Y [ hasMother >X ] .

This rule expresses that hasChild is the inverse relationship to hasMother, similar to the Example3.7where these relationships are defined in OWL.

9.2.2 Default Inheritance

Besides the logical derivation rules that have already been explained there are also default inheritance atoms, which can be used for the derivation of new facts.

In object-oriented systems there are two different kinds of inheritance: struc-turalandbehavioural. The first defines how signatures can be inherited, in other words, how methods are inherited by subclasses from their superclasses and made available to their instances. The latter (also called value inheritance or result object inheritance) allows to propagate results for methods from a class to its sub-classes. In F-Logic, multiple inheritance is possible.

Example 9.2(Non-monotonic inheritance with penguins)

Consider a knowledge base that defines the class bird. All that is known about birds is that they have feathers and that they can fly. That knowledge is expressed via hasFeather and canFly slots, both filled with the default value true. If we define tweety to be a bird, we automatically conclude that it has feathers and that it can fly. But what, if tweety is a penguin? The knowledge base defines the class penguin as a subclass of bird. It inherits (by structural inheritance) the propertyhasFeatherswith the default value (by behavioural inheritance)true but overwrites the property canFly with the value false. Every instance of the class penguin inherits the default valuetruefor the propertyhasFeathersand the

default value falsefor the propertycanFly. 2

It is possible to make use of bothstructural and (non-monotonic)behavioural inheritance in F-Logic. Consider the following example:

Example 9.3(Non-monotonic behavioural inheritance)

1 abraham : j e w .

2 j e w : : p e r s o n .

3 p e t e r : p e r s o n .

4 p e r s o n [ b e l i e v e s I n∗−>s o m e t h i n g ] .

5 j e w [ b e l i e v e s I n ∗−> j e h o w a ] .

7 ?− X[ b e l i e v e s I n>Y ] .

The default in line 4 makes people typically believe in something and line 5 defines that jews normally believe in jehowa. Line 7 is a query for all host and result objects connected by a believesIn property. 2 The answer to the query from the last example is:

X/ abraham Y/ jehowa X/ p e t e r Y/ s om e t h i n g

The combination of deductive rules and default inheritance for object-oriented database systems has been evaluated in [MK01]. In Section2.5 a formal intro-duction to default logic and its application to an OWL knowledge base has been given.

Some of the rich features of F-Logic have been presented above, many of them are not available in DLs. But there are also features in DLs that have no counterpart in F-Logic.