% Assignment 3
% Student Name: Xiaowei Zhang
% Student ID: z3488247
% Q1
% computes Goals as the list of goal(X, Y, S) which is based on the list of junk(X, Y, S)
trigger([], []).
trigger([junk(X, Y, S) | RestEvents], [goal(X, Y, S) | RestGoals]):-
trigg
Project 2 SQL and PLpgSQL
Due: Sun 17 May, 23:59
1. Aims
This project aims to give you practice in
reading and understanding a moderately large relational schema (MyMyUNSW)
implementing SQL queries and views to satisfy requests for information
implementin
- COMP9311 15s1 Proj 2
- Q1: .
create or replace function Q1(integer) returns text
as
$
select name from People where id = $1 or unswid = $1;
$ language sql
;
- Q2: .
create or replace function Q2(integer)
returns setof NewTranscriptRecord
as $
declare
- COMP9311 15s1 Proj 2
- Q1: .
create or replace function Q1(integer) returns text
as
$
. one SQL statement, possibly using other views defined by you .
$ language sql
;
- Q2: .
create or replace function Q2(integer)
returns setof NewTranscriptRecord
as
Problem of False Positives
False positives in Misra-Gries(MG) algorithm
It identifies all true heavy hitters, but not all reported items are
necessarily heavy hitters.
How can we tell if the non-zero counters correspond to true heavy
hitters or not?
A sec
Assignment 2
Due: Sun 4 Oct, 23:59
Question 1 (3 marks)
Consider the following schema:
DoctorSeesPatient: (doctor, patient)
DoctorWorksAt:(doctor, hospital)
Write relational algebra expressions (you are allowed to use division operator in this
question) t
Note that this is just a suggested solution guideline (we will give you marks or
full marks even if your solution is different than the one here but is
correct).
Question 1
Explanation:
HP stores the hospitals visited by each patient
AH contains all hospi
Note that this is just a suggested solution guideline (we will give you marks or full marks
even if your solution is different than the one here but is correct).
Question 1:
Notes:
1. For simplicity, the total participation constraint is represented with
% Simulates a single agent in the Gridworld where junk appears on each cycle
% at randomly determined locations in the 10x10 grid with probability 0.1
% run a trial of 20 cycles of the BDI interpreter starting with the agent at (0,0)
agent_trial :-
init,
COMP9314 Next Generation Database
Session 1, 2007
Assignment 4
Due Date: 23:59 18 June 2007 (Monday)
DESCRIPTION
Q1 (20 Marks) Describe how the numbers in tier 1, tier 2, and possibly tier N of the succinct XML topology structure described in lecture 12 a
COMP9314 Next Generation Database Session 1, 2007 Assignment 1
Due Date: 23:59 17 Apr 2007 (TUE)
DESCRIPTION
Q1
(40 Marks) Consider ER diagrams in Figures 1 and 2. Each entity/relationship is mapped to a table with the same name. All relationships are of
Assignment 3
(due: 23:59 31th May 2007 (Thu) )
25 marks
Task 1 : code the GK-algorithm in [SIGMOD 01, PSU] (see my lecture notes and
the reference)
Correctness [10marks]
Speed and space [5 marks]: the faster, the better. Smaller the space (i.e.
number of
The Streaming Model
Underlying signal: One-dimensional array A[1N] with values A[i] all initially
zero
Multi-dimensional arrays as well (e.g., row-major)
Signal is implicitly represented via a stream of updates
j-th update is <k, c[j]> implying
A[k] := A[
Frequency Related Problems
Misra-Gries Algorithm (82)
A counter and an ID.
If new item is same as stored ID, increment counter.
Otherwise, decrement the counter.
If counter 0, store new item with count = 1.
If counter > 0, then its item is the only candid
Hash (FM) Sketches for Distinct Value Estimation
[FM85] assume ideal hash functions h(x) (N-wise independence)
In practice
h(x) =
, where a, b are random binary vectors in [0,2^L-1]
Composable: Component-wise OR/add distributed sketches together
Estimate
Basic AMS Sketching Technique [AMS96]
Key Intuition: Use randomized linear projections of f() to define random
variable X such that
E[X] = COUNT(R
X is easily computed over the stream (in small space)
Var[X] is small
A
S)
Basic Idea:
Define a family of 4-
Approximation guarantees
Frequencies underestimated by at most N
No false negatives
False positives have true frequency at least (s)N
How many counters do we need?
Worst case bound: 1/ log N counters
Misra-Gries revisited
Running MG algorithm with k = 1/
IP Network Application: Web Client Performance Monitoring
n Business Challenge: AT&T IP customer wanted to monitor latency observed by
clients to find performance problems
n Previous Approach: Measure latency at active clients that establish network
conne
- Q1: which rooms have a given facility
create or replace function
Q1(text) returns setof FacilityRecord
as $
select longname as room, description as facility
from Rooms, RoomFacilities, Facilities
where Rooms.id = RoomFacilities.room and RoomFacilit
Assignment 1
Due: Sun 6 Sept, 23:59
Question 1 (5 marks)
A tournament committee has hired you to create a small database. They have given you
the following requirements:
! Tournament officials are identified by StaffID, and their names, ages and addresses