Ejemplo n.º 1
0
def get_call(target):
    '''Returns the name of the SMART python client convenience method
    corresponding to the target SMART data model
    
    Expects a valid SMART data model target
    '''
    class API_Call():
        def __init__ (self, path, method):
            self.path = path
            self.method = method

    r = get_api_calls()
    call = API_Call(r[target], "GET")
    return call_name(call)
Ejemplo n.º 2
0
def get_call(target):
    """Returns the name of the SMART python client convenience method
    corresponding to the target SMART data model
    
    Expects a valid SMART data model target
    """

    class API_Call:
        def __init__(self, path, method):
            self.path = path
            self.method = method

    r = get_api_calls()
    call = API_Call(r[target], "GET")
    return call_name(call)
Ejemplo n.º 3
0
def get_call(target):
    '''Returns the name of the SMART python client convenience method
    corresponding to the target SMART data model
    
    Expects a valid SMART data model target
    '''
    
    # Local class needed by the call_name method
    class API_Call():
        def __init__ (self, path, method):
            self.path = path
            self.method = method

    # Get all the API calls from the ontology
    r = rdf_ontology.get_api_calls()
    
    # Construct an API_Call object
    call = API_Call(r[target], "GET")
    
    # Obtain and return the call name
    return call_name(call)
Ejemplo n.º 4
0
def get_model(call):
    '''Returns the name of the target SMART data model
    corresponding to the SMART python client convenience method
    
    Expects a valid SMART python client convenience method name
    '''
    
    # Local class needed by the call_name method
    class API_Call():
        def __init__ (self, path, method):
            self.path = path
            self.method = method

    # We may have to load the ontology if it is not available yet
    if not rdf_ontology.api_types:
        rdf_ontology.parse_ontology(open(APP_PATH + '/data/smart.owl').read())
            
    # Get all the API calls from the ontology
    r = rdf_ontology.get_api_calls()
    
    # Look through the api calls array until a call with matching convenience method name is found
    for target in r.keys():
        if call == call_name(API_Call(r[target], "GET")):
            return target.replace("http://smartplatforms.org/terms#","")