Manually creating .okm files for import?

We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
stiebs
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Fri Jun 15, 2012 12:26 pm

Manually creating .okm files for import?

Post by stiebs »

If I've got a heap of newly scanned documents to import, I don't want to go through and manually upload, then assign keywords and categories to all documents. Gets very tedious and takes a long time. I can instead write a shell script to generate the *.okm files to be used for an import.

How do I go about doing this, and what information can I omit from the .okm file and still have the import work successfully? Obviously I would not be able to include the uuid. I will have the taxonomy path, the keywords and the category paths (but not the category uuids). I assume author, owner and roles are needed. How about the time stamps? For the omitted information, should I just leave it out, or does it need to be there, but blank?

Do I used {"uuid":[]} or {"uuid":""} or just omit the uuid component completely? Or something else?
Likewise for category. Do I use "categories":[{"uuid":[],"path":"/okm:categories/catname"}], or will "categories":["path":"/okm:categories/catname"}] suffice?

I'v tried creating an okm file and just removing the uuid entries. I put the okm file along with its pdf in a directory, and then tried doing a repository import, but got the error message "Error: Unable to perform operation. Node is protected.".

Is there something else I should be doing?

Thanks.

stiebs
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Fri Jun 15, 2012 12:26 pm

Re: Manually creating .okm files for import?

Post by stiebs »

After searching the forums a bit, I found that I was on 5.1.9, and previously someone else with problems importing fixed their problem by upgrading to 5.1.10.
So now that I've upgraded to 5.1.10, I have successfully imported a document from a hand written .okm file, by omitting the "uuid" components.

However there are two outstanding issues I'm still trying to resolve.

1. Even though I specified "path":"/okm:root/path/file.pdf", the document was created in the /okm:root location. If I leave "repository path" blank on the import, the import fails. I assume this means that to bulk import using this method, I should either import one taxonomy location at a time, or replicate the taxonomy structure in my source folders.

2. The keywords were added to the document on import, but the categories were not.

jllort
Moderator
Moderator
Posts: 11204
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Manually creating .okm files for import?

Post by jllort »

I suggest you upgrade to 5.1.11 ( is not oficialy released but can be found at nighly build integration.openkm.com )
To create .okm files we use GSON java library I suggest use it too.

In this class is done exportation http://doxygen.openkm.com/6.2.x/db/df6/ ... orter.html and probably you'll be interested in this too http://doxygen.openkm.com/6.2.x/d6/d40/ ... apter.html

Code: Select all

DocumentMetadata dmd = ma.getMetadata(docChild);
String json = gson.toJson(dmd);

Post Reply