Project:CorrectSimplePropertyProblems

From MaRDI portal
Revision as of 11:12, 20 May 2025 by Larissa (talk | contribs) (Created page with "If there are properties that have the wrong value, this can be corrected in the following way: First, get a list of all affected QIDs, for example using SPARQL. Then adapt the following script that shows how to replace the value of a property for an item. The value ''replace_all'' should only be used when there is only one value for that property, otherwise the correct value would be ''append_or_replace.''<syntaxhighlight lang="python"> from mardiclient import MardiClie...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If there are properties that have the wrong value, this can be corrected in the following way:

First, get a list of all affected QIDs, for example using SPARQL. Then adapt the following script that shows how to replace the value of a property for an item. The value replace_all should only be used when there is only one value for that property, otherwise the correct value would be append_or_replace.

from mardiclient import MardiClient
mc = MardiClient(user=NAME, password=PW)
qid=QID
item = mc.item.get(entity_id=qid)
item.add_claim("PROPERTY_ID", "VALUE", action="replace_all")
item.write()