Skip to content

Commit

Permalink
fixed ttl file
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricdcc committed Oct 23, 2024
1 parent e71b2d6 commit 27eae9a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,27 @@ def vocabpub(baseuri, nsfolder, nssub, nsname, outfolder, template_path):
service.process(
second_args["template_name"], source, settings, sink, second_args
)

# open the ttl file and make the same id changes as in the html file
output_ttl = open(outttlpath, "r")
log.debug(f"output_ttl={output_ttl}")
new_lines = []
for line in output_ttl:
# if line starts with < then it is a line that contains an iri
if line.startswith("<"):
log.debug(f"line={line}")
# get the last part of the iri
new_id = camel_case(line.split("#")[1])
log.debug(f"new_id={new_id}")
line = line.replace(line.split("#")[1], new_id)

new_lines.append(line)

# write the changes back to the ttl file
with open(outttlpath, "w") as output_ttl:
for line in new_lines:
output_ttl.write(line)

shutil.copy((output_folder / output_name_html), outindexpath)
# shutil.copy((output_folder / output_name_ttl), outttlpath)
toreturn["error"] = False
Expand Down

0 comments on commit 27eae9a

Please sign in to comment.