예제 #1
0
 def get_properties(self, dataset, concept):
     dataset_id = self._get_id(dataset)
     concept_id = self._get_id(concept)
     resp = self._get(
         self._uri(
             "/{dataset_id}/concepts/{id}/properties",
             dataset_id=dataset_id,
             id=concept_id,
         ))
     return [ModelProperty.from_dict(r) for r in resp]
예제 #2
0
 def apply(self, dataset, template):
     org_id = self._get_int_id(self.session._context)
     dataset_id = self._get_int_id(dataset)
     template_id = self._get_id(template)
     resp = self._post(
         self._uri(
             "/organizations/{orgId}/templates/{templateId}/datasets/{datasetId}",
             orgId=org_id,
             templateId=template_id,
             datasetId=dataset_id,
         ))
     return [ModelProperty.from_dict(t) for t in resp]
예제 #3
0
 def update_properties(self, dataset, concept):
     assert isinstance(concept, Model), "concept must be type Model"
     assert concept.schema, "concept schema cannot be empty"
     data = concept.as_dict()["schema"]
     dataset_id = self._get_id(dataset)
     resp = self._put(
         self._uri(
             "/{dataset_id}/concepts/{id}/properties",
             dataset_id=dataset_id,
             id=concept.id,
         ),
         json=data,
     )
     return [ModelProperty.from_dict(r) for r in resp]