|
51 | 51 | "id": "18d7cb3b",
|
52 | 52 | "metadata": {},
|
53 | 53 | "source": [
|
54 |
| - "### Create Ontology From Normalized JSON\n", |
| 54 | + "### Create Ontology From Normalized Data\n", |
55 | 55 | "* Users can create ontologies from a json definition of the ontology\n",
|
56 | 56 | "* See below `OntologyBuilder` section for more details on constructing the normalized ontology"
|
57 | 57 | ]
|
|
65 | 65 | "source": [
|
66 | 66 | "# This will automatically create new root schema node\n",
|
67 | 67 | "ontology_name = \"sdk-ontology\"\n",
|
68 |
| - "root_schema_node_cat_normalized_json = {\n", |
| 68 | + "root_schema_node_cat_normalized = {\n", |
69 | 69 | " 'tool': 'polygon', \n",
|
70 | 70 | " 'name': 'cat', \n",
|
71 | 71 | " 'color': 'black'\n",
|
72 | 72 | "}\n",
|
73 | 73 | "\n",
|
74 |
| - "ontology_normalized_json = {\"tools\" : [root_schema_node_cat_normalized_json], \"classifications\" : []}\n", |
75 |
| - "ontology = client.create_ontology(name = ontology_name, normalized_json = ontology_normalized_json)\n", |
| 74 | + "ontology_normalized_json = {\"tools\" : [root_schema_node_cat_normalized], \"classifications\" : []}\n", |
| 75 | + "ontology = client.create_ontology(name = ontology_name, normalized = ontology_normalized_json)\n", |
76 | 76 | "print(ontology)"
|
77 | 77 | ]
|
78 | 78 | },
|
|
94 | 94 | "outputs": [],
|
95 | 95 | "source": [
|
96 | 96 | "# First create the root schema node\n",
|
97 |
| - "root_schema_node_cat = client.create_root_schema_node(root_schema_node_cat_normalized_json)\n", |
| 97 | + "root_schema_node_cat = client.create_root_schema_node(root_schema_node_cat_normalized)\n", |
98 | 98 | "# When we create the ontology it will not re-create the schema node\n",
|
| 99 | + "print(root_schema_node_cat.uid)\n", |
99 | 100 | "ontology = client.create_ontology_from_root_schema_nodes(ontology_name, [root_schema_node_cat.uid])"
|
100 | 101 | ]
|
101 | 102 | },
|
|
118 | 119 | "outputs": [],
|
119 | 120 | "source": [
|
120 | 121 | "# Create new dog schema id \n",
|
121 |
| - "root_schema_node_dog_normalized_json = {\n", |
| 122 | + "root_schema_node_dog_normalized = {\n", |
122 | 123 | " 'tool': 'polygon', \n",
|
123 | 124 | " 'name': 'dog', \n",
|
124 | 125 | " 'color': 'black', \n",
|
125 | 126 | " 'classifications': [], \n",
|
126 | 127 | "}\n",
|
127 |
| - "root_schema_node_dog = client.create_root_schema_node(root_schema_node_cat_normalized_json)\n", |
| 128 | + "root_schema_node_dog = client.create_root_schema_node(root_schema_node_dog_normalized)\n", |
128 | 129 | "# The cat is shared between this new ontology and the one we created previously \n",
|
129 | 130 | "# (ie. the cat root schema node will not be re-created)\n",
|
130 | 131 | "ontology = client.create_ontology(ontology_name, [root_schema_node_cat.uid, root_schema_node_dog.uid])"
|
|
0 commit comments