Intermediate Aspects - Halpin, Terry; Rugaber, Spencer (Taylor & Francis Group, 2015)
This chapter builds on the basic concepts and syntax of LogiQL considered in the previous chapter and introduces some more advanced features of the language. Although the British monarchy remains the primary domain from which examples and exercises are constructed, we begin to introduce other, more business-oriented domains to demonstrate the breadth of applicability of LogiQL. The first unit considers inverse-functional predicates, which are binary predicates where the first argument is a function of the second argument. The second unit discusses predicates that have more than two arguments and also surveys the various kinds of numeric datatypes available in LogiQL. The next unit covers some constraints that apply to two or more predicate arguments. We then learn how to use subtyping, where a type is contained in a larger type (e.g., Woman is a subtype of Person), as well as some simple subset constraints. The following unit then examines recursion, one of LogiQL’s most powerful features, and discusses constraints that often apply to predicates used in recursive rules. The final unit introduces two of LogiQL’s aggregation functions (count and total), useful for computing properties of a set of facts in the database. The consolidation exercise gives you an opportunity to test your mastery of the new concepts and syntax considered in the chapter.