diff --git a/examples/basics/ontologies.ipynb b/examples/basics/ontologies.ipynb index 476284f35..64a13d7ff 100644 --- a/examples/basics/ontologies.ipynb +++ b/examples/basics/ontologies.ipynb @@ -227,6 +227,44 @@ "outputs": [], "execution_count": null }, + { + "metadata": {}, + "source": [ + "# Update a feature's title \n", + "client.update_feature_schema_title(feature_schema_id=feature_schema.uid, title=\"cat-2\")\n", + "feature = client.get_feature_schema(feature_schema_id=feature_schema.uid)\n", + "print(\"Feature: \", feature)" + ], + "cell_type": "code", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "source": [ + "# Replace a feature \n", + "tool = lb.Tool(feature_schema_id=feature_schema.uid, name=\"tool-cat-upserted\", tool=lb.Tool.Type.BBOX, color=\"#FF0000\")\n", + "upserted_feature_schema_id = client.upsert_feature_schema(tool.asdict()).uid\n", + "feature = client.get_feature_schema(feature_schema_id=upserted_feature_schema_id)\n", + "print(\"Updated feature: \", feature)" + ], + "cell_type": "code", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "source": [ + "# Insert a new feature \n", + "tool = lb.Tool(name=\"tool-cat-2\", tool=lb.Tool.Type.RASTER_SEGMENTATION)\n", + "feature_schema_id_new = client.create_feature_schema(tool.asdict()).uid\n", + "client.insert_feature_schema_into_ontology(feature_schema_id=feature_schema_id_new, ontology_id=ontology.uid , position=2)\n", + "print(\"Updated ontology: \", client.get_ontology(ontology_id=ontology.uid))" + ], + "cell_type": "code", + "outputs": [], + "execution_count": null + }, { "metadata": {}, "source": [ @@ -241,7 +279,19 @@ { "metadata": {}, "source": [ - "client.delete_feature_schema_from_ontology(ontology_id=ontology.uid, feature_schema_id=feature_schema.uid)" + "client.delete_feature_schema_from_ontology(ontology_id=ontology.uid, feature_schema_id=feature_schema_id_new)" + ], + "cell_type": "code", + "outputs": [], + "execution_count": null + }, + { + "metadata": {}, + "source": [ + "# Only features with annotations will be archived, features without annotations will be deleted. \n", + "feature_schema_id_with_annotations = \"\" \n", + "ontology_id = \"\"\n", + "client.unarchive_feature_schema_node(ontology_id=ontology_id, root_feature_schema_id=feature_schema_id_with_annotations)" ], "cell_type": "code", "outputs": [],