{"id":18010,"date":"2017-12-14T06:04:39","date_gmt":"2017-12-14T06:04:39","guid":{"rendered":"http:\/\/developer.kore.ai\/v7-1\/?post_type=docs&#038;p=12173"},"modified":"2021-03-30T12:54:35","modified_gmt":"2021-03-30T11:54:35","slug":"importing-the-bot-ontology-from-csv-or-json","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v7-1\/docs\/bots\/bot-builder-tool\/knowledge-task\/importing-the-bot-ontology-from-csv-or-json\/","title":{"rendered":"Importing and Exporting Bot Ontology"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>You can build a Knowledge Graph in a CSV or JSON file and upload it to a bot. Similarly, you can export existing Knowledge Graph to CSV or JSON. Exporting a Knowledge Graph helps you edit it in a spreadsheet or import it to another Bot.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Importing_Knowledge_Graph\">Importing Knowledge Graph<\/span><\/h2>\n<ol>\n<li>Open Knowledge Graph.<\/li>\n<li>You will find the <strong>Import<\/strong> option against the Knowledge Graph.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/KC-import-export.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21699\" src=\"\/wp-content\/uploads\/sites\/12\/KC-import-export.png\" alt=\"\" width=\"820\" height=\"461\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export.png 1366w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export-300x169.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export-1024x576.png 1024w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/a><\/li>\n<li>Click <b>Import<\/b>.<\/li>\n<li>Do one of the following:\n<ul>\n<li>If you are creating the Knowledge Graph from scratch, click <b>Proceed<\/b>.<br \/>\n-or-<\/li>\n<li>If you have an existing Knowledge Graph, make sure to take a backup of the same to a CSV or JSON file, and then <strong>Proceed<\/strong>.\n<div class=\"alert alert-info\"><b>Note<\/b>: Importing an Knowledge Graph does not update it but replaces the entire existing Knowledge Graph.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>Drag and drop the file in the Import window or click <b>Browse <\/b>to navigate to the file.<\/li>\n<li>Click <b>Next <\/b>to begin the import.<\/li>\n<li>After the importing is completed, the success message appears in a dialog. Click <strong>Done.<\/strong><\/li>\n<li>The hierarchy will be displayed in the Knowledge Graph and you can edit and train the same.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Exporting_Knowledge_Graph\">Exporting Knowledge Graph<\/span><\/h2>\n<p>To export a Knowledge Graph:<\/p>\n<ol>\n<li>Open Knowledge Graph.<\/li>\n<li>You will find the Export option against the Knowledge Graph.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/KC-import-export.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21699\" src=\"\/wp-content\/uploads\/sites\/12\/KC-import-export.png\" alt=\"\" width=\"820\" height=\"461\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export.png 1366w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export-300x169.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094934\/KC-import-export-1024x576.png 1024w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/a><\/li>\n<li>Based on the preferred format: click <strong>Export JSON<\/strong> or <strong>Export CSV<\/strong>.<\/li>\n<li>The Knowledge Graph file will be downloaded to your machine.<\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Creating_Knowledge_Graph\">Creating Knowledge Graph<\/span><\/h2>\n<p>Instead of creating the Knowledge Graph from the platform UI, you might want to work in your preferred editor like Spreadsheet or as a JSON file. The platform gives you the option to create a Knowledge Graph in spreadsheet or JSON and use the same to Import it into the Bot.<\/p>\n<p>This involves these steps:<\/p>\n<ol>\n<li>Download <strong>sample CSV or a JSON file<\/strong>. You can download these sample files from a blank Knowledge Graph too.<\/li>\n<li>Edit the file by adding rows corresponding to the questions, responses, synonyms, etc..<\/li>\n<li>Import the file to your Bot.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"From_a_CSV_File\">From a CSV File<\/span><\/h3>\n<p>You can create the Knowledge Graph using a sample spreadsheet that can be downloaded from the bot. If you anticipate frequent changes to the Knowledge Graph, we recommend you to create it in a spreadsheet as it would easier to make bulk updates compared to the application UI.<\/p>\n<p>Follow the instructions below to build your Knowledge Graph in a spreadsheet.<\/p>\n<h4>Downloading the Sample CSV file<\/h4>\n<ol>\n<li>Open the Knowledge Graph.<\/li>\n<li>Click <b>Import<\/b> from the left section.<\/li>\n<li>You will be prompted to <b>back up<\/b> the Knowledge Graph before proceeding. Choose the CSV or JSON format for the backup.<\/li>\n<li>After backup, click <b>Proceed<\/b>.<\/li>\n<li>On the next dialog, click <b>Sample CSV<\/b>. The CSV file is downloaded to your local computer.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/KC-import2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21560\" src=\"\/wp-content\/uploads\/sites\/12\/KC-import2.png\" alt=\"\" width=\"550\" height=\"421\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094939\/KC-import2.png 550w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094939\/KC-import2-300x230.png 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><\/li>\n<\/ol>\n<h4>Building the Knowledge Graph in a CSV<\/h4>\n<p>Open the downloaded Sample CSV file. If you have downloaded the sample from a blank Knowledge Graph, you will see some sample questions and responses.<\/p>\n<p>The details that you need to enter in each row of the CSV file differ based on the type of information. For example, the details you need to enter for an FAQ (Question, Answer, Nodes, Alternate Questions) differ from the details you need to enter for Synonyms (Term, Synonyms).<\/p>\n<p>The bot interprets the data present in each row of the CSV file, depending on the information type specified in Column # 1 of the row. Below are the valid entries for Column#1 of the CSV file, which represent the different information types:<\/p>\n<ul>\n<li><strong>faq<\/strong>: Represents a primary or Alternate question in the Knowlege Graph.<\/li>\n<li><strong>unmappedpath<\/strong>: Represents nodes with no questions associated with it.<\/li>\n<li><strong>synonyms<\/strong>: Represents global synonyms for terms.<\/li>\n<li><strong>classes<\/strong>: Represents the trait names and their associated utterances.<\/li>\n<\/ul>\n<div class=\"alert alert-info\">\n<p><strong>Important notes<\/strong><br \/>\nYou cannot import or export the following bot elements using a\u00a0CSV or spreadsheet<\/p>\n<ul>\n<li>Alternative Responses: While the spreadsheet support entering alternative questions for an FAQ, you cannot enter alternative responses in the spreadsheet and import them into the bot.<\/li>\n<li>Split Responses: You cannot enter or import FAQ responses that are split into multiple consecutive messages.<\/li>\n<li>Advanced Responses: The CSV import doesn&#8217;t support responses written in the advanced mode using JavaScript.<\/li>\n<\/ul>\n<\/div>\n<p>The following sections provide the remaining details that you must fill for each information type:<\/p>\n<h4>FAQ<\/h4>\n<h5>Primary Question<\/h5>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/primary.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15145\" src=\"\/wp-content\/uploads\/sites\/12\/primary.png\" alt=\"\" width=\"648\" height=\"344\" \/><\/a><br \/>\n<b><br \/>\nNote<\/b>: Enter the names of all the parent nodes in separate columns until you reach the First-level node in the path.<\/p>\n<h5>Alternate Questions<\/h5>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/alternate.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15146\" src=\"\/wp-content\/uploads\/sites\/12\/alternate.png\" alt=\"\" width=\"711\" height=\"257\" \/><\/a><\/p>\n<div class=\"alert alert-info\"><strong>Note<\/strong>: You need to enter each alternative question in a separate row below the primary question.<\/div>\n<p>&nbsp;<\/p>\n<h4>Terms\/Tags<\/h4>\n<ul>\n<li>Mandatory tags and terms can be prefixed with **<\/li>\n<li>Organizer tags and terms can be prefixed with !!<\/li>\n<\/ul>\n<h4>Unmappedpath<\/h4>\n<p>Unmappedpath refers to nodes for which no question is added.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Unmapped.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15147 size-full\" src=\"\/wp-content\/uploads\/sites\/12\/Unmapped.png\" alt=\"\" width=\"679\" height=\"176\" \/><\/a><\/p>\n<div class=\"alert alert-info\"><b>Note<\/b>: Enter the names of all parent nodes in the hierarchy up to the First-level node. Do not enter the name of the root node as it creates a duplicate node below the root node.<\/div>\n<h4>Global Synonyms<\/h4>\n<div class=\"alert alert-info\"><b>Note<\/b>: Enter each synonym in a separate column.<\/div>\n<p>&nbsp;<\/p>\n<h3><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Global-synonyms-ss.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15148 size-large\" src=\"\/wp-content\/uploads\/sites\/12\/Global-synonyms-ss-1024x155.png\" alt=\"\" width=\"835\" height=\"126\" \/><\/a><\/h3>\n<h4>Path Synonyms<\/h4>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/path-synonyms.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15151 size-full\" src=\"\/wp-content\/uploads\/sites\/12\/path-synonyms.png\" alt=\"\" width=\"995\" height=\"177\" \/><\/a><\/p>\n<h4>Traits<\/h4>\n<div>To associate term or tag with a trait use the entry as: <code>&lt;tag\/term-name&gt;:&lt;class-name&gt;&gt;<\/code><\/div>\n<div class=\"alert alert-info\"><b>Note<\/b>: Enter each utterance in a separate column.<\/div>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Classes-import.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12155 size-full\" src=\"\/wp-content\/uploads\/sites\/12\/Classes-import.jpg\" alt=\"\" width=\"882\" height=\"214\" \/><\/a><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"From_a_JSON_file\">From a JSON file<\/span><\/h3>\n<p>Kore.ai allows you to create the Knowledge Graph in JSON and upload it. You can download a sample JSON from the bot to understand its structure.<\/p>\n<p>Follow the instructions below to build your Knowledge Graph using JSON:<\/p>\n<h4>Downloading the JSON sample<\/h4>\n<ol>\n<li>Open the Knowledge Graph.<\/li>\n<li>Click <b>Import<\/b> from the left section.<\/li>\n<li>You will be prompted to\u00a0<strong>backup<\/strong> the Knowledge Graph before proceeding. Choose the CSV or JSON format for the backup.<\/li>\n<li>After backup, click <b>Proceed<\/b>.<\/li>\n<li>On the next dialog, click <b>Sample JSON<\/b>. The JSON file is downloaded to your local computer.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/KC-import2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21560\" src=\"\/wp-content\/uploads\/sites\/12\/KC-import2.png\" alt=\"\" width=\"550\" height=\"421\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094939\/KC-import2.png 550w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/12\/20221201094939\/KC-import2-300x230.png 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><\/li>\n<\/ol>\n<h4>JSON Reference<\/h4>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/FAQ-Json.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12167 size-full\" src=\"\/wp-content\/uploads\/sites\/12\/FAQ-Json.jpg\" alt=\"\" width=\"1031\" height=\"864\" \/><\/a><\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Property Name<\/strong><\/td>\n<td><strong>Type<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>FAQ<\/td>\n<td>Array<\/td>\n<td>Consists of the following:<\/p>\n<ul>\n<li>Question<\/li>\n<li>Answer<\/li>\n<li>Leaf and parent terms up to the First-level node in the path<\/li>\n<li>Alternative question<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>Question<\/td>\n<td>String<\/td>\n<td>Primary question; included in the FAQ array.<\/td>\n<\/tr>\n<tr>\n<td>Answer<\/td>\n<td>String<\/td>\n<td>Bot response; included in the FAQ array.<\/td>\n<\/tr>\n<tr>\n<td>Terms<\/td>\n<td>Array<\/td>\n<td>Includes the leaf node to which the question is added, and its parents up to the First-level node.<\/td>\n<\/tr>\n<tr>\n<td>Alternate Questions<\/td>\n<td>Array<\/td>\n<td>Consists of alternative question and terms. Include terms from leaf to the First-level node.<\/td>\n<\/tr>\n<tr>\n<td>Synonyms<\/td>\n<td>Object<\/td>\n<td>Consists arrays of terms and their synonyms.<\/td>\n<\/tr>\n<tr>\n<td>Unmappedpath<\/td>\n<td>Array<\/td>\n<td>Consists arrays of nodes that do not have any questions, and all their parents up to the First-level node.<\/td>\n<\/tr>\n<tr>\n<td>Traits<\/td>\n<td>Object<\/td>\n<td>Consists of trait names as keys and array of the utterances as values.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"You can build a Knowledge Graph in a CSV or JSON file and upload it to a bot. Similarly, you can export existing Knowledge Graph to CSV or JSON. Exporting a Knowledge Graph helps you edit it in a spreadsheet or import it to another Bot. Importing Knowledge Graph Open Knowledge Graph. You will find...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-18010","post","type-post","status-publish","format-standard","hentry","category-knowledge-task"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/18010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/comments?post=18010"}],"version-history":[{"count":11,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/18010\/revisions"}],"predecessor-version":[{"id":22695,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/18010\/revisions\/22695"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/media?parent=18010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/categories?post=18010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/tags?post=18010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}