From 5b0eedbcd58b9eaf10be40ebce1066c38e9f5d92 Mon Sep 17 00:00:00 2001 From: shihanwan Date: Tue, 15 Oct 2024 21:39:04 -0400 Subject: [PATCH] formatting --- memonto/stores/triple/jena.py | 8 +++++--- memonto/utils/rdf.py | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/memonto/stores/triple/jena.py b/memonto/stores/triple/jena.py index c7d583b..0d6cb09 100644 --- a/memonto/stores/triple/jena.py +++ b/memonto/stores/triple/jena.py @@ -203,7 +203,7 @@ def get( def get_all(self, graph_id: str = None) -> str: g_id = f"data-{graph_id}" if graph_id else "data" - query=f""" + query = f""" CONSTRUCT {{ ?s ?p ?o . }} WHERE {{ @@ -227,8 +227,10 @@ def get_all(self, graph_id: str = None) -> str: return "" return str(result) - - def get_context(self, matched: dict[str, dict], graph_id: str, depth: int = 1) -> str: + + def get_context( + self, matched: dict[str, dict], graph_id: str, depth: int = 1 + ) -> str: g_id = f"data-{graph_id}" if graph_id else "data" nodes_set = set() diff --git a/memonto/utils/rdf.py b/memonto/utils/rdf.py index c5c965a..ef5ea2e 100644 --- a/memonto/utils/rdf.py +++ b/memonto/utils/rdf.py @@ -109,8 +109,12 @@ def generate_image(g: Graph, ns: dict[str, Namespace], path: str = None) -> None if isinstance(o, BNode) and (o, TRIPLE_PROP.uuid, None) in g: continue - s_label = bnode_labels[s] if isinstance(s, BNode) else to_human_readable(str(s), ns) - o_label = bnode_labels[o] if isinstance(o, BNode) else to_human_readable(str(o), ns) + s_label = ( + bnode_labels[s] if isinstance(s, BNode) else to_human_readable(str(s), ns) + ) + o_label = ( + bnode_labels[o] if isinstance(o, BNode) else to_human_readable(str(o), ns) + ) p_label = to_human_readable(str(p), ns) dot.node(s_label, s_label)