diff --git a/src/ro_crate.py b/src/ro_crate.py index 935f5414dc8bef361e1b15e144296a0219c745ea..c0bc1840044a8c7713643be55e53140fe34346f9 100644 --- a/src/ro_crate.py +++ b/src/ro_crate.py @@ -159,11 +159,12 @@ class RO_Crate: """ if(self.license==None): - try: - res = self.info_dico_workflow["license"]["key"] - except: - res = None - return res + raise Exception("License is not given -> give it from list list https://spdx.org/licenses/") + #try: + # res = self.info_dico_workflow["license"]["key"] + #except: + # res = None + #return res else: return self.license @@ -264,7 +265,9 @@ class RO_Crate: root["description"] = str(self.get_description()) root["mainEntity"] = {"@id": str(self.workflow.get_first_file().get_file_address()).split("/")[-1]} #, "@type":["File", "SoftwareSourceCode"]} #We do not consider a File as a "ComputationalWorkflow" since multiple (sub)workflows can be defined in a same file - root["license"] = {"@id":str(self.get_license())} + license = str(self.get_license()) + root["license"] = license + #self.dico["@graph"].append({"@id":license, "@type":['License'], "name":"MIT"}) authors = self.get_authors() tab_authors, tab_authors_ids= [], [] for author in authors: @@ -369,7 +372,7 @@ class RO_Crate: creators = self.get_creators(key) dico["creator"] = [] for creator in creators: - dico["creator"].append({"@id": creator["@id"]}) + dico["creator"].append({"@id": f'#{creator["@id"]}'}) dico["isPartOf"] = [] dico["hasPart"] = [] self.dico["@graph"].append(dico) diff --git a/src/workflow.py b/src/workflow.py index 7f66578065daa2772db8cb8e743ee4a7a42245e7..fc408509b47cf99901b8dd0a76baa7120e568155 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -303,8 +303,17 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen #The generation of the Ro-Crate has been valid from # - https://ro-crate.ldaca.edu.au/explorer, and # - https://github.com/crs4/rocrate-validator (with the workflow-ro-crate-1.0 profile) - def get_rocrate(self, display_info=False): - self.rocrate = RO_Crate(self, display_info=display_info) + def get_rocrate(self, display_info=False, personnal_acces_token = None, + datePublished=None, description=None, + license=None, authors = None, + publisher = None, keywords = None, + producer = None): + + self.rocrate = RO_Crate(self, display_info=display_info, personnal_acces_token = personnal_acces_token, + datePublished=datePublished, description=description, + license=license, authors = authors, + publisher = publisher, keywords = keywords, + producer = producer) self.rocrate.initialise()