Skip to content

Commit e2740af

Browse files
committed
able to now get and set basic ontologies
1 parent deec7f2 commit e2740af

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

labelbox/schema/ontology_generator.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def to_dict(self) -> dict:
141141
"name": self.name,
142142
"required": self.required,
143143
"color": self.color,
144-
"classifications": self.classifications,
144+
"classifications": [classification.to_dict() for classification in self.classifications],
145145
"schemaNodeId": self.schema_id,
146146
"featureSchemaId": self.feature_schema_id
147147
}
@@ -198,28 +198,10 @@ def build(self):
198198
all_classifications = []
199199

200200
for tool in self.tools:
201-
202-
all_tools.append({
203-
"tool": tool.tool.value,
204-
"name": tool.name,
205-
"required": tool.required,
206-
"color": tool.color,
207-
"classifications": [classification.to_dict() for classification in tool.classifications],
208-
"schemaNodeId": tool.schema_id,
209-
"featureSchemaId": tool.feature_schema_id
210-
211-
})
201+
all_tools.append(tool.to_dict())
212202

213203
for classification in self.classifications:
214-
all_classifications.append({
215-
"type": classification.class_type.value,
216-
"instructions": classification.instructions,
217-
"name": classification.name,
218-
"required": classification.required,
219-
"options": [option.to_dict() for option in classification.options],
220-
"schemaNodeId": classification.schema_id,
221-
"featureSchemaId": classification.feature_schema_id
222-
})
204+
all_classifications.append(classification.to_dict())
223205

224206
return {"tools": all_tools, "classifications": all_classifications}
225207

@@ -253,13 +235,14 @@ def print_stuff():
253235
# print_stuff()
254236

255237

256-
o.add_tool(tool=Tool.Type.POLYGON, name="I AM HERE FOR TESTING")
238+
# o.add_tool(tool=Tool.Type.POLYGON, name="I AM HERE FOR TESTING YET AGAIN!!")
257239
# checklist = o.add_classification(class_type=Classification.Type.CHECKLIST, instructions="I AM A CHECKLIST2")
258240
# checklist.add_option(value="checklist answer 1")
259241
# checklist.add_option(value="checklist answer 2")
260-
242+
o.add_classification(class_type=Classification.Type.TEXT, instructions="I AM TEXT INFO MAN 2")
261243

262244
# print_stuff()
245+
# print("\n\n\n\n\n")
263246
# print(o.build())
264247
# print(type(o.build()))
265248
# print(o.build())

0 commit comments

Comments
 (0)