Skip to content

Commit

Permalink
added meaningful prints
Browse files Browse the repository at this point in the history
  • Loading branch information
bernd-mueller committed Nov 8, 2024
1 parent e1f4cc1 commit 767b770
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/process_profile_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() + "/")

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 767b770

Please sign in to comment.