2 Ontologies in F -logic - Springer Link

1 downloads 0 Views 2MB Size Report
resulting in the ontology based configuration tool OnKo developed for the. German Telecom. 2.1 Introduction. Conceptual (or Ontology) modelling deals with the ...
2 Ontologies in F -logic ]ürgen Angele l and Georg Lausen 2 IOntoprise GmbH Amalienbadstraße 36 D-76227 Karlsruhe [email protected] Freiburg D-79098 Freiburg [email protected]

2Universität

Summary. F-Iogic ("F" stands for "Frames") combines the advantages of conceptual high-level approaches typical for frame-based languages and the expressiveness, the compact syntax, and the weil defined semantics from logics. The salient features of F-logic include signatures, object identity, complex objects, methods, classes, inheritance and rules. We give an overview of the syntax and the intuitive semantics of F-logic. We discuss the semantics behind and the different ways how F-logic has been implemented. The language primitives are further demonstrated by discussing areal world application resulting in the ontology based configuration tool OnKo developed for the German Telecom.

2.1 Introduction Conceptual (or Ontology) modelling deals with the question ofhow to describe in a declarative and abstract way the domain information of an application, its relevant vocabulary, and how to constrain the use of the data, by understanding what can be drawn from it. Corresponding abstract representation languages support the understanding of such descriptions, their rapid development, their maintenance and their reuse. Conceptual modelling has a long history in the area of database systems, starting with the EntitylRelationship(ER) model [Che76]. Entitytypes represent sets of homogeneous entities by specifying attributes and their range. Entitytypes are instantiated by concrete entities with individual values for the attributes. S. Staab et al. (eds.), Handbook on Ontologies © Springer-Verlag Berlin Heidelberg 2004

30

Jürgen Angele and Georg Lausen

Relationshiptypes specify the domain and range of relations between entities. Relationshiptypes are instantiated by concrete relations between entities. By this way a simple schema (or ontology) for a relational databases may be given. Later on, this restricted set of concepts has been extended to the EER model (Extended Entity Relationship) [RES94] by adding modelling primitives like specialisation, grouping etc. in a similar way to modelling languages like UML and ODMG which have been developed for object-oriented models in the context of software engineering. From the beginning, for database systems languages have been developed which allow to express complex relationships (constraints) between entities/objects and to query the database. For efficiency reasons traditional database query languages (relational algebra and calculus, SQL) have a rather limited expressiveness. However, when database systems approached knowledgebased applications, rule-base languages became attractive. Datalog [AHV95] is the most famous language paradigm in this context. Datalog has a modeltheoretic semantics and introduced general recursion while still allowing powerful optimization techniques. However, Datalog is a logical rule language without function symbols and restricted negation and thus still has a limited expressive power. In particular, when object-oriented database systems became popular, function symbols became mandatory because of their ability to give object identities a logical semantics. From a logical point of view, these languages are variants ofHom-Logics with function symbols and negation in the rule bodies. In this paper we will elaborate on F-Iogic [KLW95], which accounts in a clean and declarative fashion for most of the structural aspects of framebased and object-oriented languages. A general overview of languages in this context is given in [L99]. Similar languages have also been introduced for semistructured, respective XML-databases (e.g. [GPQ97], [MOl]). F-Iogic ("F" stands for "Frames") combines the advantages of the conceptual high-level approach typical for frame-based languages and the expressiveness, the compact syntax, and the weil defined semantics from logics. The original features of F-Iogic [KLW95] include signatures, object identity, complex objects, methods, classes and inheritance. Implementations of F-Iogic (Florid [LHL98], Ontobroker [DEFS99], Flora [YKOO]) introduced extensions and restrictions of the original features to make F-Iogic a powerful and efficient language for the respective intended application domain. In this paper we will look on F-Iogic as a language for ontology applications. In the following we first give an overview of the syntax and the intuitive semantics of F-Iogic by concentrating on examples which allow the presentation ofthe various concepts in a concise way. It follows a discussion ofthe semantics and the different ways how F-Iogic has been implemented. Finally we present an example of an ontology application based on F-Iogic. This example is based on OntoBroker™, an implementation ofF-logic specific for the ontology domain.

2 Ontologies in F-logic

31

2.2 F-Iogic by Examples Now we are going to give an introduction into F-Iogic by examples, which will introduce the various syntax elements and their intuitive semanties. F-Iogic's syntax in its original form has been extended to comply to the specific needs of its practical applications. 2.2.1 A Simple Ontology-based Application

F-Iogic allows to describe ontologies, i.e. classes of objects, hierarchies of classes, their attributes and relationships between classes in an object-oriented style (cf. [FHK97]). /* ontology */ woman: :person. man: :person. person[father=>man ). person[ mother=>woman). person[ daughter=> >woman ]. person[ son=> >man].

/* rules consisting of a rule head and a rule body */ FORALL X,Y X[son-»Y) X]. FORALL X,Y X[son-»Y] X). FORALL X,Y X[daughter-»Y) X). FORALL X,Y X[daughter-»Y) X).

1* facts */ abraham:man. sarah:woman. isaac:man[father->abraham; mother->sarah). ishmael :man[ father->abraham; mother->hagar:woman). jacob:man[father->isaac; mother->rebekah:woman). esau:man[ father->isaac: mother->rebekah].

/* query */ FORALL X,V abraham]].

(1)

The first part of this example consists of a very simple and small ontology. It is stated that every woman is aperson, every man is aperson. For a person the attributes father, mother, daughter together with their respective ranges are given. The following set of rules states what else can be derived from the ontology. The first rule describes that if X is the father of Y and Y is a man, then Y is the son of X. A similar relationship holds for sons and mothers, for daughters and fathers and daughters and mothers. The given set of facts instantiates the concepts

32

Jürgen Angele and Georg Lausen

introduced so far. They indicate that some people belong to the c1asses man and woman, respectively, and give information about the father and mother relationships among them. According to the object-oriented paradigm, relationships between objects are modelled by method applications, e.g., applying the method father to the object isaac yie1ds the result object abraham. All these facts may be considered as the extensional database of the F-Iogic program. Hence, they form the basis of an object base which still has to be completed by some c10sure properties, e.g. inheritance. The rules derive new information from the given object base. By evaluating the set of rules, new relationships between the objects, denoted by the methods son and daughter, are added to the object base as intensional information. The final part of Example 1 contains a query to the object base. The query shows the ability ofF-logic to nest method applications. It asks for all women and their sons, whose father is Abraham. The same query could be written as a conjunction of atomic expressions: FORALL X,Y abraham].

Methods may either be single-valued (-», i.e. can have one value only or they may be multi-valued (-»), i.e. can have more values. If more values are given for multi-valued attributes the values must be enclosed in curly brackets:

2.2.2 Objects and Their Properties As we have already seen in Example 1 objects are the basic constructs ofF-logic. Objects model real world entities and are intemally represented by object identifiers which are independent of their properties. According to the principles of object-oriented systems these object identifiers are invisible to the user. To access an object directly the user has to know its object name. Every object name refers to exactly one object. Following the object-oriented paradigm, objects may be organized in c1asses. Furthermore, methods represent relationships between objects. Such information about objects is expressed by F-atoms.

2.2.2.1 Object Names and Variable Names Object names and variable names are also called id-terms and are the basic syntactical elements ofF-logic. To distinguish object names from variable names, the later are always dec1ared using logical quantifiers FORALL and EXISTS. Object names start with a lower case letter while, as usual, variables are indicated by a capital first letter. Examples of object names are abraham, man, daughter, of variable names X, or Method. There are two special types of object names that carry additional information: integers and strings. Every positive or negative integer may be used as an object name, e.g., +3, 3, -3, as well as every string enc10sed by quotation marks Itlt. Comp/ex id-terms may be created from

2 Ontologies in F-logic

33

function symbols and other id-terms, e.g., couple(abraham, sarah), feX). An idterm that contains no variable is called a ground id-term. 2.2.2.2 Methods

In F-Iogic, the application of a method to an object is expressed by data-F-atoms which consist of a host object, a method and a result object, all denoted by idterms. Any object may appear in any of these locations: host object, result position, or method position. Thus, in our Example 1 the method names father and son are object names just like isaac and abraham. Variables mayaiso be used be used at all positions of a data-F-atom, which allows queries about method names like FORALL X,Y >issachar; son@(Ieah, I 0 )->>zebulun; son@(rachel, I 1)->>j oseph; son@(rachel, 12 )-> >benj amin ].

(3)

In Examples 2 and 3 the method son is used with a different number of parameters. This so-called overloading is supported by F-Iogic. Given the object base described in Example 1, asking for the sons of Isaac FORALL X {jacob, esau}]. >j acob ]. abraham: son-> > {jacob,esau} ].

(5)

This F-molecule may be split into an equivalent set of several F-atoms: isaac:man. isaac[ father ->abraham]. isaac[ son->>j acob ]. isaac [son-»esau ].

For F-molecules containing a multi-valued method, the set of result objects can be split into singleton sets (recall that our semantics is multivalued, not setvalued). For singleton sets, it is allowed to omit the curly braces enclosing the result set, so that the three subsequent sets are equivalent, which means that they represent the same object base: isaac[ son-» {jacob,esau}].

(6)

isaac[ son-» {jacob}]. isaac[ son-» {esau) ].

(7)

isaac[ son-»jacob]. isaac [son->>esau].

(8)

2.2.2.5 Signatur es Signature-F-atoms define which methods are applicable for the instances of certain classes. In particular, a signature-F-atom declares a method on a class and gives type restrictions for parameters and results. These restrictions may be viewed as typing constraints. Signature-F-atoms together with the class hierarchy form the schema of an F-logic database. To distinguish signature-F-atoms from data-F-atoms, the arrow body consists of a double line instead of a single line. Here are some examples for signature-F-atoms: person[ father=>man]. person[ daughter=> >woman ]. man[son@(woman)=»man].

The first one states that the single-valued method father is defined for members of the class person and the corresponding result object has to belong to the class man. The second one defines the multi-valued method daughter for members of the class person restricting the result objects to the class woman. Finally, the third

36

Jürgen Angele and Georg Lausen

signature-F-atom allows the application ofthe multi-valued method son to objects belonging to the class man with parameter objects that are members of the class woman. The result objects ofsuch method applications have to be instances ofthe class man. By using a list of result classes enclosed by parentheses, several signature-F-atoms may be combined in an F-molecule. This is equivalent to the conjunction of the atoms: the result of the method is required to be in all of those classes: person[ father=> {man, person}].

(9)

person[ father=>man]. person[ father=>person].

(10)

Both expressions in the Examples 9 and 10 are equivalent and express that the result objects of the method father if applied to an instance of the class person have to belong to both classes man and person. F-Iogic supports method overloading. This means that methods denoted by the same object name may be applied to instances of different classes. Methods may even be overloaded according to their arity, i.e., number of parameters. For example, the method son applicable to instances of the class man is used as a method with one parameter in Example 11 and as a method with two parameters in Example 12. The corresponding signature-F-atoms look like this: man[son@(woman)=»man].

(11)

man[son@(woman,integer)=»man].

(12)

Of course, the result of a signature needs not to be enclosed in parentheses, if it consists of just one object. As already shown in Example 5, properties of an object may be collected into a single, complex F-molecule instead of several F-atoms. For that purpose, a class membership or subclass relationship may follow after the host object. Then, a list of method applications (with or without parameters) separated by semicolons, may be given. If a method yields more than one result, those can be collected in curly braces, separated by commas; if a signature contains more than one class, those can be collected in parentheses, also separated by commas: isaac[ father->abraham; mother->sarah]. jacob:man[father->isaac; son@(rachel)-»{joseph, benjamin}]. man::person[son@(woman)=»{man, person}].

(13)

This means that the range of the son method is the conjunction of man and person, i.e. values of this method must belong to class man and class person. The following set ofF-atoms is equivalent to the F-molecules above: isaac[ father->abraham]. isaac[ mother->sarah].

2 Ontologies in F-logic jacob:man. jacob[ father->isaac). jacob[son@(rachel)-»joseph). jacob[son@(rachel)-»benjamin). man::person. man[son@(woman)=» man). man[ son@(woman)=»person ).

37

(14)

Besides collecting the properties of the host object, the properties of other objects appearing in an F-molecule, e.g., method applications, may be inserted, too. Thus, a molecule may not only represent the properties of one single object but can also include nested information about different objects, even recursively: isaac[ father->abraham:man[ son@(hagar:woman)-»ishmae1); mother->sarah:woman ]. jacob:(man::person). jacob[(father:method)->isaac).

(15)

The equivalent set ofF-atoms is: isaac[ father->abraham). abraham:man. abraham[ son@(hagar)-»ishmael). hagar:woman. isaac[mother-»sarah]. sarah:woman. man: :person. jacob:man. jacob[ father->isaac). father:method.

F-logic molecules are evaluated from left to right. Thus, nested properties have to be included in parentheses if those properties belong to a method object (cf. Section 7), class object or superclass object. Note the difference between the following two F-molecules. The first one states that Isaac is a man and Isaac believes in god, whereas the second one says that Isaac is a man and that the object man believes in god (which is probably not the intended meaning). isaac:man[believesin-»god]. isaac:(man[believesin-»god]).

2.2.2.6 F-molecules Without any Properties Ifwe want to represent an object without giving any properties, we have to attach an empty method-specification list to the object name, e.g. thing[].

38

Jürgen Angele and Georg Lausen

If we use an expression like this that consists solely of an object name as a moleeule, it is treated as a O-ary predicate symbol (see next section). 2.2.2.7 Predicate Symbols In F-Iogic, predicate symbols are used in the same way as in predicate logic, e.g., in Datalog, thus preserving upward-compatibility from Datalog to F-logic. A predicate symbol followed by one or more id-terms separated by commas and included in parentheses is called a P-atom to distinguish it from F-atoms. Example 16 shows some P-atoms. The last P-atom consists solely of a O-ary predicate symbol, where parentheses are ommitted. married(isaac,rebekah). maleUacob). sonof( isaac,rebekah,jacob). true.

(16)

Information expressed by P-atoms can usually also be represented by F-atoms, thus obtaining a more natural style of modelling. For example, the information given in the first three P- atoms can also be expressed as folIows: isaac[ marriedto->>rebekah]. jacob:man. isaac[son@(rebekah)-»jacob].

(17)

Similar to F-molecules, P-molecules may be built by nesting F-atoms or Fmoleeules into P-atoms. The P-molecule married(isaac[father->abraham], rebekah:woman).

is equivalent to the following set ofP-atoms and F-atoms: married( isaac,rebekah). isaac[father->abraham]. rebekah:woman.

Note, that only F-atoms and F-molecules may be nested into P-atoms, but not vice versa.

2 Ontologies in F-logic

39

2.2.3 Built-in Features

2.2.3.1 Built-in Operations As an extension to the original F-logic, Florid[LHL98] and OntoBroker™ provide a large amount of built-ins. These include built-ins to compare strings and numbers, arithmetic built-ins and String built-ins. More complex built-ins in Ontobroker provide solving linear equations, vector arithmetics, matrix operations or regular expressions. Example 18 shows some examples. FORALL X,A,B,C,ZI,Z2,Z3 finance#Person; finance#location =» finance#City]. finance#Person[cars#name => STRING: finance#monthlylncome => NUMBER]. FORALL X,Y Y[finance#hasBank -» X] 32]. #myBank:finance#Bank[finance#location -» karlsruhe].

(24)

The semanties of a namespaee-qualified objeet is always a pair of strings, i.e. eaeh objeet is represented by a URI (its namespaee) and a loeal name. Thus finance#Person and cars#Person beeome clearly distinguishable. During parsing of the F-Iogie program the aliases are resolved, sueh that the following pairs are eonstrueted. • finance#Person stands for (.. www.financeWorld.tv ... Person) • cars#Person stands for (..www.cars-r-us.tv... Person)

In ease no declared namespaee URI is found for a used alias, the alias itself is assumed to represent the namespaee of an F-logie objeet. Beeause pure URIs eonfliet with the F-logie grammar, literal namespaees, i.e. URIs, must be quoted, e.g. •

.. www.cars-r-us.tv..#Person is equivalent to cars#Person

Note, that declared namespaee URIs are taken literally, i.e. two URIs are equivalent only if they syntaetieally do not differ, e.g. www.cars-r-us.tvis not equivalent to http://www.cars-r-us.tv.

44

Jürgen Angele and Georg Lausen

2.2.6.3 Querying for Namespaees This mechanism enables users even to query for namespaces (URIs not aliases) and to provide variables in namespaces. For instance, the following query asks for all namespaces X that contain a concept "Person". FORALL X