@@ -497,15 +497,21 @@ def count(
497497 return response .total
498498
499499 def _update_empty_properties (self , data : JSONdict ):
500- """Replace any empty properties (value None) with the supplied data"""
500+ """
501+ Replace any empty properties (value None) with the supplied data
502+ unless the property was deliberately set to None.
503+ """
501504 cls = self .__class__
505+ locally_modified = self .modified_data ()
502506 deserialized_data = cls ._deserialize_data (data , include_id = True )
503507 for prop in cls .all_properties :
504- current_value = getattr (self , prop .name , None )
505- if current_value is None :
506- value = deserialized_data [prop .name ]
507- if value is not None :
508- setattr (self , prop .name , value )
508+ expanded_path = expand_uri (prop .path , cls .context )
509+ if expanded_path not in locally_modified :
510+ current_value = getattr (self , prop .name , None )
511+ if current_value is None :
512+ value = deserialized_data .get (prop .name , None )
513+ if value is not None :
514+ setattr (self , prop .name , value )
509515 assert self .remote_data is not None
510516 for key , value in data .items ():
511517 if not (key .startswith ("Q" ) or key == "@context" ):
0 commit comments