From 767b7703e2daff9472759b0d836ede2d32c4fb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20M=C3=BCller?= Date: Fri, 8 Nov 2024 14:06:25 +0100 Subject: [PATCH] added meaningful prints --- .github/workflows/process_profile_script.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/process_profile_script.py b/.github/workflows/process_profile_script.py index 76dddd6..8fb83a3 100644 --- a/.github/workflows/process_profile_script.py +++ b/.github/workflows/process_profile_script.py @@ -51,7 +51,9 @@ def getValidationFromJSON(self, file): # Function to generate RDF for a specified profile using triples according to the Profile Ontology. def generate_rdf_for_profile(self, profile_name, label, comment, publisher, is_profile_of, webpage_url, f, outputfilename, filetype): + print ("Saving current @context attribute from", f) self.getContextFromJSON(f) + print("Saving current $validation triples in @graph attribute from", f) self.getValidationFromJSON(f) # Defining namespaces @@ -85,6 +87,8 @@ def generate_rdf_for_profile(self, profile_name, label, comment, publisher, is_p print("Parsing completed with size", len(g), "") + print("Constructing enrichment profiles to be added to the graph.") + # Creating profile URI profile_uri = URIRef(str(bioschemas) + profile_name.capitalize() + "/") @@ -121,20 +125,27 @@ def generate_rdf_for_profile(self, profile_name, label, comment, publisher, is_p # save the graph with additional profile triples # outfile = outputfilename+"."+filetype + + print("Writing intermediate results to", outfile) outfile = outputfilename g.serialize(destination=outfile, format="json-ld", auto_compact=True) print("Writing result to", outfile) g.close() + + print("Loading intermediate results again from", outfile) jay = self.getGraphFromJSON(outfile) # print(type(jay)) jaydict = {} jaydict = dict(ChainMap(*jay)) + print("Adding $validation triples to @graph attribute.") jaydict.update({"$validation": self.validation}) + print("Adding @context attribute to @graph") resDict = {"@context": self.context, "@graph": [jaydict]} + print("Dumping result json to", outfile) jdump = json.dumps(resDict, indent=4) with open(outfile, "w") as f: