Skip to content

Instantly share code, notes, and snippets.

@andrawaag
Created July 23, 2021 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrawaag/be5f728178d2ce3895391bfd432940d2 to your computer and use it in GitHub Desktop.
Save andrawaag/be5f728178d2ce3895391bfd432940d2 to your computer and use it in GitHub Desktop.
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