The virtual XML used by GNQuery includes also audit information. They are identified by an extra ‘nav:audit’ XML element containing ‘nav:actionDesc’ elements.
Example:
<gn4:story id="obj33478". . .>
<nav:audit handle="1">
<nav:actionDesc Action="…" Time="…" LoginGuid="…" UserId="4" UserDesc="…">
<user idref="…">
<nav:refObject idref="…" >
<user … />
</nav:refObject>
</user>
</nav:actionDesc>
</nav:audit>
. . .
</gn4:story>
Get all the stories modified by a specific user:
gn4:story[nav:audit/nav:actionDesc/@UserDesc='user desc' and nav:audit/nav:actionDesc/@Action='Update']
or:
gn4:story[nav:audit/nav:actionDesc/gn4:user/nav:refObject/gn4:user/@name='user' and nav:audit/nav:actionDesc/@Action='Update']
Get all the stories modified after a specific date time:
gn4:story[nav:audit/nav:actionDesc/@Time >= '2012-08-03T00:00:00.00Z' and nav:audit/nav:actionDesc/@Action='Update']
It is also possible to query the audit nodes directly to do query like (this example counts the total actions done by a user):
count(nav:audit/nav:actionDesc[@UserDesc='user desc'])
or count the objects created by a user after a specific date time:
count(nav:audit/nav:actionDesc[@UserDesc='user desc' and @Action='Create' and @Time >= '2012-08-03T00:00:00.00Z'])