From: Ian Horrocks ([email protected])
Date: 07/03/02
On June 25, Richard Fikes writes: > Here are a couple of query examples for today's discussion. These > examples are intended to be illustrative of aspects of the current > design of DQL rather than being illustrative of typical query-answering > cases. > > The first example illustrates answers that contain bindings for only > some of the "may bind" variables in cases where an answer is inferable > (from a min-cardinalityQ restriction in the example) and where an answer > is an anonymous node. > > KB0: > > * Class "Red-Car". > > * Class "Red-Car-Owner" with a min-cardinalityQ restriction of 1 and > hasClassQ "Red-Car" on property "has-car" (i.e., every Red-Car-Owner has > at least one car that is a Red-Car). > > * (type RC1 Red-Car) > > * (has-car Bill RC1) > > * (type Joe Red-Car-Owner) > > * (has-car Fred _:r) > > * (type _:r Red-Car) > > QUERY-01: > > query pattern: (has-car ?p ?c) (type ?c Red-Car) > must bind: ?p ?c > answer KB: KB0 > > One answer: {[?p/Bill], [?c/RC1]} > > QUERY-02: > > query pattern: (has-car ?p ?c) (type ?c Red-Car) > may bind: ?p ?c > answer KB: KB0 > > Three answers: {[?p/Bill], [?c/RC1]}, {[?p/Joe]}, and {[?p/Fred]} > > QUERY-03: > > query pattern: (has-car ?p ?c) (type ?c Red-Car) > may bind: ?p > don't bind: ?c > answer KB: KB0 > > Three answers: {[?p/Bill]}, {[?p/Joe]}, and {[?p/Fred]} > > ------------------------------------ > > This is an example of an answer being inferable from the existence of an > instance of a class and a cardinality restriction. > > KB1: > > * Class "Country". > > * Class "Person" with a cardinality restriction of 1 and a valueType > restriction of "Country" on property "country-of-birth" (i.e., every > person has exactly one country-of-birth and a person's country-of-birth > is a Country). > > * (type Bill Person) > > QUERY-11: > > query pattern: (type ?x Country) > must bind: ?x > answer KB: KB1 > > No answers. > > QUERY-12: > > query pattern: (type ?x Country) > may bind: ?x > answer KB: KB1 > > Query has one answer. The answer has an empty set of bindings. The > answer corresponds to a proof that since there is a person and that > person has a "country-of-birth" that is a Country, then there exists a > Country (i.e., an ?x such that ?x is type Country). > > QUERY-13: > > query pattern: (type ?x Country) > don't bind: ?x > answer KB: KB1 > > Query has one answer. The answer has an empty set of bindings. As with > QUERY-2, the answer corresponds to a proof that since there is a person > and that person has a "country-of-birth" that is a Country, then there > exists a Country (i.e., an ?x such that ?x is type Country). All seems pretty clear to me. Presumably I can say that the answer set for QUERY-12 is {{}}, i.e., one answer, it being the empty set of bindings. From a theoretical point of view there seems to be a slight difference w.r.t. QUERY-13 which, as there are no distinguished variables, is a boolean query, and would be expected to return True or False. For practical purposes, however, we can treat {{}} as True. We obviously have to be careful to distinguish this from {}, the empty set of answers (False for a boolean query). Ian
This archive was generated by hypermail 2.1.4 : 07/04/02 EDT