Skip to content

Commit

Permalink
providing static context definition as parameter for graph serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bernd-mueller committed Nov 5, 2024
1 parent 7203799 commit 5e9a113
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions .github/workflows/process_profile_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,15 @@ def generate_rdf_for_profile(self, profile_name, label, comment, publisher, is_p

# save the graph with additional profile triples
# outfile = outputfilename+"."+filetype
context = {
"schema": "http://schema.org/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"bioschemas": "https://discovery.biothings.io/view/bioschemas/"}
outfile = outputfilename
g.serialize(destination=outfile, format="json-ld", auto_compact=True)
g.serialize(destination=outfile, format="json-ld", context=context)
print("Writing result to", outfile)
g.close()
# postproc = """
# {
# "@context": {
# "schema": "http://schema.org/",
# "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
# "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
# "bioschemas": "https://discovery.biothings.io/view/bioschemas/"
# },
# "@graph":
# """

# print("Postprocessing file to legit Bioschemas file format.")

# enriched = ""
# with open(outfile, 'r') as file:
# for line in file:
# enriched += line.strip() + "\n"
# file.close()

# postproc = postproc + enriched + "\n}"

# with open(outfile, "w") as file:
# file.write(postproc)
# file.close()




# Process profile information from the GitHub repository of BioSchemas. All profiles in JSON-LD format
Expand Down

0 comments on commit 5e9a113

Please sign in to comment.