|
@@ -9,6 +9,7 @@ import dacite
|
|
|
import toml
|
|
|
|
|
|
from graph_exploring_tool import __version__
|
|
|
+from graph_exploring_tool.configuration import Configuration
|
|
|
from graph_exploring_tool.graphical.interface import interface
|
|
|
from graph_exploring_tool.query import QueryTemplate
|
|
|
|
|
@@ -18,6 +19,7 @@ def handler(signal_code, _) -> None:
|
|
|
logging.debug(f"Shutting down because signal {signal_code} was received.")
|
|
|
sys.exit(5)
|
|
|
|
|
|
+
|
|
|
def load_palette(palette_directory: Path) -> List:
|
|
|
""""""
|
|
|
for query_path in palette_directory.rglob("*.toml"):
|
|
@@ -31,23 +33,30 @@ def launch():
|
|
|
signal(SIGINT, handler)
|
|
|
signal(SIGTERM, handler)
|
|
|
arklog.set_config_logging()
|
|
|
- logging.info(f"GET {__version__}.")
|
|
|
+ logging.info(f"Graph Exploring Tool {__version__}.")
|
|
|
data_dir = Path(__file__).resolve().parent.parent / Path("data")
|
|
|
+
|
|
|
logging.debug(f"Looking for configuration in '{data_dir}'.")
|
|
|
try:
|
|
|
configuration = toml.loads((data_dir / Path("configuration.toml")).read_text(encoding="utf-8"))
|
|
|
+ configuration = dacite.from_dict(data_class=Configuration, data=configuration, )
|
|
|
except FileNotFoundError as e:
|
|
|
logging.error(f"Configuration not found. {e}")
|
|
|
return 8
|
|
|
- endpoint_sparql = configuration.get("endpoint_sparql", "http://127.0.0.1:3030/Drivetrain/sparql")
|
|
|
- example_prefix = configuration.get("example_prefix", "")
|
|
|
- example_query = configuration.get("example_query", "")
|
|
|
- logging.debug("Parameters:")
|
|
|
- logging.debug(f" -> {endpoint_sparql=}")
|
|
|
- logging.debug(f" -> {example_prefix=}")
|
|
|
- logging.debug(f" -> {example_query=}")
|
|
|
+
|
|
|
+ logging.debug("Configuration:")
|
|
|
+ logging.debug(f" -> {configuration.example_prefix=}")
|
|
|
+ logging.debug(f" -> {configuration.example_query=}")
|
|
|
+ logging.debug(f" -> {configuration.endpoint_sparql=}")
|
|
|
+ logging.debug(f" -> {configuration.prefixes=}")
|
|
|
+
|
|
|
+ prefix_duplicates = configuration.check_for_duplicate_prefixes()
|
|
|
+ for duplicate in prefix_duplicates:
|
|
|
+ logging.warning(f"Duplicate prefix '{duplicate}'.")
|
|
|
+
|
|
|
palette = load_palette(data_dir / Path("palette"))
|
|
|
- return interface(endpoint=endpoint_sparql, example_prefix=example_prefix, example_query=example_query, palette=palette)
|
|
|
+ return interface(configuration=configuration, palette=palette)
|
|
|
+
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
launch()
|