DQL provides the keyword IN
for checking direct membership of a component in a virtual document. Suppose that the virtual document in the book example has the object ID 0900006480002533
. The following query retrieves information about all the chapters and the virtual document itself:
SELECT r_object_id, object_name FROM dm_sysobject IN DOCUMENT ID('0900006480002533') WITH ANY r_version_label = 'CURRENT'
If all the descendants in the hierarchy are desired, the keyword DESCEND
can be used after ID()
.
Further, suppose that books are being represented as a custom type book_doc
and stored somewhere in the folder tree under a cabinet named books
. The following query retrieves the names of all such books:
SELECT object_name FROM book_doc WHERE r_is_virtual_doc = 1 AND FOLDER('/books', DESCEND)