Skip to content

Commit 8fe2930

Browse files
committed
add commandline option for join location
1 parent 8defbc3 commit 8fe2930

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

runDeTrusty.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def get_options():
1515
try:
16-
opts, args = getopt.getopt(sys.argv[1:], "h:q:o:c:r:d:")
16+
opts, args = getopt.getopt(sys.argv[1:], "h:q:o:c:r:d:j:")
1717
except getopt.GetoptError:
1818
usage()
1919
sys.exit(2)
@@ -23,6 +23,7 @@ def get_options():
2323
config_file = "./Config/rdfmts.json"
2424
print_result = True
2525
decomposition_type = "STAR"
26+
join_stars_locally = True
2627
for opt, arg in opts:
2728
if opt == "-h":
2829
usage()
@@ -37,29 +38,32 @@ def get_options():
3738
print_result = eval(arg)
3839
elif opt == "-d":
3940
decomposition_type = arg
41+
elif opt == "-j":
42+
join_stars_locally = eval(arg)
4043

4144
if not query_file:
4245
usage()
4346
sys.exit(1)
4447

45-
return query_file, decomposition_type, sparql_one_dot_one, config_file, print_result
48+
return query_file, decomposition_type, sparql_one_dot_one, config_file, print_result, join_stars_locally
4649

4750

4851
def usage():
49-
usage_str = "Usage: {program} -q <query_file> -c <config_file> -d <decomposition> -o <sparql1.1> -r <print_result>" \
52+
usage_str = "Usage: {program} -q <query_file> -c <config_file> -d <decomposition> -o <sparql1.1> -r <print_result> -j <join_stars_locally>" \
5053
"\nwhere \n" \
5154
"<decomposition> is one in [STAR, EG, TRIPLE] (default STAR). STAR decomposes the query into star-shaped sub-queries, EG follows the exclusive groups approach, TRIPLE generates a triple-wise decomposition.\n" \
5255
"<sparql1.1> is one in [True, False] (default False), when True, no decomposition is needed\n" \
53-
"<print_result> is one in [True, False] (default True), when False, only metadata is returned\n"
56+
"<print_result> is one in [True, False] (default True), when False, only metadata is returned\n" \
57+
"<join_stars_locally> is one in [True, False] (default True), when False, joins are pushed to the sources\n"
5458
print(usage_str.format(program=sys.argv[0]), )
5559

5660

5761
def main():
58-
query_file, decomposition_type, sparql_one_dot_one, config_file, print_result = get_options()
62+
query_file, decomposition_type, sparql_one_dot_one, config_file, print_result, join_stars_locally = get_options()
5963
try:
6064
query = open(query_file, "r", encoding="utf8").read()
6165
config = ConfigFile(config_file)
62-
print(json.dumps(run_query(query, decomposition_type, sparql_one_dot_one, config, print_result=print_result), indent=2))
66+
print(json.dumps(run_query(query, decomposition_type, sparql_one_dot_one, config, print_result=print_result, join_stars_locally=join_stars_locally), indent=2))
6367
except Exception as e:
6468
import sys
6569
import traceback

0 commit comments

Comments
 (0)