API Reference
Shared connector methods
Parent class of all connectors, declares the basic functions of a connector.
Source code in openlink/core/connector.py
class ToolConnector(ABC):
"""Parent class of all connectors, declares the basic functions of a connector."""
@classmethod
@abstractmethod
def get_name(cls):
"""Return the connector name.
Returns:
str: Connector name.
"""
raise NotImplementedError()
@classmethod
@abstractmethod
def get_creation_form(cls):
"""Returns class used for connector creation form.
Returns:
class: Form class needed for connector creation form.
"""
raise NotImplementedError()
@classmethod
@abstractmethod
def has_access_url(cls):
"""Return True if the mapping object can be accessed online, through an URL.
Returns:
bool: True if the mapping object be can be accessed through an URL.
"""
raise NotImplementedError()
@classmethod
@abstractmethod
def get_logo(cls):
"""Return the static path of the connector logo.
Returns:
str: Connector logo static path.
"""
raise NotImplementedError()
@classmethod
@abstractmethod
def get_color(cls):
"""Return the color of the tool.
Returns:
str: Connector color.
"""
raise NotImplementedError()
@classmethod
def has_mapping_options(cls):
"""Return True if the connector has mapping options.
Returns:
bool: True if connector has specific mapping options.
"""
raise NotImplementedError()
@abstractmethod
def get_url_link_to_an_object(self, obj_type, obj_id):
"""Get url link for a given object id and type.
Arguments:
obj_type (str): type of the object
obj_id (int): Id of an object
Returns:
str:
url for a given object
"""
raise NotImplementedError()
get_color()
classmethod
Return the color of the tool.
Returns:
| Type | Description |
|---|---|
str |
Connector color. |
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def get_color(cls):
"""Return the color of the tool.
Returns:
str: Connector color.
"""
raise NotImplementedError()
get_creation_form()
classmethod
Returns class used for connector creation form.
Returns:
| Type | Description |
|---|---|
class |
Form class needed for connector creation form. |
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def get_creation_form(cls):
"""Returns class used for connector creation form.
Returns:
class: Form class needed for connector creation form.
"""
raise NotImplementedError()
get_logo()
classmethod
Return the static path of the connector logo.
Returns:
| Type | Description |
|---|---|
str |
Connector logo static path. |
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def get_logo(cls):
"""Return the static path of the connector logo.
Returns:
str: Connector logo static path.
"""
raise NotImplementedError()
get_name()
classmethod
Return the connector name.
Returns:
| Type | Description |
|---|---|
str |
Connector name. |
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def get_name(cls):
"""Return the connector name.
Returns:
str: Connector name.
"""
raise NotImplementedError()
get_url_link_to_an_object(self, obj_type, obj_id)
Get url link for a given object id and type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj_type |
str |
type of the object |
required |
obj_id |
int |
Id of an object |
required |
Returns:
| Type | Description |
|---|---|
str |
url for a given object |
Source code in openlink/core/connector.py
@abstractmethod
def get_url_link_to_an_object(self, obj_type, obj_id):
"""Get url link for a given object id and type.
Arguments:
obj_type (str): type of the object
obj_id (int): Id of an object
Returns:
str:
url for a given object
"""
raise NotImplementedError()
has_access_url()
classmethod
Return True if the mapping object can be accessed online, through an URL.
Returns:
| Type | Description |
|---|---|
bool |
True if the mapping object be can be accessed through an URL. |
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def has_access_url(cls):
"""Return True if the mapping object can be accessed online, through an URL.
Returns:
bool: True if the mapping object be can be accessed through an URL.
"""
raise NotImplementedError()
has_mapping_options()
classmethod
Return True if the connector has mapping options.
Returns:
| Type | Description |
|---|---|
bool |
True if connector has specific mapping options. |
Source code in openlink/core/connector.py
@classmethod
def has_mapping_options(cls):
"""Return True if the connector has mapping options.
Returns:
bool: True if connector has specific mapping options.
"""
raise NotImplementedError()
Mapper connector methods
Parent class for data management connector, declares the minimum functions to map a data to openlink.
Source code in openlink/core/connector.py
class Mapper(ToolConnector):
"""Parent class for data management connector, declares the minimum
functions to map a data to openlink.
"""
@classmethod
@abstractmethod
def get_supported_types(cls, data_object=None, tool=None):
"""A list of tuples with singular ressources name and their
nomenclature equivalent in Openlink.
"""
raise NotImplementedError()
@abstractmethod
def get_space_info(self, objects_id):
"""Retrieve the size from a list of objects.
Arguments:
objects_id (list or None): A list of objects id.
Returns:
int: total size of all input objects in bytes.
"""
raise NotImplementedError()
@abstractmethod
def get_investigation(self, object_id):
"""
Retrieve an object that can be mapped to an Openlink Investigation.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_study(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Study.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_assay(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Assay.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
pass
@abstractmethod
def get_data(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Data.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_investigations(self):
"""Retrieve a list of objects that can be mapped to
an Openlink Investigation.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_studies(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Studies.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_assays(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Assays.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_datas(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Datas.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_data_object(self, data_type, object_id):
"""Launch a function depending of a given data_type,
to retrieve an object that can be mapped.
Arguments:
data_type (class): Openlink type of an object.
object_id (str): Id of an object.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_data_objects(self, data_type, reference_mapping=None, container=None):
"""Launch a function depending of a given data_type,
to retrieve a list of objects that can be mapped.
Arguments:
data_type (class): Openlink type of an object.
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
@abstractmethod
def get_plural_form_of_type(self, data_type):
"""Get a plural form of a type of data from Openlink objects.
Arguments:
data_type (class): Openlink type of an object.
Return:
str: Plural form of a type of data.
"""
raise NotImplementedError()
@abstractmethod
def get_information(self, type, id):
"""retrieves different information from the connector session (author, tags, name).
Arguments:
type (str): Openlink type of an object.
id (str): Id of an object.
Returns:
dict: Info about the object, such as tags and user
"""
raise NotImplementedError()
@abstractmethod
def download(self, object_id, path):
"""Download data from an object link in openlink path.
Arguments:
object_id (str): Id of an object.
path (str): Path to where the downloaded files will be stored.
"""
raise NotImplementedError()
@abstractmethod
def check_file_access(self, object_id):
"""Check data acces from an object id.
Arguments:
object_id (str): Id of an object.
"""
raise NotImplementedError()
check_file_access(self, object_id)
Check data acces from an object id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
Source code in openlink/core/connector.py
@abstractmethod
def check_file_access(self, object_id):
"""Check data acces from an object id.
Arguments:
object_id (str): Id of an object.
"""
raise NotImplementedError()
download(self, object_id, path)
Download data from an object link in openlink path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
path |
str |
Path to where the downloaded files will be stored. |
required |
Source code in openlink/core/connector.py
@abstractmethod
def download(self, object_id, path):
"""Download data from an object link in openlink path.
Arguments:
object_id (str): Id of an object.
path (str): Path to where the downloaded files will be stored.
"""
raise NotImplementedError()
get_assay(self, object_id)
Retrieve an object that can be mapped to an Openlink Assay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
BasicObject |
Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_assay(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Assay.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
pass
get_assays(self, reference_mapping, container)
Retrieve a list of objects that can be mapped to an Openlink Assays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_mapping |
BasicObject |
Instance of a BasicObject, needed for the retrival of the objects sought. |
required |
container |
BasicObject |
Instance of a BasicObject, container of the objects sought. |
required |
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_assays(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Assays.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_data(self, object_id)
Retrieve an object that can be mapped to an Openlink Data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
BasicObject |
Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_data(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Data.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_data_object(self, data_type, object_id)
Launch a function depending of a given data_type, to retrieve an object that can be mapped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type |
class |
Openlink type of an object. |
required |
object_id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_data_object(self, data_type, object_id):
"""Launch a function depending of a given data_type,
to retrieve an object that can be mapped.
Arguments:
data_type (class): Openlink type of an object.
object_id (str): Id of an object.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_data_objects(self, data_type, reference_mapping=None, container=None)
Launch a function depending of a given data_type, to retrieve a list of objects that can be mapped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type |
class |
Openlink type of an object. |
required |
reference_mapping |
BasicObject |
Instance of a BasicObject, needed for the retrival of the objects sought. |
None |
container |
BasicObject |
Instance of a BasicObject, container of the objects sought. |
None |
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_data_objects(self, data_type, reference_mapping=None, container=None):
"""Launch a function depending of a given data_type,
to retrieve a list of objects that can be mapped.
Arguments:
data_type (class): Openlink type of an object.
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_datas(self, reference_mapping, container)
Retrieve a list of objects that can be mapped to an Openlink Datas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_mapping |
BasicObject |
Instance of a BasicObject, needed for the retrival of the objects sought. |
required |
container |
BasicObject |
Instance of a BasicObject, container of the objects sought. |
required |
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_datas(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Datas.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_information(self, type, id)
retrieves different information from the connector session (author, tags, name).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type |
str |
Openlink type of an object. |
required |
id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
dict |
Info about the object, such as tags and user |
Source code in openlink/core/connector.py
@abstractmethod
def get_information(self, type, id):
"""retrieves different information from the connector session (author, tags, name).
Arguments:
type (str): Openlink type of an object.
id (str): Id of an object.
Returns:
dict: Info about the object, such as tags and user
"""
raise NotImplementedError()
get_investigation(self, object_id)
Retrieve an object that can be mapped to an Openlink Investigation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
BasicObject |
Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_investigation(self, object_id):
"""
Retrieve an object that can be mapped to an Openlink Investigation.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_investigations(self)
Retrieve a list of objects that can be mapped to an Openlink Investigation.
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_investigations(self):
"""Retrieve a list of objects that can be mapped to
an Openlink Investigation.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_plural_form_of_type(self, data_type)
Get a plural form of a type of data from Openlink objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type |
class |
Openlink type of an object. |
required |
Returns:
| Type | Description |
|---|---|
str |
Plural form of a type of data. |
Source code in openlink/core/connector.py
@abstractmethod
def get_plural_form_of_type(self, data_type):
"""Get a plural form of a type of data from Openlink objects.
Arguments:
data_type (class): Openlink type of an object.
Return:
str: Plural form of a type of data.
"""
raise NotImplementedError()
get_space_info(self, objects_id)
Retrieve the size from a list of objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objects_id |
list or None |
A list of objects id. |
required |
Returns:
| Type | Description |
|---|---|
int |
total size of all input objects in bytes. |
Source code in openlink/core/connector.py
@abstractmethod
def get_space_info(self, objects_id):
"""Retrieve the size from a list of objects.
Arguments:
objects_id (list or None): A list of objects id.
Returns:
int: total size of all input objects in bytes.
"""
raise NotImplementedError()
get_studies(self, reference_mapping, container)
Retrieve a list of objects that can be mapped to an Openlink Studies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_mapping |
BasicObject |
Instance of a BasicObject, needed for the retrival of the objects sought. |
required |
container |
BasicObject |
Instance of a BasicObject, container of the objects sought. |
required |
Returns:
| Type | Description |
|---|---|
list |
List of Instance of a BasicObject containing object id, name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_studies(self, reference_mapping, container):
"""Retrieve a list of objects that can be mapped to an Openlink Studies.
Arguments:
reference_mapping (BasicObject): Instance of a BasicObject, needed for the retrival of the objects sought.
container (BasicObject): Instance of a BasicObject, container of the objects sought.
Returns:
list: List of Instance of a BasicObject containing object id,
name and description.
"""
raise NotImplementedError()
get_study(self, object_id)
Retrieve an object that can be mapped to an Openlink Study.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id |
str |
Id of an object. |
required |
Returns:
| Type | Description |
|---|---|
BasicObject |
name and description. |
Source code in openlink/core/connector.py
@abstractmethod
def get_study(self, object_id):
"""Retrieve an object that can be mapped to an Openlink Study.
Arguments:
object_id (str): Id of an object.
Returns:
BasicObject: name and description.
"""
raise NotImplementedError()
get_supported_types(data_object=None, tool=None)
classmethod
A list of tuples with singular ressources name and their nomenclature equivalent in Openlink.
Source code in openlink/core/connector.py
@classmethod
@abstractmethod
def get_supported_types(cls, data_object=None, tool=None):
"""A list of tuples with singular ressources name and their
nomenclature equivalent in Openlink.
"""
raise NotImplementedError()
Publisher connector methods
Parent class for data publishing connectors, declares the minimum functions to publish a data. This class can be modified after each new publisher added.
Source code in openlink/core/connector.py
class Publisher(ToolConnector):
"""Parent class for data publishing connectors, declares the minimum
functions to publish a data.
This class can be modified after each new publisher added.
"""
@abstractmethod
def create_empty_depo(self):
"""Initiate a new depository in the publisher.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
@abstractmethod
def add_file_to_depo(self, json, path_to_file):
"""adding file in depository
Arguments:
json (json): Json structure sent by api connector requests.
path_to_file (str): path to the file downloaded by Openlink.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
@abstractmethod
def add_metadata_to_depo(self, meta, jsonr):
"""adding metadata to depository
Arguments:
meta (dict): Dictionary of metadata specific of an object from a connector.
jsonr (str): link to the depo, retrieved from a json object.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
@abstractmethod
def publish_depo(self, json):
"""publish the depository.
Arguments:
json (json): Json structure holding a usefull link to publish data.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
add_file_to_depo(self, json, path_to_file)
adding file in depository
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json |
json |
Json structure sent by api connector requests. |
required |
path_to_file |
str |
path to the file downloaded by Openlink. |
required |
Returns:
| Type | Description |
|---|---|
json |
Json structure sent by api connector requests. |
Source code in openlink/core/connector.py
@abstractmethod
def add_file_to_depo(self, json, path_to_file):
"""adding file in depository
Arguments:
json (json): Json structure sent by api connector requests.
path_to_file (str): path to the file downloaded by Openlink.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
add_metadata_to_depo(self, meta, jsonr)
adding metadata to depository
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta |
dict |
Dictionary of metadata specific of an object from a connector. |
required |
jsonr |
str |
link to the depo, retrieved from a json object. |
required |
Returns:
| Type | Description |
|---|---|
json |
Json structure sent by api connector requests. |
Source code in openlink/core/connector.py
@abstractmethod
def add_metadata_to_depo(self, meta, jsonr):
"""adding metadata to depository
Arguments:
meta (dict): Dictionary of metadata specific of an object from a connector.
jsonr (str): link to the depo, retrieved from a json object.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
create_empty_depo(self)
Initiate a new depository in the publisher.
Returns:
| Type | Description |
|---|---|
json |
Json structure sent by api connector requests. |
Source code in openlink/core/connector.py
@abstractmethod
def create_empty_depo(self):
"""Initiate a new depository in the publisher.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()
publish_depo(self, json)
publish the depository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json |
json |
Json structure holding a usefull link to publish data. |
required |
Returns:
| Type | Description |
|---|---|
json |
Json structure sent by api connector requests. |
Source code in openlink/core/connector.py
@abstractmethod
def publish_depo(self, json):
"""publish the depository.
Arguments:
json (json): Json structure holding a usefull link to publish data.
Returns:
json: Json structure sent by api connector requests.
"""
raise NotImplementedError()