如何检查班级?

时间:2018-12-16 21:56:36

标签: python python-3.x class owlready

我试图了解如何检查python3类。在以下示例中,onto.search_one返回类owlready2.entity.ThingClass的对象。但是help()将类显示为class BTO_0000007(EFO_0001643, EFO_0002888)。为什么会有这样的差异?

help()还显示了哪种方法可以在命令行上打印此类信息?

 |  Method resolution order:
 |      BTO_0000007
 |      EFO_0001643
 |      EFO_0002888
 |      CL_0000010
 |      MaterialEntity
 |      EFO_0000001
 |      owlready2.individual.Thing
 |      builtins.object


In [1]: from owlready2 import *
   ...: onto = get_ontology('/tmp/EFO.owl')
   ...: onto.load()
   ...: 
Out[1]: get_ontology("http://www.ebi.ac.uk/efo/efo.owl#")

In [2]: print(type(onto.search_one(label="HEK-293 cell")))
<class 'owlready2.entity.ThingClass'>

In [3]: dir(onto.search_one(label="HEK-293 cell"))
   ...: 
Out[3]: 
['__class__',
 '__classcell__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattr__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 '_equivalent_to',
 '_get_instance_possible_relations',
 '_get_instance_prop_value',
 '_get_is_instance_of',
 '_instance_equivalent_to_changed',
 '_instance_is_a_changed',
 '_name',
 '_set_is_instance_of',
 'differents',
 'generate_default_name',
 'get_equivalent_to',
 'get_inverse_properties',
 'get_iri',
 'get_name',
 'get_properties',
 'iri',
 'is_a',
 'is_instance_of',
 'name',
 'namespace',
 'set_equivalent_to',
 'set_iri',
 'set_name',
 'storid']

In [4]: help(onto.search_one(label="HEK-293 cell"))

0 个答案:

没有答案