-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.py
39 lines (30 loc) · 1.06 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import os
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
import argparse
import logging
import time
from src.RML import *
from src.RMLtoShacl import RMLtoSHACL
from src.SHACL import *
if __name__ == "__main__":
RtoS = RMLtoSHACL()
parser = argparse.ArgumentParser()
parser.add_argument("MAPPING_FILE", type=str,
help="RML mapping file to be converted into SHACL shapes.")
parser.add_argument("-logLevel", "-l", type=str, default="INFO",
help="Logging level of this script")
args = parser.parse_args()
loglevel = args.logLevel
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level)
start = time.time()
if args.MAPPING_FILE is None:
exit()
else:
RtoS.evaluate_file(args.MAPPING_FILE)
end = time.time()
print(f"Elapsed time: {end - start} seconds")