

def read_object(self, subject='', predicate='', object_type='', assoc='', id_only=False):
    if assoc:
        if (type(assoc) is str):
            assoc = self.read_association(assoc)
        return (assoc.o if id_only else self.read(assoc.o))
    else:
        (obj_list, assoc_list) = self.find_objects(subject=subject, predicate=predicate, object_type=object_type, id_only=True)
        if (not obj_list):
            raise NotFound(('No object found for subject=%s, predicate=%s, object_type=%s' % (subject, predicate, object_type)))
        elif (len(obj_list) > 1):
            raise Inconsistent(('More than one object found for subject=%s, predicate=%s, object_type=%s: count=%s' % (subject, predicate, object_type, len(obj_list))))
        return (obj_list[0] if id_only else self.read(obj_list[0]))

dataset/ETHPy150Open ooici/pyon/pyon/ion/resregistry.py ResourceRegistry.read_object/original