ArmorManipulation¶
Manipulation commands for Armor Python API –ArmorPy.
-
class
armor_api.armor_manipulation_client.
ArmorManipulationClient
(client)[source]¶ Bases:
object
-
add_dataprop_to_ind
(dataprop_name, ind_name, value_type, value)[source]¶ Add a data property to an individual. If the data property to be assigned does not exist, it will be created.
Parameters: - dataprop_name (str) – name of the data property to assign.
- ind_name (str) – individual to assign the data property value.
- value_type (str) – type of the value to assign (INTEGER, INT, FLOAT, LONG, DOUBLE, STRING, BOOLEAN, BOOL).
- value (str) – value as a string.
Returns: True if ontology is consistent, else False
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR failsarmor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
Note
If value_type and value does not match, ArmorServiceInternalError may be risen or you may break your ontology consistency. Consistency can break even if you send a proper request but the ontology is expecting a different value type.
-
add_ind_to_class
(ind_name, class_name)[source]¶ Add an individual to a class.
Parameters: - ind_name (str) – individual to be added to the class.
- class_name (str) – individual will be added to this class. It will be created a new class if it does not exist.
Returns: True if ontology is consistent, else False
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR failsarmor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
-
add_objectprop_to_ind
(objectprop_name, ind_name, value_obj_name)[source]¶ Add an object property to an individual. If the object property to be assigned does not exist, it will be created.
Parameters: - objectprop_name (str) – name of the object property to assign.
- ind_name (str) – individual to assign the data property value.
- value_obj_name (str) – name of the individual to be used as property value.
Returns: True if ontology is consistent, else False
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR failsarmor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
-
replace_dataprop_b2_ind
(dataprop_name, ind_name, value_type, new_value, old_value)[source]¶ Replace the value of a data property belonging to an individual. If the individual or the property instance to be replaced do not exist, they will be created.
Parameters: - dataprop_name (str) – name of the data property to assign.
- ind_name (str) – individual to assign the data property value.
- value_type (str) – type of the value to assign (INTEGER, INT, FLOAT, LONG, DOUBLE, STRING, BOOLEAN, BOOL).
- new_value (str) – new value of the data property.
- old_value (str) – value of the data property to be replaced.
Returns: True if ontology is consistent, else False.
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR fails.armor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error.
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
Note
old_value is necessary since more than one object property instance may be applied to an individual. Only the specified instance will be replaced.
Note
If value_type and value does not match, ArmorServiceInternalError may be risen or you may break your ontology consistency. Consistency can break even if you send a proper request but the ontology is expecting a different value type.
-
replace_objectprop_b2_ind
(objectprop_name, ind_name, new_value, old_value)[source]¶ Replace the value of an object property belonging to an individual. If the individual or the property instance to be replaced do not exist, they will be created.
Parameters: - objectprop_name (str) – name of the object property to replace.
- ind_name (str) – individual whose property needs to be replaced.
- new_value (str) – new value of the object property.
- old_value (str) – value of the object property to be replaced.
Returns: True if ontology is consistent, else False.
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR fails.armor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error.
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
Note
old_value is necessary since more than one object property instance may be applied to an individual. Only the specified instance will be replaced.
-
replace_one_dataprop_b2_ind
(dataprop_name, ind_name, value_type, new_value)[source]¶ Use with care: Utility function that replace the value of the first returned data property value associated to an individual without specifying the old value to be replaced. If the individual or the property instance to be replaced do not exist, they will be created. It is supposed to be used with single valued properties.
Parameters: - dataprop_name (str) – name of the data property to assign.
- ind_name (str) – individual to assign the data property value.
- value_type (str) – type of the value to assign (INTEGER, INT, FLOAT, LONG, DOUBLE, STRING, BOOLEAN, BOOL).
- new_value (str) – value of the data property to be replaced.
Returns: True if ontology is consistent, else False.
Return type: bool
Raises: armor_api.exceptions.ArmorServiceCallError
– if call to ARMOR fails.armor_api.exceptions.ArmorServiceInternalError
– if ARMOR reports an internal error.
Note
This function is meant to be used when only one or less data property instance is expected to be associated to that individual. The function check this condition to protect your ontology and raises ArmorServiceInternalError if it is not satisfied.
Note
It returns the boolean consistency state of the ontology. This value is not updated to the last operation if you are working in buffered reasoner or manipulation mode!
Note
If value_type and value does not match, ArmorServiceInternalError may be risen or you may break your ontology consistency. Consistency can break even if you send a proper request but the ontology is expecting a different value type.
-