How can I create a new vocabulary?

Hello,
According to Nuxeo documentation: “Administrators and power users can only modify or delete vocabularies. They cannot create a new vocabulary from the user interface.“
Link: http://doc.nuxeo.com/display/USERDOC/Managing+Vocabularies
Does anyone have an idea how to create a new vocabulary since it's not possible using the user interface?

And thanks in advance.

0 votes

2 answers

2683 views

ANSWER



You have to provide an XML contribution for a new one.

See for instance the definition for the standard ones in the platform: http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewContribution/org.nuxeo.ecm.directories--directories

0 votes



Create a csv file with the values that you want to keep. Place that file in directories folder of resources. Create an extension, for example, directories-contrib.xml with following,

  <directory name="Your_Schema">
  <schema>Schema_name</schema>
  <dataSource>java:/nxsqldirectory</dataSource>
  <cacheTimeout>3600</cacheTimeout>
  <cacheMaxSize>1000</cacheMaxSize>
  <table>table_name</table>
  <idField>id</idField>
  <autoincrementIdField>false</autoincrementIdField>
  <dataFile>directories/your_csv_file.csv</dataFile>
  <createTablePolicy>always</createTablePolicy>
  </directory>

Now create Your_Schema.xsd as below.

 <xs:element name="id" type="xs:string"/>
 <xs:element name="label_en" type="xs:string"/>
    <xs:element name="obsolete" type="xs:integer" default="0"/>
    <xs:element name="ordering" type="xs:integer" default="10000000"/>

Don't forget to declare Schema_name as below in core-types-contrib.xml

<schema name="Schema_name" prefix="sn" src="schema/Your_Schema.xsd" />

Make sure that your schema gets stored in database with the values given in csv file. That table serves as vocabulary for you. Hope this helps you. Kindly revert for more clarifications.

0 votes