The virtual XML used by GNQuery includes also the deleted (logically deleted) objects. They are indentified by an extra ‘nav:spiked’ XML element – so for example a deleted story appears in the virtual XML as:
<gn4:story id="obj33478". . .>
<nav:deleted Code="Normal" Time="..." LoginGuid="..." PurgeTime="...">
<gn4:user id="obj4">
<nav:refObject>
<gn4:user . . .>
. . .
</gn4:user>"
</nav:refObject>
</gn4:user>
</nav:deleted>
. . .
</gn4:story>
Check for the presence – or absence – of this element to write queries returning only deleted or non-deleted objects, for example:
gn4:image[not(nav:deleted)]
returns all non-deleted images.
As seen in the example above, the ‘nav:spiked’ element includes various details: the deleting code in the ‘Code’ attribute, when the object has been deleted in the ‘Time’ attribute, the associated purge time (if any) in the ‘PurgeTime’ attribute and the complete details of the user that deleted the object in the ‘gn4:user’ sub-element. These details can be used to write more specific queries for deleted objects, for example
gn4:image[nav:deleted/@Code='Auto']
returns all images that have been deleted with code ‘Auto’;
gn4:image[nav:deleted/@Time>='2012-01-01T00:00:00Z']
returns all images that have been deleted since the beginning of 2012 (UTC);
gn4:image[nav:deleted/@PurgeTime>='2012-09-01T00:00:00Z']
returns all images that are going to be purged on or after September 1st 2012 (UTC);
gn4:image[nav:deleted/gn4:user/nav:refObject/gn4:user/@name='Editor']
returns all images that have been deleted by the user ‘Editor’.
System commands that fetch objects like ‘srv4 export’ usually automatically add a ‘non spiked’ condition – so
srv4 export -conditions "gn4:image" -out c:\temp\i.xml
exports all non-deleted images, even if there are no explicit conditions on ‘nav:spiked’ in the query expression.