BIOPAXStoreClient#

class biopax-explorer.query.client.BIOPAXStoreClient(db, dataset, credentials=None, unwanted_subject_uri=None)[source]#

Bases: object

A class for interacting with a BIOPAX RDF store.

Attributes:

db (str): The database URL. dataset (str): The dataset name. credentials (tuple): A tuple containing username and password for authentication. unwanted_subject_uri (str): URI of unwanted subjects.

Methods

custom_query_list_append(q)

Appends a custom query to the custom query list.

dbstr(pre, sfx)

Constructs a database string.

defineWrapper(url, credentials)

Defines a SPARQLWrapper instance.

define_bp_template()

Defines a BioPAX template.

delete_from_store_by_uri_id(uri_id[, ...])

Deletes data from the store by URI ID.

execute(query)

Executes a SPARQL query and returns the results as a list.

executeQuery(query)

Executes a SPARQL query.

file_to_graph(file)

Converts a file to a NetworkX graph.

insert_instance(rel)

Inserts an instance.

nxgraph([g])

Converts an RDF graph to a NetworkX graph.

rdf_xml_string([g])

Generates an RDF/XML string from a graph.

route_query(path)

Constructs a route for query.

route_update(path)

Constructs a route for update.

save_graph_as_rdf_xml(efile[, gr])

Saves a graph as an RDF/XML file.

select_all_query([limit, offset])

Performs a select all query.

store_custom_query_to_graph(extension[, labels])

Stores custom query results into a NetworkX graph.

store_to_graph([limit])

Stores RDF data into a NetworkX graph.

string_to_graph(xml)

Converts an XML string to a NetworkX graph.

update_or_insert_instance(rel)

Updates or inserts an instance.

Methods Summary

custom_query_list_append(q)

Appends a custom query to the custom query list.

dbstr(pre, sfx)

Constructs a database string.

defineWrapper(url, credentials)

Defines a SPARQLWrapper instance.

define_bp_template()

Defines a BioPAX template.

delete_from_store_by_uri_id(uri_id[, ...])

Deletes data from the store by URI ID.

execute(query)

Executes a SPARQL query and returns the results as a list.

executeQuery(query)

Executes a SPARQL query.

file_to_graph(file)

Converts a file to a NetworkX graph.

insert_instance(rel)

Inserts an instance.

nxgraph([g])

Converts an RDF graph to a NetworkX graph.

rdf_xml_string([g])

Generates an RDF/XML string from a graph.

route_query(path)

Constructs a route for query.

route_update(path)

Constructs a route for update.

save_graph_as_rdf_xml(efile[, gr])

Saves a graph as an RDF/XML file.

select_all_query([limit, offset])

Performs a select all query.

store_custom_query_to_graph(extension[, labels])

Stores custom query results into a NetworkX graph.

store_to_graph([limit])

Stores RDF data into a NetworkX graph.

string_to_graph(xml)

Converts an XML string to a NetworkX graph.

update_or_insert_instance(rel)

Updates or inserts an instance.

Methods Documentation

custom_query_list_append(q)[source]#

Appends a custom query to the custom query list.

Args:

q (str): The custom query string.

dbstr(pre, sfx)[source]#

Constructs a database string.

Args:

pre (str): The prefix. sfx (str): The suffix.

Returns:

str: The constructed database string.

defineWrapper(url, credentials)[source]#

Defines a SPARQLWrapper instance.

Args:

url (str): The URL. credentials (tuple): A tuple containing username and password for authentication.

Returns:

SPARQLWrapper: The configured SPARQLWrapper instance.

define_bp_template()[source]#

Defines a BioPAX template.

Returns:

object: The BioPAX template object.

delete_from_store_by_uri_id(uri_id, prefix=None, domain=None)[source]#

Deletes data from the store by URI ID.

Args:

uri_id (str): The URI ID. prefix (str, optional): The prefix. Defaults to None. domain (str, optional): The domain. Defaults to None.

Returns:

object: The result of the delete operation.

execute(query)[source]#

Executes a SPARQL query and returns the results as a list.

Args:

query (str): The SPARQL query string.

Returns:

list: A list of query results.

executeQuery(query)[source]#

Executes a SPARQL query.

Args:

query (str): The SPARQL query string.

Returns:

dict: The results of the query.

file_to_graph(file)[source]#

Converts a file to a NetworkX graph.

Args:

file (str): The file path.

Returns:

object: The NetworkX graph object.

insert_instance(rel)[source]#

Inserts an instance.

Args:

rel (object): The instance to insert.

Returns:

object: The result of the insert operation.

nxgraph(g=None)[source]#

Converts an RDF graph to a NetworkX graph.

Args:

g (object, optional): The RDF graph object. Defaults to None.

Returns:

object: The NetworkX graph object.

rdf_xml_string(g=None)[source]#

Generates an RDF/XML string from a graph.

Args:

g (object, optional): The graph object. Defaults to None.

Returns:

str: The RDF/XML string.

route_query(path)[source]#

Constructs a route for query.

Args:

path (str): The path.

Returns:

str: The constructed query route.

route_update(path)[source]#

Constructs a route for update.

Args:

path (str): The path.

Returns:

str: The constructed update route.

save_graph_as_rdf_xml(efile, gr=None)[source]#

Saves a graph as an RDF/XML file.

Args:

efile (str): The file path to save the RDF/XML. gr (object, optional): The graph object. Defaults to None.

Returns:

object: The graph object.

select_all_query(limit=1000, offset=0)[source]#

Performs a select all query.

Args:

limit (int, optional): The limit of records to retrieve. Defaults to 1000. offset (int, optional): The offset. Defaults to 0.

Returns:

object: The result of the select all query.

store_custom_query_to_graph(extension, labels=None)[source]#

Stores custom query results into a NetworkX graph.

Args:

extension (str): The extension for the custom query. labels (list, optional): A list of labels. Defaults to None.

Returns:

object: The NetworkX graph object.

store_to_graph(limit=1000)[source]#

Stores RDF data into a NetworkX graph.

Args:

limit (int, optional): The limit of records to retrieve. Defaults to 1000.

Returns:

object: The NetworkX graph object.

string_to_graph(xml)[source]#

Converts an XML string to a NetworkX graph.

Args:

xml (str): The XML string.

Returns:

object: The NetworkX graph object.

update_or_insert_instance(rel)[source]#

Updates or inserts an instance.

Args:

rel (object): The instance to update or insert.

Returns:

object: The result of the update or insert operation.