From d9b11b464ac624ac5eab187bf94aa276a32e9578 Mon Sep 17 00:00:00 2001 From: Ivan Mrsulja Date: Fri, 27 Sep 2024 16:26:14 +0200 Subject: [PATCH] Fixed vivo locale bug. --- sample-data-generator.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sample-data-generator.py b/sample-data-generator.py index 4bba609..cd40e0f 100644 --- a/sample-data-generator.py +++ b/sample-data-generator.py @@ -714,12 +714,17 @@ def main(): if nw_uri % 10 == 0: print("Adding coauthors for work", nw_uri) - f = open("sample-data.ttl", "w") - print(g.serialize(format="ttl"), file=f) - stop = time.time() - print(site_dns, "1 University;", n_colleges, "colleges;", n_departments, "departments;", n_people, "people;", - n_works, "works;", n_projects, "projects;", n_grants, "grants;", n_equipment, "units of equipment;", len(g), "triples in language", lang, "{:.2f} seconds".format(stop - start)) - return + with open("sample-data.ttl", "w") as f: + triples_string = g.serialize(format="ttl") + + for language_tag in content_langs: + language_tag_vivo_locale = language_tag.replace("_", "-") + triples_string = triples_string.replace(language_tag, language_tag_vivo_locale) + + print(triples_string, file=f) + stop = time.time() + print(site_dns, "1 University;", n_colleges, "colleges;", n_departments, "departments;", n_people, "people;", + n_works, "works;", n_projects, "projects;", n_grants, "grants;", n_equipment, "units of equipment;", len(g), "triples in language", lang, "{:.2f} seconds".format(stop - start)) if __name__ == "__main__":