@@ -1061,6 +1061,59 @@ def fork_dataset(data_id: int) -> int:
10611061 return int (data_id )
10621062
10631063
1064+ def data_feature_add_ontology (data_id : int , index : int , ontology : str ) -> bool :
1065+ """
1066+ An ontology describes the concept that are described in a feature. An
1067+ ontology is defined by an URL where the information is provided. Adds
1068+ an ontology (URL) to a given dataset feature (defined by a dataset id
1069+ and index). The dataset has to exists on OpenML and needs to have been
1070+ processed by the evaluation engine.
1071+
1072+ Parameters
1073+ ----------
1074+ data_id : int
1075+ id of the dataset to which the feature belongs
1076+ index : int
1077+ index of the feature in dataset (0-based)
1078+ ontology : str
1079+ URL to ontology (max. 256 characters)
1080+
1081+ Returns
1082+ -------
1083+ True or throws an OpenML server exception
1084+ """
1085+ upload_data : dict [str , int | str ] = {"data_id" : data_id , "index" : index , "ontology" : ontology }
1086+ openml ._api_calls ._perform_api_call ("data/feature/ontology/add" , "post" , data = upload_data )
1087+ # an error will be thrown in case the request was unsuccessful
1088+ return True
1089+
1090+
1091+ def data_feature_remove_ontology (data_id : int , index : int , ontology : str ) -> bool :
1092+ """
1093+ Removes an existing ontology (URL) from a given dataset feature (defined
1094+ by a dataset id and index). The dataset has to exists on OpenML and needs
1095+ to have been processed by the evaluation engine. Ontology needs to be
1096+ attached to the specific fearure.
1097+
1098+ Parameters
1099+ ----------
1100+ data_id : int
1101+ id of the dataset to which the feature belongs
1102+ index : int
1103+ index of the feature in dataset (0-based)
1104+ ontology : str
1105+ URL to ontology (max. 256 characters)
1106+
1107+ Returns
1108+ -------
1109+ True or throws an OpenML server exception
1110+ """
1111+ upload_data : dict [str , int | str ] = {"data_id" : data_id , "index" : index , "ontology" : ontology }
1112+ openml ._api_calls ._perform_api_call ("data/feature/ontology/remove" , "post" , data = upload_data )
1113+ # an error will be thrown in case the request was unsuccessful
1114+ return True
1115+
1116+
10641117def _topic_add_dataset (data_id : int , topic : str ) -> int :
10651118 """
10661119 Adds a topic for a dataset.
0 commit comments