Exploiting ASP for Semantic Information Extraction 251
by an easy-to-use visual environment, enriched by a full graphic query interface a` la QBE.
Classes can be declared in DLV+ by using the keyword class followed by the class name and by a comma separated list of attributes. Each attribute is a couple (attribute-name:attribute-type).
The attribute-type is either a user-defined class name, or a built-in class name (in order to deal with concrete data types, DLP+ features two built-in classes string and integer). For instance, the class faculty with an argument of type string can be declared as follows:
class faculty(name:string).
Objects, that is class instances, are declared by asserting new facts. An instance for the class faculty, can be declared as follows:
#01:faculty(name:"Faculty of Science").
Here, the string “Faculty of science” values the attribute name; while #01 is the object-identifier (oid) of this instance (each instance is equipped by a unique oid).
The possibility to specify user-defined classes as attribute types allows for complex objects, i.e. objects made of other objects. The following declaration of class person includes, besides name and age, two attributes of type person, namely, father and partner.
class person(name:string,age:integer,father:person,partner:person).
Note that this declaration is “recursive” (father and partner are of type person). A couple of partners can be specified as follows:
#2:person(name:"Max", age:30, father:person(name:"Peter"),partner:#3). #3:person(name:"Mary", age:28, father:#6, partner:#2).
Note that “Max” (identified by #02) is “Mary’s” partner and vice versa (“Mary” is identified by #03). Moreover, arguments are identified by name, allowing for an easier way to access attributes. Instance arguments can be valued both by specifying object identifiers and by using a nested class predicate (complex term) which works like a function (e.g., Max’s father is specified by a complex term above).
Classes can be organized in a taxonomy by using the isa relation. For example, the following student class extends the person class by two new attributes, code and enrol.
class student isa {person} (code:string,enrol:faculty). Instances of the class student are declared as usual, by asserting new facts.
#6:student(name:"John",age:20,father:#7,partner:#7,code:0, enrol:#1). #7:student(name:"Alice",age:20,father:#7,partner:#6,code:1, enrol:#1).
Like in common object-oriented languages with inheritance, each instance of a subclass becomes, automatically, an instance of all super classes (isa relation induces an inclusion relation between classes). Moreover, sub-classes inherit attributes from all super-classes.
The language provides a built-in most general class named Object that is the class of all individuals and is a superclass of all DLP+ classes.
Also multiple inheritance is supported. For example, class student-employee, declared next, inherits from both class student and class employee.