Minoru Horita · Mar 27, 2018

Creating a domain programmatically and language setting

I am trying to create an iKnow domain programmatically like:

    Set dom = ##class(%iKnow.Domain).%New("TestDom")
    Do  dom.SetParameter("DefaultConfig", "MyConfiguration")
    Set sc = dom.%Save()


Although "MyConfiguration" sets the language to "ja", i.e. Japanese, it doesn't seem to be respected, and what I see on the top right pane in Knowledge Portal is related concepts, instead of proximity profiles, which I expect to see  in Japanese language mode.

Also resulting segmentation of sentences looks to be it is in English mode.

Can someone tell me how I can do this?

0 241
Discussion (2)1
Log in or sign up to continue


The SetParameter() method requires your domain has an ID assigned, which it gets automatically as soon as you call %Save() a first time. Note that it should be returning an error in the sequence of commands you pasted, but it went unnoticed because of the do syntax.

In general, it should be more convenient to work with Domain Definitions rather than the %iKnow.Domain API directly.


Thanks, Benjamin.

Calling SetParameter() after saving the created domain worked perfectly.

I understand that working with Domain Definitions is more convenient in most cases, but I was looking for a way to deal with a situation where several domains need to be created by a user who is not so familiar with COS, and I thought it would be good to write code that creates a domain and feeds data.