i BELIEVE you would have to include the user and CAL assignment as a table in your data model as a data island.
The table would list all the users with a doc cal and named user cal.
If their is a named user cal for the current user (use osuser() or qvuser() to do the lookup) then you know its named. If not then check if the document and the user has a doc cal assigned . if yes its a doc cal.
if none of the above its a session.
this does not take into account if you have usage cals though.
That is the order the licenses work so it would work if you can export your cal assignments to a format readable by qv and just load them in the load script.