{"author": {"columns": [[0, "aid", "INT", 0, null, 1], [1, "homepage", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "oid", "INT", 0, null, 0]], "primary_keys": ["aid"], "foreign_keys": [], "unique_constraints": [[[0, 0, "aid"]]], "check_constraints": []}, "conference": {"columns": [[0, "cid", "INT", 0, null, 1], [1, "homepage", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0]], "primary_keys": ["cid"], "foreign_keys": [], "unique_constraints": [[[0, 0, "cid"]]], "check_constraints": []}, "domain": {"columns": [[0, "did", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0]], "primary_keys": ["did"], "foreign_keys": [], "unique_constraints": [[[0, 0, "did"]]], "check_constraints": []}, "domain_author": {"columns": [[0, "aid", "INT", 0, null, 2], [1, "did", "INT", 0, null, 1]], "primary_keys": ["aid", "did"], "foreign_keys": [[0, 0, "domain", "did", "did", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "author", "aid", "aid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "did"], [1, 0, "aid"]]], "check_constraints": []}, "domain_conference": {"columns": [[0, "cid", "INT", 0, null, 2], [1, "did", "INT", 0, null, 1]], "primary_keys": ["cid", "did"], "foreign_keys": [[0, 0, "domain", "did", "did", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "conference", "cid", "cid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "did"], [1, 0, "cid"]]], "check_constraints": []}, "journal": {"columns": [[0, "homepage", "TEXT", 0, null, 0], [1, "jid", "INT", 0, null, 1], [2, "name", "TEXT", 0, null, 0]], "primary_keys": ["jid"], "foreign_keys": [], "unique_constraints": [[[0, 1, "jid"]]], "check_constraints": []}, "domain_journal": {"columns": [[0, "did", "INT", 0, null, 1], [1, "jid", "INT", 0, null, 2]], "primary_keys": ["did", "jid"], "foreign_keys": [[0, 0, "domain", "did", "did", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "journal", "jid", "jid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "did"], [1, 1, "jid"]]], "check_constraints": []}, "keyword": {"columns": [[0, "keyword", "TEXT", 0, null, 0], [1, "kid", "INT", 0, null, 1]], "primary_keys": ["kid"], "foreign_keys": [], "unique_constraints": [[[0, 1, "kid"]]], "check_constraints": []}, "domain_keyword": {"columns": [[0, "did", "INT", 0, null, 1], [1, "kid", "INT", 0, null, 2]], "primary_keys": ["did", "kid"], "foreign_keys": [[0, 0, "domain", "did", "did", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "keyword", "kid", "kid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "did"], [1, 1, "kid"]]], "check_constraints": []}, "publication": {"columns": [[0, "abstract", "TEXT", 0, null, 0], [1, "cid", "TEXT", 0, null, 0], [2, "citation_num", "INT", 0, null, 0], [3, "jid", "INT", 0, null, 0], [4, "pid", "INT", 0, null, 1], [5, "reference_num", "INT", 0, null, 0], [6, "title", "TEXT", 0, null, 0], [7, "year", "INT", 0, null, 0]], "primary_keys": ["pid"], "foreign_keys": [[0, 0, "conference", "cid", "cid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "journal", "jid", "jid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 4, "pid"]]], "check_constraints": []}, "domain_publication": {"columns": [[0, "did", "INT", 0, null, 1], [1, "pid", "INT", 0, null, 2]], "primary_keys": ["did", "pid"], "foreign_keys": [[0, 0, "domain", "did", "did", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "publication", "pid", "pid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "did"], [1, 1, "pid"]]], "check_constraints": []}, "organization": {"columns": [[0, "continent", "TEXT", 0, null, 0], [1, "homepage", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "oid", "INT", 0, null, 1]], "primary_keys": ["oid"], "foreign_keys": [], "unique_constraints": [[[0, 3, "oid"]]], "check_constraints": []}, "publication_keyword": {"columns": [[0, "pid", "INT", 0, null, 2], [1, "kid", "INT", 0, null, 1]], "primary_keys": ["pid", "kid"], "foreign_keys": [[0, 0, "keyword", "kid", "kid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "publication", "pid", "pid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "kid"], [1, 0, "pid"]]], "check_constraints": []}, "writes": {"columns": [[0, "aid", "INT", 0, null, 1], [1, "pid", "INT", 0, null, 2]], "primary_keys": ["aid", "pid"], "foreign_keys": [[0, 0, "author", "aid", "aid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "publication", "pid", "pid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "aid"], [1, 1, "pid"]]], "check_constraints": []}, "cite": {"columns": [[0, "cited", "INT", 0, null, 0], [1, "citing", "INT", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "publication", "citing", "pid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "publication", "cited", "pid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE author (
    aid INT   PRIMARY KEY,
    homepage TEXT,
    name TEXT,
    oid INT,
    UNIQUE (aid)
);

CREATE TABLE conference (
    cid INT   PRIMARY KEY,
    homepage TEXT,
    name TEXT,
    UNIQUE (cid)
);

CREATE TABLE domain (
    did INT   PRIMARY KEY,
    name TEXT,
    UNIQUE (did)
);

CREATE TABLE domain_author (
    aid INT   PRIMARY KEY,
    did INT   PRIMARY KEY,
    PRIMARY KEY (aid, did),
    UNIQUE (did, aid),
    FOREIGN KEY (did) REFERENCES domain(did),
    FOREIGN KEY (aid) REFERENCES author(aid)
);

CREATE TABLE domain_conference (
    cid INT   PRIMARY KEY,
    did INT   PRIMARY KEY,
    PRIMARY KEY (cid, did),
    UNIQUE (did, cid),
    FOREIGN KEY (did) REFERENCES domain(did),
    FOREIGN KEY (cid) REFERENCES conference(cid)
);

CREATE TABLE journal (
    homepage TEXT,
    jid INT   PRIMARY KEY,
    name TEXT,
    UNIQUE (jid)
);

CREATE TABLE domain_journal (
    did INT   PRIMARY KEY,
    jid INT   PRIMARY KEY,
    PRIMARY KEY (did, jid),
    UNIQUE (did, jid),
    FOREIGN KEY (did) REFERENCES domain(did),
    FOREIGN KEY (jid) REFERENCES journal(jid)
);

CREATE TABLE keyword (
    keyword TEXT,
    kid INT   PRIMARY KEY,
    UNIQUE (kid)
);

CREATE TABLE domain_keyword (
    did INT   PRIMARY KEY,
    kid INT   PRIMARY KEY,
    PRIMARY KEY (did, kid),
    UNIQUE (did, kid),
    FOREIGN KEY (did) REFERENCES domain(did),
    FOREIGN KEY (kid) REFERENCES keyword(kid)
);

CREATE TABLE publication (
    abstract TEXT,
    cid TEXT,
    citation_num INT,
    jid INT,
    pid INT   PRIMARY KEY,
    reference_num INT,
    title TEXT,
    year INT,
    UNIQUE (pid),
    FOREIGN KEY (cid) REFERENCES conference(cid),
    FOREIGN KEY (jid) REFERENCES journal(jid)
);

CREATE TABLE domain_publication (
    did INT   PRIMARY KEY,
    pid INT   PRIMARY KEY,
    PRIMARY KEY (did, pid),
    UNIQUE (did, pid),
    FOREIGN KEY (did) REFERENCES domain(did),
    FOREIGN KEY (pid) REFERENCES publication(pid)
);

CREATE TABLE organization (
    continent TEXT,
    homepage TEXT,
    name TEXT,
    oid INT   PRIMARY KEY,
    UNIQUE (oid)
);

CREATE TABLE publication_keyword (
    pid INT   PRIMARY KEY,
    kid INT   PRIMARY KEY,
    PRIMARY KEY (pid, kid),
    UNIQUE (kid, pid),
    FOREIGN KEY (kid) REFERENCES keyword(kid),
    FOREIGN KEY (pid) REFERENCES publication(pid)
);

CREATE TABLE writes (
    aid INT   PRIMARY KEY,
    pid INT   PRIMARY KEY,
    PRIMARY KEY (aid, pid),
    UNIQUE (aid, pid),
    FOREIGN KEY (aid) REFERENCES author(aid),
    FOREIGN KEY (pid) REFERENCES publication(pid)
);

CREATE TABLE cite (
    cited INT,
    citing INT,
    FOREIGN KEY (citing) REFERENCES publication(pid),
    FOREIGN KEY (cited) REFERENCES publication(pid)
);