def input_filter(fn: str, dir: str, opts: Namespace) -> bool: print(f"Testing {fn}", end='') input_fn = os.path.join(dir, fn) g = Graph() try: g.load(input_fn, format="turtle") except BadSyntax: print(" PARSE ERROR") return False node_role = list(g.subject_objects(FHIR.nodeRole)) if not node_role: print(" NOT A FHIR Resource") return False focus = node_role[0][0] resource_type = g.value(focus, RDF.type) if not resource_type: print(" UNKNOW Resource type") return False print(f" Type: {resource_type}") opts.graph = g opts.resource_type = resource_type opts.focus = focus return True