Skip to content

Commit

Permalink
Make all co-authors own the paper
Browse files Browse the repository at this point in the history
  • Loading branch information
KinanBab committed May 23, 2023
1 parent e524006 commit 3fb00c1
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 73 deletions.
111 changes: 63 additions & 48 deletions experiments/schema-annot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,107 +215,122 @@ oauth_provider: UNSHARDED
## Hotcrp

```
-----------------------------------------
PaperAuthors: SHARDED
contactId shards to ContactInfo (explicit annotation)
-----------------------------------------
PaperOption: SHARDED
paperId shards to ContactInfo (implicitly deduced)
via PaperOption(paperId) -> Paper(paperId)
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
-----------------------------------------
with a total distance of 3
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
PaperTopic: SHARDED
paperId shards to ContactInfo (explicit annotation)
via PaperTopic(paperId) -> Paper(paperId)
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 3
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
PaperComment: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperComment(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
TopicInterest: SHARDED
contactId shards to ContactInfo (implicitly deduced)
via TopicInterest(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
MailLog: UNSHARDED
[Warning] The column "emailBody" sounds like it may belong to a data subject, but the table is not sharded. You may want to review your annotations.
-----------------------------------------
-----------------------------------------
FilteredDocument: SHARDED
inDocId shards to ContactInfo (explicit annotation)
via FilteredDocument(inDocId) -> DocumentLink(documentId)
via FilteredDocument(paperId) -> Paper(paperId)
via FilteredDocument(leadContactId) -> ContactInfo(contactId)
with a total distance of 3
-----------------------------------------
via DocumentLink(paperId) -> Paper(paperId)
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 4
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
PaperWatch: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperWatch(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
DeletedContactInfo: SHARDED
contactId shards to ContactInfo (explicit annotation)
via DeletedContactInfo(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
DocumentLink: SHARDED
paperId shards to ContactInfo (implicitly deduced)
via DocumentLink(paperId) -> Paper(paperId)
via DocumentLink(leadContactId) -> ContactInfo(contactId)
with a total distance of 2
-----------------------------------------
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 3
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
Capability: SHARDED
contactId shards to ContactInfo (explicit annotation)
via Capability(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
ActionLog: SHARDED
contactId shards to ContactInfo (explicit annotation)
via ActionLog(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
ReviewRequest: DATASUBJECT AND SHARDED
paperId shards to ContactInfo (implicitly deduced)
via ReviewRequest(paperId) -> Paper(paperId)
via ReviewRequest(leadContactId) -> ContactInfo(contactId)
with a total distance of 2
-----------------------------------------
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 3
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
PaperAuthors: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperAuthors(contactId) -> ContactInfo(contactId)
-----------------------------------------
Paper: SHARDED
leadContactId shards to ContactInfo (explicit annotation)
via Paper(leadContactId) -> ContactInfo(contactId)
-----------------------------------------
paperId shards to ContactInfo (explicit annotation)
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 2
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
PaperReview: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperReview(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
ReviewRating: SHARDED
contactId shards to ContactInfo (explicit annotation)
via ReviewRating(contactId) -> ContactInfo(contactId)
-----------------------------------------
PaperConflict: SHARDED
paperId shards to ContactInfo (implicitly deduced)
via PaperConflict(paperId) -> Paper(paperId)
via PaperConflict(leadContactId) -> ContactInfo(contactId)
with a total distance of 2
-----------------------------------------
-----------------------------------------
PaperStorage: UNSHARDED
-----------------------------------------
-----------------------------------------
Formula: SHARDED
createdBy shards to ContactInfo (explicit annotation)
via Formula(createdBy) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
ContactInfo: DATASUBJECT
-----------------------------------------
-----------------------------------------
PaperReviewPreference: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperReviewPreference(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
PaperReviewRefused: SHARDED
contactId shards to ContactInfo (explicit annotation)
via PaperReviewRefused(contactId) -> ContactInfo(contactId)
-----------------------------------------
-----------------------------------------
PaperTag: SHARDED
paperId shards to ContactInfo (implicitly deduced)
via PaperTag(paperId) -> Paper(paperId)
via PaperTag(leadContactId) -> ContactInfo(contactId)
with a total distance of 2
-----------------------------------------
via Paper(paperId) -> PaperAuthors(paperId)
via PaperAuthors(contactId) -> ContactInfo(contactId)
with a total distance of 3
[Info] This table is variably owned (via PaperAuthors)
-----------------------------------------
TopicArea: UNSHARDED
-----------------------------------------
-----------------------------------------
PaperTagAnno: UNSHARDED
-----------------------------------------
PaperTopic: SHARDED
paperId shards to ContactInfo (explicit annotation)
via PaperTopic(paperId) -> Paper(paperId)
via PaperTopic(leadContactId) -> ContactInfo(contactId)
with a total distance of 2
-----------------------------------------
-----------------------------------------
Settings: UNSHARDED
```

Expand Down
53 changes: 28 additions & 25 deletions experiments/schema-annot/annotated/hotcrp-annotated.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- not supported by k9db:
-- not supported by k9db:
-- col types varbinary, blob, varchar
-- multi column primary keys
-- multi column primary keys
-- auto increment
-- default values
-- KEY / UNIQUE KEY
Expand Down Expand Up @@ -90,11 +90,34 @@ CREATE TABLE Paper (
-- KEY shepherdContactId (shepherdContactId),
FOREIGN KEY (paperStorageId) REFERENCES PaperStorage(paperStorageId),
FOREIGN KEY (finalPaperStorageId) REFERENCES PaperStorage(paperStorageId),
FOREIGN KEY (leadContactId) OWNED_BY ContactInfo(contactId),
FOREIGN KEY (leadContactId) REFERENCES ONLY ContactInfo(contactId),
FOREIGN KEY (shepherdContactId) ACCESSED_BY ContactInfo(contactId),
FOREIGN KEY (managerContactId) ACCESSED_BY ContactInfo(contactId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- Added this table to work around issue #172.
-- Extracts co-author conflictType from PaperConflict
CREATE TABLE PaperAuthors (
id int PRIMARY KEY NOT NULL,
paperId int NOT NULL,
contactId int NOT NULL,
FOREIGN KEY (paperId) OWNS Paper(paperId),
FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId)
)

CREATE TABLE PaperConflict (
id int PRIMARY KEY NOT NULL,
paperId int NOT NULL,
contactId int NOT NULL,
conflictType int NOT NULL,
FOREIGN KEY (paperId) ACCESSED_BY Paper(paperId),
-- see issue #172: ownership/edge in data ownership graph dependent on column value of conflictType,
-- which could be co-author, institutional, etc.
FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId),
ON DEL (paperId) DELETE_ROW
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE ActionLog (
logId int NOT NULL,
contactId int NOT NULL,
Expand Down Expand Up @@ -203,26 +226,6 @@ CREATE TABLE PaperComment (
FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE PaperConflict (
id int PRIMARY KEY NOT NULL,
paperId int NOT NULL,
contactId int NOT NULL,
conflictType int NOT NULL,
FOREIGN KEY (paperId) REFERENCES Paper(paperId)
-- see issue #172: ownership/edge in data ownership graph dependent on column value of conflictType,
-- which could be co-author, institutional, etc.
-- FOREIGN KEY (contactId) REFERENCES ContactInfo(contactId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Added this table to work around issue #172. Extracts co-author conflictType from PaperConflict
CREATE TABLE PaperAuthors (
id int PRIMARY KEY NOT NULL,
paperId int NOT NULL,
contactId int NOT NULL,
FOREIGN KEY (paperId) REFERENCES Paper(paperId),
FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId)
)

CREATE TABLE PaperOption (
id int PRIMARY KEY NOT NULL,
paperId int NOT NULL,
Expand Down Expand Up @@ -333,7 +336,7 @@ CREATE TABLE PaperTag (

CREATE TABLE PaperTagAnno (
-- # case-insensitive; see TAG_MAXLEN in init.php
tag text NOT NULL,
tag text NOT NULL,
annoId int NOT NULL,
tagIndex int NOT NULL,
heading text,
Expand Down Expand Up @@ -410,4 +413,4 @@ CREATE TABLE TopicInterest (
FOREIGN KEY (topicId) REFERENCES TopicArea(topicId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

EXPLAIN COMPLIANCE;
EXPLAIN COMPLIANCE;

0 comments on commit 3fb00c1

Please sign in to comment.