Skip to content

phenoscape/python-owlery-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-owlery-client

Warning! This API is not ready for prime-time. For example, several of the response schemas are anonymous, which gives us ugly class names like owlery_client.model.inline_response2004.InlineResponse2004. We will try to get a better version released ASAP.

Python client to the OpenAPI server provided by Owlery. For details of the API, see swagger.yaml from that repository.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonExperimentalClientCodegen

Requirements.

Python >=3.9 v3.9 is needed so one can combine classmethod and property decorators to define object schema properties as classes

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import owlery_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import owlery_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import owlery_client
from pprint import pprint
from owlery_client.api import dl_queries_api
from owlery_client.model.inline_response200 import InlineResponse200
from owlery_client.model.inline_response2001 import InlineResponse2001
from owlery_client.model.inline_response2002 import InlineResponse2002
from owlery_client.model.inline_response2003 import InlineResponse2003
from owlery_client.model.inline_response2004 import InlineResponse2004
# Defining the host is optional and defaults to http://}
# See configuration.py for a list of all supported configuration parameters.
configuration = owlery_client.Configuration(
    host = "http://}"
)


# Enter a context with an instance of the API client
with owlery_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = dl_queries_api.DLQueriesApi(api_client)
    kb = "uberon" # str | label for a knowledgebase in this Owlery
object = "<http://purl.obolibrary.org/obo/UBERON_0002101>" # str | Manchester-syntax OWL class expression
prefixes = "{"obo": "http://purl.obolibrary.org/obo/", "part_of": "http://purl.obolibrary.org/obo/BFO_0000050"}" # str | JSON format prefix map, used to expand prefixes in the 'object' expression (optional)
direct = True # bool |  (optional) (default to CodegenParameter{isFormParam=false, isQueryParam=true, isPathParam=false, isHeaderParam=false, isCookieParam=false, isBodyParam=false, isContainer=false, isCollectionFormatMulti=false, isPrimitiveType=true, isModel=false, isExplode=true, baseName='direct', paramName='direct', dataType='bool', datatypeWithEnum='null', dataFormat='null', collectionFormat='null', description='null', unescapedDescription='null', baseType='null', defaultValue='True', enumName='null', style='FORM', deepObject='false', allowEmptyValue='false', example='True', jsonSchema='{
  "name" : "direct",
  "in" : "query",
  "required" : false,
  "style" : "form",
  "explode" : true,
  "schema" : {
    "type" : "boolean",
    "default" : true
  }
}', isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isBoolean=true, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isAnyType=false, isArray=false, isMap=false, isFile=false, isEnum=false, _enum=null, allowableValues=null, items=null, mostInnerItems=null, additionalProperties=null, vars=[], requiredVars=[], vendorExtensions={}, hasValidation=false, maxProperties=null, minProperties=null, isNullable=false, isDeprecated=false, required=false, maximum='null', exclusiveMaximum=false, minimum='null', exclusiveMinimum=false, maxLength=null, minLength=null, pattern='null', maxItems=null, minItems=null, uniqueItems=false, contentType=null, multipleOf=null, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false, schema=CodegenProperty{openApiType='boolean', baseName='DirectSchema', complexType='null', getter='getDirect', setter='setDirect', description='null', dataType='bool', datatypeWithEnum='bool', dataFormat='null', name='direct', min='null', max='null', defaultValue='True', defaultValueWithParam=' = data.direct;', baseType='bool', containerType='null', title='null', unescapedDescription='null', maxLength=null, minLength=null, pattern='null', example='True', jsonSchema='{
  "type" : "boolean",
  "default" : true
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=true, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='Direct', nameInSnakeCase='null', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}, content=null})
include_deprecated = True # bool | Include `owl:deprecated` terms in the result (optional) (default to CodegenParameter{isFormParam=false, isQueryParam=true, isPathParam=false, isHeaderParam=false, isCookieParam=false, isBodyParam=false, isContainer=false, isCollectionFormatMulti=false, isPrimitiveType=true, isModel=false, isExplode=true, baseName='includeDeprecated', paramName='include_deprecated', dataType='bool', datatypeWithEnum='null', dataFormat='null', collectionFormat='null', description='Include `owl:deprecated` terms in the result', unescapedDescription='Include `owl:deprecated` terms in the result', baseType='null', defaultValue='True', enumName='null', style='FORM', deepObject='false', allowEmptyValue='false', example='True', jsonSchema='{
  "name" : "includeDeprecated",
  "in" : "query",
  "description" : "Include `owl:deprecated` terms in the result",
  "required" : false,
  "style" : "form",
  "explode" : true,
  "schema" : {
    "type" : "boolean",
    "default" : true
  }
}', isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isBoolean=true, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isAnyType=false, isArray=false, isMap=false, isFile=false, isEnum=false, _enum=null, allowableValues=null, items=null, mostInnerItems=null, additionalProperties=null, vars=[], requiredVars=[], vendorExtensions={}, hasValidation=false, maxProperties=null, minProperties=null, isNullable=false, isDeprecated=false, required=false, maximum='null', exclusiveMaximum=false, minimum='null', exclusiveMinimum=false, maxLength=null, minLength=null, pattern='null', maxItems=null, minItems=null, uniqueItems=false, contentType=null, multipleOf=null, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false, schema=CodegenProperty{openApiType='boolean', baseName='IncludeDeprecatedSchema', complexType='null', getter='getIncludeDeprecated', setter='setIncludeDeprecated', description='null', dataType='bool', datatypeWithEnum='bool', dataFormat='null', name='include_deprecated', min='null', max='null', defaultValue='True', defaultValueWithParam=' = data.includeDeprecated;', baseType='bool', containerType='null', title='null', unescapedDescription='null', maxLength=null, minLength=null, pattern='null', example='True', jsonSchema='{
  "type" : "boolean",
  "default" : true
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=true, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='IncludeDeprecated', nameInSnakeCase='null', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}, content=null})

    try:
        # Equivalent classes
        api_response = api_instance.kbs_kb_equivalent_get(kbobjectprefixes=prefixesdirect=directinclude_deprecated=include_deprecated)
        pprint(api_response)
    except owlery_client.ApiException as e:
        print("Exception when calling DLQueriesApi->kbs_kb_equivalent_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://}

Class Method HTTP request Description
DLQueriesApi kbs_kb_equivalent_get GET /kbs/{kb}/equivalent Equivalent classes
DLQueriesApi kbs_kb_instances_get GET /kbs/{kb}/instances Instances
DLQueriesApi kbs_kb_satisfiable_get GET /kbs/{kb}/satisfiable Satisfiability
DLQueriesApi kbs_kb_subclasses_get GET /kbs/{kb}/subclasses Subclasses
DLQueriesApi kbs_kb_superclasses_get GET /kbs/{kb}/superclasses Superclasses
DLQueriesApi kbs_kb_types_get GET /kbs/{kb}/types Types
KnowledgebasesApi kbs_get GET /kbs List available knowledgebases
KnowledgebasesApi kbs_kb_get GET /kbs/{kb} Knowledgebase
SPARQLApi kbs_kb_expand_get GET /kbs/{kb}/expand Expand SPARQL query encoded in URL parameter
SPARQLApi kbs_kb_expand_post POST /kbs/{kb}/expand Expand SPARQL query contained in request body
SPARQLApi kbs_kb_sparql_get GET /kbs/{kb}/sparql Perform SPARQL query encoded in URL parameter
SPARQLApi kbs_kb_sparql_post POST /kbs/{kb}/sparql Perform SPARQL query contained in request body

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Authors

Author of the original API specification: Jim Balhoff (@balhoff)

Generator of the Python Client library: Robert P. Goldman (@rpgoldman)

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in owlery_client.apis and owlery_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from owlery_client.api.default_api import DefaultApi
  • from owlery_client.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import owlery_client
from owlery_client.apis import *
from owlery_client.models import *

About

Python client library for the Owlery OpenAPI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages