Merge remote-tracking branch 'origin/master' into development
# Conflicts: # api/od.py
This commit is contained in:
commit
9475b1fdc5
38 changed files with 1028 additions and 15 deletions
11
api/od.py
11
api/od.py
|
|
@ -146,7 +146,7 @@ class ODAPI:
|
|||
typ = self.cdapi.get_type(type_name)
|
||||
types = set(typ) if not include_subtypes else self.cdapi.transitive_sub_types[type_name]
|
||||
for type_of_obj in self.bottom.read_outgoing_elements(obj, "Morphism"):
|
||||
if type_of_obj in types:
|
||||
if self.get_name(type_of_obj) in types:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -154,10 +154,9 @@ class ODAPI:
|
|||
self.bottom.delete_element(obj)
|
||||
self.__recompute_mappings()
|
||||
|
||||
# Does the class of the object have the given attribute?
|
||||
# Does the the object have the given attribute?
|
||||
def has_slot(self, obj: UUID, attr_name: str):
|
||||
class_name = self.get_name(self.get_type(obj))
|
||||
return self.od.get_attr_link_name(class_name, attr_name) != None
|
||||
return self.od.get_slot_link(obj, attr_name) != None
|
||||
|
||||
def get_slots(self, obj: UUID) -> list[str]:
|
||||
return [attr_name for attr_name, _ in self.od.get_slots(obj)]
|
||||
|
|
@ -285,6 +284,7 @@ def bind_api_readonly(odapi):
|
|||
'get_target': odapi.get_target,
|
||||
'get_source': odapi.get_source,
|
||||
'get_slot': odapi.get_slot,
|
||||
'get_slots': odapi.get_slots,
|
||||
'get_slot_value': odapi.get_slot_value,
|
||||
'get_slot_value_default': odapi.get_slot_value_default,
|
||||
'get_all_instances': odapi.get_all_instances,
|
||||
|
|
@ -292,7 +292,8 @@ def bind_api_readonly(odapi):
|
|||
'get_type_name': odapi.get_type_name,
|
||||
'get_outgoing': odapi.get_outgoing,
|
||||
'get_incoming': odapi.get_incoming,
|
||||
'has_slot': odapi.has_slot
|
||||
'has_slot': odapi.has_slot,
|
||||
'is_instance': odapi.is_instance,
|
||||
}
|
||||
return funcs
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue