From d8c1f241258b382e23dc7db4561ecf77b719b89f Mon Sep 17 00:00:00 2001 From: Varun Ratnakar Date: Fri, 5 Jul 2024 23:52:01 +0530 Subject: [PATCH] Bug fixes --- pylipd/utils/create_classes.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pylipd/utils/create_classes.py b/pylipd/utils/create_classes.py index 972ca9d..917e2e3 100644 --- a/pylipd/utils/create_classes.py +++ b/pylipd/utils/create_classes.py @@ -52,12 +52,19 @@ def get_todata_item(type, range): "@type": "uri" }}""" elif type == "object": - todataitem += f""" - obj = {{ - "@id": value_obj.id, - "@type": "uri" - }} - data = value_obj.to_data(data)""" + todataitem += f""" + if type(value_obj) is str: + obj = {{ + "@value": value_obj, + "@type": "literal", + "@datatype": "http://www.w3.org/2001/XMLSchema#string" + }} + else: + obj = {{ + "@id": value_obj.id, + "@type": "uri" + }} + data = value_obj.to_data(data)""" return todataitem def get_tojson_item(type):