In general, you sould look at the NXOpen:DM classes for these kinds of needs.
Regarding the need to create a custom item type, there isn't any problem with for example the part builders NXOpen:DM:artFromPartBuilder.
If you've got some need to impart part or dataset, you'll find some methods in NXOpen:DM subclasses.
The need to create relation between two items is more tricky. As far as I know, you do not have any direct solution. When I encountered this need a while back ago, I had to use a custom ITK handler triggered by my NXOpen automation with UF_UGMGR_invoke_pdm_server().
It's not light but it's working really well.
PS : the smiley stands for : and P, do not how to change this...