Skip to content

Commit

Permalink
Add python CLI for GFD mining
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonChern committed Dec 11, 2024
1 parent 408c93c commit 598b7aa
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Task(StrEnum):
gfd_verification = auto()
nd_verification = auto()
pfd_verification = auto()
gfd_mining = auto()


class Algorithm(StrEnum):
Expand Down Expand Up @@ -66,6 +67,7 @@ class Algorithm(StrEnum):
egfd_verifier = auto()
naive_nd_verifier = auto()
naive_pfd_verifier = auto()
gfd_miner = auto()


HELP = 'help'
Expand Down Expand Up @@ -332,6 +334,10 @@ class Algorithm(StrEnum):
Algorithms: NAIVE_PFD_VERIFIER
Default: NAIVE_PFD_VERIFIER
'''
GFD_MINING_HELP = '''Discover graph functional dependencies in graph structures.
For more information about the primitive and the algorithms, refer to
“Discovering Graph Functional Dependencies” by Fan Wenfei et al.
'''
PYRO_HELP = '''A modern algorithm for discovery of approximate functional
dependencies. Approximate functional dependencies are defined in the
“Efficient Discovery of Approximate Dependencies” paper by S.Kruse and
Expand Down Expand Up @@ -513,6 +519,7 @@ class Algorithm(StrEnum):
more information, refer to “Functional Dependency Generation and Applications
in pay-as-you-go data integration systems” by Daisy Zhe Wang et al.
'''
GFD_MINER_HELP = '''An algorithm for searching for dependencies in a given graph'''

OPTION_TYPES = {
str: 'STRING',
Expand Down Expand Up @@ -541,7 +548,8 @@ class Algorithm(StrEnum):
Task.aucc_verification: AUCC_VERIFICATION_HELP,
Task.gfd_verification: GFD_VERIFICATION_HELP,
Task.nd_verification: ND_VERIFICATION_HELP,
Task.pfd_verification: PFD_VERIFICATION_HELP
Task.pfd_verification: PFD_VERIFICATION_HELP,
Task.gfd_mining: GFD_MINING_HELP,
}

ALGO_HELP_PAGES = {
Expand Down Expand Up @@ -576,7 +584,8 @@ class Algorithm(StrEnum):
Algorithm.egfd_verifier: GFD_VERIFIER_HELP,
Algorithm.apriori: APRIORI_HELP,
Algorithm.naive_nd_verifier: NAIVE_ND_VERIFIER_HELP,
Algorithm.naive_pfd_verifier: NAIVE_PFD_VERIFIER_HELP
Algorithm.naive_pfd_verifier: NAIVE_PFD_VERIFIER_HELP,
Algorithm.gfd_miner: GFD_MINER_HELP,
}

TaskInfo = namedtuple('TaskInfo', ['algos', 'default'])
Expand Down Expand Up @@ -621,6 +630,8 @@ class Algorithm(StrEnum):
Algorithm.naive_nd_verifier),
Task.pfd_verification: TaskInfo([Algorithm.naive_pfd_verifier],
Algorithm.naive_pfd_verifier),
Task.gfd_mining: TaskInfo([Algorithm.gfd_miner],
Algorithm.gfd_miner),
}

ALGOS = {
Expand Down Expand Up @@ -655,7 +666,8 @@ class Algorithm(StrEnum):
Algorithm.egfd_verifier: desbordante.gfd_verification.algorithms.EGfdValid,
Algorithm.apriori: desbordante.ar.algorithms.Apriori,
Algorithm.naive_nd_verifier: desbordante.nd_verification.algorithms.NDVerifier,
Algorithm.naive_pfd_verifier: desbordante.pfd_verification.algorithms.PFDVerifier
Algorithm.naive_pfd_verifier: desbordante.pfd_verification.algorithms.PFDVerifier,
Algorithm.gfd_miner: desbordante.gfd_mining.algorithms.GfdMiner,
}


Expand Down Expand Up @@ -803,7 +815,7 @@ def get_algo_result(algo: desbordante.Algorithm, algo_name: str, provided_option
result = algo.get_list_ods()
case algo_name if algo_name in TASK_INFO[Task.ind].algos:
result = algo.get_inds()
case algo_name if algo_name in TASK_INFO[Task.gfd_verification].algos:
case algo_name if algo_name in TASK_INFO[Task.gfd_verification].algos or algo_name in TASK_INFO[Task.gfd_mining]:
result = algo.get_gfds()
case Algorithm.fd_first:
result = algo.get_cfds()
Expand Down

0 comments on commit 598b7aa

Please sign in to comment.