Created
July 23, 2021 15:42
-
-
Save andrawaag/be5f728178d2ce3895391bfd432940d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def createProperty(login=login, wdprop=None, lulabel="", enlabel="", frlabel="", delabel="", description="", property_datatype=""): | |
if wdprop== None: | |
s = [] | |
else: | |
s = [wdi_core.WDUrl(wdprop, prop_nr="P1")] | |
localEntityEngine = wdi_core.WDItemEngine.wikibase_item_engine_factory(api,sparql) | |
item = localEntityEngine(data=s) | |
if lulabel != "": | |
item.set_label(lulabel, lang="lb") | |
item.set_label(enlabel, lang="en") | |
item.set_label(delabel, lang="de") | |
item.set_label(frlabel, lang="fr") | |
item.set_description(description, lang="en") | |
print(item.write(login, entity_type="property", property_datatype=property_datatype)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment