Skip to content

Commit

Permalink
Rules added
Browse files Browse the repository at this point in the history
  • Loading branch information
vakker committed Sep 8, 2020
1 parent 759beda commit 63364d1
Show file tree
Hide file tree
Showing 5 changed files with 427 additions and 0 deletions.
57 changes: 57 additions & 0 deletions rules/cora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
sql_addr: "mysql+pymysql://vince:asdqwe@localhost:3306/"
sql_db: "CORA"
tables:
paper:
pred_map: paper
cols:
paper_id: paper_
class_label: ''
cites:
pred_map: cites
cols:
citing_paper_id: paper_
cited_paper_id: paper_
content:
pred_map: contains
cols:
paper_id: paper_
word_cited_id: ""

rules:
# - "target(A, drama) :- movie(A, _), genre(A, drama)"
# - "target(A, not_drama) :- movie(A, _), \\+ genre(A, drama)"
# - "movie_filt(A) :- target(A, _)"
# - "dummy(D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "m2d(M, D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "d2t(D, T) :- m2d(M, D), target(M, T)"
# - "director(A) :- director(A, _, _)"
# - "movie(A) :- movie(A, _, _, _)"
# - "role(A,M) :- role(A, M)"

types:
- ['paper(P, _)', ['paper', 'P']]

properties:
- ['paper(P,L)', ['label', 'P', 'L'], 'single_cat']
- ['contains(P,W)', ['contains', 'P', 'W'], 'multi_cat']
# - ['actor(A,G)', ['gender', 'A', 'G'], true]
# - ['target(M, G)', ['genre', 'M', 'G'], true]
# - ['target(M, G)', ['genre2', 'M', 'G'], true]
# - ['actor(A,G)', ['gender', 'G', 'G'], true]
# - ['actor(A,_)', ['actor_id', 'A', 'A'], true]
# - ['director(D)', ['dir_id', 'D', 'D'], true]
# - ['movie(M,_)', ['movie_id', 'M', 'M'], true]

connections:
- ['cites(P1,P2)', ['cites1', 'P1', 'P2']]
- ['cites(P1,P2)', ['cites2', 'P2', 'P1']]
# - ['has_role(A,M)', ['has_role1', 'A', 'M']]
# - ['has_role(A,M)', ['has_role2', 'M', 'A']]
# - ['directed(D,M)', ['directed1', 'D', 'M']]
# - ['directed(D,M)', ['directed2', 'M', 'D']]
# - ['m2d(M,D)', ['m2d1', 'M', 'D']]
# - ['m2d(M,D)', ['m2d2', 'D', 'M']]
# - ['d2t(D,T)', ['d2t1', 'T', 'D']]
# - ['d2t(D,T)', ['d2t2', 'D', 'T']]
# - ['actor(A,G)', ['gender', 'A', 'G']]
# - ['actor(A,G)', ['gender', 'G', 'A']]
94 changes: 94 additions & 0 deletions rules/imdb-ml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
sql_addr: "mysql+pymysql://vince:asdqwe@localhost:3306/"
sql_db: "imdb_MovieLens"
tables:
users:
pred_map: user
cols:
userid: user_
age: ''
u_gender: ''
actors:
pred_map: actor
cols:
actorid: actor_
a_gender: ''
directors:
pred_map: director
cols:
directorid: director_
movies:
pred_map: movie
cols:
movieid: movie_
year: ''
movies2directors:
pred_map: directed
cols:
directorid: director_
movieid: movie_
movies2actors:
pred_map: has_role
cols:
actorid: actor_
movieid: movie_
u2base:
pred_map: rating
cols:
userid: user_
movieid: movie_
rating: ''

rules:
# - "target(A, drama) :- movie(A, _), genre(A, drama)"
# - "target(A, not_drama) :- movie(A, _), \\+ genre(A, drama)"
# - "movie_filt(A) :- target(A, _)"
# - "dummy(D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "m2d(M, D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "d2t(D, T) :- m2d(M, D), target(M, T)"
# - "director(A) :- director(A, _, _)"
# - "movie(A) :- movie(A, _, _, _)"
# - "role(A,M) :- role(A, M)"

types:
- ['user(A, _, _)', ['user', 'A']]
- ['actor(A, _)', ['actor', 'A']]
# - ['actor(_, G)', ['gender', 'G']]
- ['director(A)', ['director', 'A']]
# - ['movie(A, _)', ['movie', 'A']]
- ['movie(A, _)', ['movie', 'A']]
# - ['m2d(_, D)', ['dummy', 'D']]
# - ['target(_, G)', ['genre', 'G']]

properties:
- ['actor(A,G)', ['gender', 'A', 'G'], 'single_cat']
- ['user(U, A, _)', ['age', 'U', 'A'], 'prop']
- ['user(U, _, G)', ['gender', 'U', 'G'], 'single_cat']
# - ['target(M, G)', ['genre2', 'M', 'G'], true]
# - ['actor(A,G)', ['gender', 'G', 'G'], true]
# - ['actor(A,_)', ['actor_id', 'A', 'A'], true]
# - ['director(D)', ['dir_id', 'D', 'D'], true]
# - ['movie(M,_)', ['movie_id', 'M', 'M'], true]

connections:
# - ['target(M,G)', ['genre1', 'M', 'G']]
# - ['target(M,G)', ['genre2', 'G', 'M']]
- ['has_role(A,M)', ['has_role_1', 'A', 'M']]
- ['has_role(A,M)', ['has_role_2', 'M', 'A']]
- ['directed(D,M)', ['directed_1', 'D', 'M']]
- ['directed(D,M)', ['directed_2', 'M', 'D']]
- ['rating(U, M, 1)', ['r1_1', 'U', 'M']]
- ['rating(U, M, 2)', ['r2_1', 'U', 'M']]
- ['rating(U, M, 3)', ['r3_1', 'U', 'M']]
- ['rating(U, M, 4)', ['r4_1', 'U', 'M']]
- ['rating(U, M, 5)', ['r5_1', 'U', 'M']]
- ['rating(U, M, 1)', ['r1_2', 'M', 'U']]
- ['rating(U, M, 2)', ['r2_2', 'M', 'U']]
- ['rating(U, M, 3)', ['r3_2', 'M', 'U']]
- ['rating(U, M, 4)', ['r4_2', 'M', 'U']]
- ['rating(U, M, 5)', ['r5_2', 'M', 'U']]
# - ['m2d(M,D)', ['m2d1', 'M', 'D']]
# - ['m2d(M,D)', ['m2d2', 'D', 'M']]
# - ['d2t(D,T)', ['d2t1', 'T', 'D']]
# - ['d2t(D,T)', ['d2t2', 'D', 'T']]
# - ['actor(A,G)', ['gender', 'A', 'G']]
# - ['actor(A,G)', ['gender', 'G', 'A']]
76 changes: 76 additions & 0 deletions rules/imdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
sql_addr: "mysql+pymysql://vince:asdqwe@localhost:3306/"
sql_db: "imdb_small"
tables:
actors:
pred_map: actor
cols:
id: actor_
gender: ''
directors:
pred_map: director
cols:
id: director_
movies:
pred_map: movie
cols:
id: movie_
year: ''
movies_directors:
pred_map: directed
cols:
director_id: director_
movie_id: movie_
movies_genres:
pred_map: genre
cols:
movie_id: movie_
genre: ''
roles:
pred_map: has_role
cols:
actor_id: actor_
movie_id: movie_

rules:
- "target(A, drama) :- movie(A, _), genre(A, drama)"
- "target(A, not_drama) :- movie(A, _), \\+ genre(A, drama)"
- "movie_filt(A) :- target(A, _)"
# - "dummy(D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "m2d(M, D) :- movie(M, _), string_concat('dummy_',M,D)"
# - "d2t(D, T) :- m2d(M, D), target(M, T)"
# - "director(A) :- director(A, _, _)"
# - "movie(A) :- movie(A, _, _, _)"
# - "role(A,M) :- role(A, M)"

types:
- ['actor(A, _)', ['actor', 'A']]
# - ['actor(_, G)', ['gender', 'G']]
- ['director(A)', ['director', 'A']]
# - ['movie(A, _)', ['movie', 'A']]
- ['movie_filt(A)', ['movie', 'A']]
# - ['m2d(_, D)', ['dummy', 'D']]
- ['target(_, G)', ['genre', 'G']]

properties:
- ['target(_,G)', ['genre', 'G', 'G'], true]
# - ['actor(A,G)', ['gender', 'A', 'G'], true]
- ['target(M, G)', ['genre', 'M', 'G'], true]
# - ['target(M, G)', ['genre2', 'M', 'G'], true]
# - ['actor(A,G)', ['gender', 'G', 'G'], true]
# - ['actor(A,_)', ['actor_id', 'A', 'A'], true]
# - ['director(D)', ['dir_id', 'D', 'D'], true]
# - ['movie(M,_)', ['movie_id', 'M', 'M'], true]

connections:
- ['target(M,G)', ['genre1', 'M', 'G']]
- ['target(M,G)', ['genre2', 'G', 'M']]
# - ['has_role(A,M)', ['has_role1', 'A', 'M']]
# - ['has_role(A,M)', ['has_role2', 'M', 'A']]
# - ['directed(D,M)', ['directed1', 'D', 'M']]
# - ['directed(D,M)', ['directed2', 'M', 'D']]
# - ['m2d(M,D)', ['m2d1', 'M', 'D']]
# - ['m2d(M,D)', ['m2d2', 'D', 'M']]
# - ['d2t(D,T)', ['d2t1', 'T', 'D']]
# - ['d2t(D,T)', ['d2t2', 'D', 'T']]
# - ['actor(A,G)', ['gender', 'A', 'G']]
# - ['actor(A,G)', ['gender', 'G', 'A']]
43 changes: 43 additions & 0 deletions rules/muta188.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
sql_addr: "mysql+pymysql://vince:asdqwe@localhost:3306/"
sql_db: "mutagenesis_188"
tables:
atoms:
pred_map: atom
cols:
id: atom_
drug_id: drug_
element: ""
# charge: ""
bonds:
pred_map: bond
cols:
atom1_id: atom_
atom2_id: atom_
bond_type: ""
drugs:
pred_map: drug
cols:
id: drug_
active: ""

rules:
- "in_drug(A, D) :- atom(A, D, _)"
- "bond_sym(A1, A2) :- bond(A1, A2, BT); bond(A2, A1, BT)"
# - "charge(A, C) :- atom(A, _, _, C)"
- "element(A, E) :- atom(A, _, E)"

types:
- ['atom(A, _, _)', ['atom', 'A']]
# - ['element(A, E)', ['element', 'E']]
- ['drug(D, _)', ['drug', 'D']]

properties:
# - ['charge(A,C)', ['charge', 'A', 'C'], False]
- ['element(A,E)', ['element', 'A', 'E'], True]
- ['drug(D,A)', ['active', 'D', 'A'], True]

connections:
- ['bond_sym(A1,A2)', ['bond_sym', 'A1', 'A2']]
- ['in_drug(A,D)', ['in_drug1', 'A', 'D']]
- ['in_drug(A,D)', ['in_drug2', 'D', 'A']]
# - ['element(A,E)', ['element', 'A', 'E']]
Loading

0 comments on commit 63364d1

Please sign in to comment.