simphony-osp
simphony-osp copied to clipboard
Util function for querying which classes are interconnected
Related to #443, I think something along these lines could prove quite useful:
from osp.core.ontology.oclass_restriction import RTYPE, Restriction
def get_ontology_connections(subject, object):
for ax in subject.axioms:
if not isinstance(ax, Restriction) or \
ax.rtype == RTYPE.ATTRIBUTE_RESTRICTION:
continue
if object.is_subclas_of(ax.target): # Alternatively if object == ax.target:
yield ax.relationship