- URIs are big, variable-length keys
- translate them into an internal id
- "uri" is NULL <=> resource is anonymous
CREATE TABLE uri (
id INT AUTO_INCREMENT PRIMARY KEY, # PRIMARY = UNIQUE and NOT NULL
uri BLOB, # BLOB is also called LONGVARBINARY
UNIQUE KEY uri (uri(64)) # length is just a tuning knob
);
INSERT INTO uri (uri) VALUES ('http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
INSERT INTO uri (uri) VALUES ('http://www.w3.org/2000/10/swap/test/demo1/biology#Human');
INSERT INTO uri (uri) VALUES ('http://www.w3.org/2000/10/swap/test/demo1/biology#Dog');
INSERT INTO uri (uri) VALUES ('http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#name');
INSERT INTO uri (uri) VALUES ('http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#pet');
INSERT INTO uri (uri) VALUES ('http://www.w3.org/2000/10/swap/test/demo1/about-pat#pat');
INSERT INTO uri (uri) VALUES (NULL); # this is rover, who has no URI
mysql> select * from uri;
+----+--------------------------------------------------------------+
| id | uri |
+----+--------------------------------------------------------------+
| 1 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type |
| 2 | http://www.w3.org/2000/10/swap/test/demo1/biology#Human |
| 3 | http://www.w3.org/2000/10/swap/test/demo1/biology#Dog |
| 4 | http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#name |
| 5 | http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#pet |
| 6 | http://www.w3.org/2000/10/swap/test/demo1/about-pat#pat |
| 7 | NULL |
+----+--------------------------------------------------------------+