W3C home > Mailing lists > Public > public-rdb2rdf-comments@w3.org > October 2011

Small typographical mistake

From: Fabian Pijcke <fabian.pijcke@gmail.com>
Date: Mon, 10 Oct 2011 17:17:19 +0200
Message-ID: <CALebJyGHyU3C_gfVWVX2jV97gLqOfHgARH6BTu8Aq4M_e33+OA@mail.gmail.com>
To: public-rdb2rdf-comments@w3.org
Dear list,

In section 2.2 of "A direct mapping of relational data to RDF", the
following snippet of code can't be executed because "Department" is
mispelled:

CREATE TABLE Addresses (
	ID INT,
	city CHAR(10),
	state CHAR(2),
	PRIMARY KEY(ID)
)

CREATE TABLE Deparment (
	ID INT,
	name CHAR(10),
	city CHAR(10),
	manager INT,
	PRIMARY KEY(ID),
	UNIQUE (name, city),
	FOREIGN KEY(manager) REFERENCES People(ID)
)

CREATE TABLE People (
	ID INT,
	fname CHAR(10),
	addr INT,
	deptName CHAR(10),
	deptCity CHAR(10),
	PRIMARY KEY(ID),
	FOREIGN KEY(addr) REFERENCES Addresses(ID),
	FOREIGN KEY(deptName, deptCity) REFERENCES Department(name, city)
)

In addition, the two last tables uses "cross" foreign keys (Department
points to People, and People points to Department)

This is embarassing because one can't just copy and paste the SQL code to
make some experiments (which is what I want to do), I propose the following
code to replace it:

CREATE TABLE Addresses (
	ID INT,
	city CHAR(10),
	state CHAR(2),
	PRIMARY KEY(ID)
);

CREATE TABLE Department (
	ID INT,
	name CHAR(10),
	city CHAR(10),
	manager INT,
	PRIMARY KEY(ID),
	UNIQUE (name, city)
	-- , FOREIGN KEY(manager) REFERENCES People(ID) -- [added below]
);

CREATE TABLE People (
	ID INT,
	fname CHAR(10),
	addr INT,
	deptName CHAR(10),
	deptCity CHAR(10),
	PRIMARY KEY(ID),
	FOREIGN KEY(addr) REFERENCES Addresses(ID),
	FOREIGN KEY(deptName, deptCity) REFERENCES Department(name, city)
);

ALTER TABLE Department ADD FOREIGN KEY(manager) REFERENCES People(ID);

I hope this may help ...

Fabian Pijcke
Received on Monday, 10 October 2011 15:17:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 10 October 2011 15:17:52 GMT