owl package

Submodules

owl.owlery_query_tools module

class vfb_connect.owl.owlery_query_tools.OWLeryConnect(endpoint='http://owl.virtualflybrain.org/kbs/vfb/', lookup=None, obo_curies=('FBbt', 'RO', 'BFO'), curies=None, obo_format=True)[source]

Bases: object

Wrapper class for querying the VFB OWLery endpoint. Unless you have specialist configuration needs, it is better to access this object with full default configurations from VfbConnect.oc.

get_instances(query, query_by_label=True, direct=False, return_short_forms=True, verbose=False)[source]

Generate list of IDs of all instances of class_expression.

Parameters:
  • class_expression – A valid OWL class expression, e.g. the name of a class.

  • query_by_label – Optional. If False`, class_expression takes CURIEs instead of labels. Default False

  • direct – Return direct instances only. Default False

  • return_short_forms – Optional. If True, returns short_forms instead of IRIs. Default True

Returns:

Returns a list of terms as nested python data structures following VFB_json or a summary_report_json

Return type:

list of IRIs or short_forms (depending on return_short_form option)

get_subclasses(query, query_by_label=True, direct=False, return_short_forms=True, verbose=False)[source]

Generate list of IDs of all subclasses of class_expression.

Parameters:
  • class_expression – A valid OWL class expression, e.g. the name of a class.

  • query_by_label – Optional. If False`, class_expression takes CURIEs instead of labels. Default False

  • direct – Return direct subclasses only. Default False

  • return_short_forms – Optional. If True, returns short_forms instead of IRIs. Default True

Returns:

Returns a list of terms as nested python data structures following VFB_json or a summary_report_json

Return type:

list of IRIs or short_forms (depending on return_short_form option)

get_superclasses(query, query_by_label=True, direct=False, return_short_forms=True, verbose=False)[source]

Generate list of IDs of all superclasses of class_expression.

Parameters:
  • class_expression – A valid OWL class expression, e.g. the name (or CURIE) of a class.

  • query_by_label – Optional. If False`, class_expression takes CURIEs instead of labels. Default False

  • direct – Return direct instances only. Default False

  • return_short_forms – Optional. If True, returns short_forms instead of IRIs. Default True

Returns:

Returns a list of terms as nested python data structures following VFB_json or a summary_report_json

Return type:

list of IRIs or short_forms (depending on return_short_form option)

labels_2_ids(query_string)[source]

Substitutes labels for CURIEs in a query string

Parameters:

query_string – A OWL class expression in which all labels of OWL entities are single-quoted. Internal

single quotes should be escaped with a backslash. :return: query string in which labels have been converted to unquoted CURIEs.

query(query_type, return_type, query, query_by_label=True, direct=False, verbose=False)[source]

A wrapper for querying Owlery Endpoints. See https://owlery.phenoscape.org/api/ for doc

Parameters:

query_type – Options: subclasses, superclasses,

equivalent, instances, types :type query: :param query: ‘Manchester syntax query with owl entities as <iri>,

curie (supporting curies declared on object) or single quoted label (if query_by_label isTrue)

Parameters:
  • query_by_label – Boolean. Default False.

  • direct – Boolean. Default False. Determines T/F

:param verbose - print verbose output to stdout for debugging purposes. :return: list of IRIs.

vfb_connect.owl.owlery_query_tools.gen_short_form(iri)[source]

Generate short_form (string) from an iri string, assuming short_form delimiters, in order of precedence: ‘#’ ‘/’. :type iri: :param iri: An iri string :return: short_form

Module contents