meteorgan's answers look correct to me, but c) is strange. I don't think there is any reason for the second conjunct in the `and` statement. The first should return all meetings Alyssa needs to attend -- that's the point of the rule. And, indeed, it will, on meteorgan's definition of the rule.
To expand on this, the first clause will filter out all of the times that Alyssa has a meeting; the second clause will make it so that the query will select the department and time of the meeting. At least, that's my understanding- I find the syntax of this query language to be confusing and unintuitive so I definitely could be wrong...
Here's a version that I think should return all of the info about each meeting Alyssa has on Wednesdays:
(and(meeting-time (Alyssa P Hacker)(Wednesday ?time))(meeting . ?meeting-details))
By removing the (or ) clause, your rule will only match both meetings that match the 'whole-company' and '?division' simultaneously, and since 'whole-company' isn't one of the matches for '?division', the query will return no results.
Instead, the (or ) clause allows a match on either meetings that are for 'whole-company' or match '?division', which is the entire, correct list.
In terms of venn-diagrams, the (or ) clause gives us the union of the two sets (meetings with 'whole-company' and meetings with '?division'); while only having an (and ) clause gives us the intersection (empty!) of the same two sets.
djrochford
meteorgan's answers look correct to me, but c) is strange. I don't think there is any reason for the second conjunct in the `and` statement. The first should return all meetings Alyssa needs to attend -- that's the point of the rule. And, indeed, it will, on meteorgan's definition of the rule.
alan
According to the examples in the book,I think that rule's <body> will not be printed.
egbc
To expand on this, the first clause will filter out all of the times that Alyssa has a meeting; the second clause will make it so that the query will select the department and time of the meeting. At least, that's my understanding- I find the syntax of this query language to be confusing and unintuitive so I definitely could be wrong...
Here's a version that I think should return all of the info about each meeting Alyssa has on Wednesdays:
(and (meeting-time (Alyssa P Hacker) (Wednesday ?time)) (meeting . ?meeting-details))
donald
aos
I'm not sure these are right. The rule states:
"...person’s meetings include all whole-company meetings plus all meetings of that person’s division"
We want ALL meetings, not either "whole-company" meetings or "division" meetings. By removing the or, we get:
(rule (meeting-time ?person ?day-and-time) (and (meeting whole-company ?day-and-time) (job ?person (?division . ?r)) (meeting ?division ?day-and-time)))
carpdiem
By removing the (or ) clause, your rule will only match both meetings that match the 'whole-company' and '?division' simultaneously, and since 'whole-company' isn't one of the matches for '?division', the query will return no results.
Instead, the (or ) clause allows a match on either meetings that are for 'whole-company' or match '?division', which is the entire, correct list.
In terms of venn-diagrams, the (or ) clause gives us the union of the two sets (meetings with 'whole-company' and meetings with '?division'); while only having an (and ) clause gives us the intersection (empty!) of the same two sets.