libSBOL  2.3.3
Public Member Functions | List of all members
PartShop Class Reference

Detailed Description

A class which provides an API front-end for online bioparts repositories.

Public Member Functions

 PartShop (std::string url, std::string spoofed_url="")
 Construct an interface to an instance of SynBioHub or other parts repository. More...
 
template<class SBOLClass >
int count ()
 Return the count of objects contained in a PartShop. More...
 
std::string sparqlQuery (std::string query)
 Issue a SPARQL query.
 
void spoof (std::string spoofed_url)
 Specify the URL of a resource that is simulated or spoofed by this PartShop.
 
void pull (std::string uri, Document &doc, bool recursive=true)
 Retrieve an object from an online resource. More...
 
void pull (std::vector< std::string > uris, Document &doc, bool recursive=true)
 Retrieve an object from an online resource. More...
 
std::string searchRootCollections ()
 Returns all Collections that are not members of any other Collections. More...
 
std::string searchSubCollections (std::string uri)
 Returns all Collections that are members of the Collection specified by its URI. More...
 
SearchResponsesearch (std::string search_text, std::string object_type, std::string property_uri, int offset=0, int limit=25)
 An EXACT search. More...
 
SearchResponsesearch (std::string search_text, std::string object_type=SBOL_COMPONENT_DEFINITION, int offset=0, int limit=25)
 A GENERAL search. More...
 
SearchResponsesearch (SearchQuery &q)
 Perform an ADVANCED search using a SearchQuery object. More...
 
int searchCount (std::string search_text, std::string object_type, std::string property_uri)
 Returns the number of search records for an EXACT search matching the given criteria. More...
 
int searchCount (std::string search_text, std::string object_type=SBOL_COMPONENT_DEFINITION)
 Returns the number of search records for a general search matching the given criteria. More...
 
int searchCount (SearchQuery &q)
 Returns the number of search records matching the given criteria for an ADVANCED search. More...
 
std::string submit (Document &doc, std::string collection="", int overwrite=0)
 Submit an SBOL Document to SynBioHub. More...
 
void login (std::string user_id, std::string password="")
 In order to submit to a PartShop, you must login first. More...
 
std::string getURL ()
 Returns the network address of the PartShop. More...
 
void attachFile (std::string topleveluri, std::string filename)
 Upload and attach a file to a TopLevel object in a PartShop. More...
 
void downloadAttachment (std::string attachment_uri, std::string path=".")
 Download a file attached to a TopLevel object in an online repository. More...
 

Constructor & Destructor Documentation

◆ PartShop()

PartShop ( std::string  url,
std::string  spoofed_url = "" 
)
inline

Construct an interface to an instance of SynBioHub or other parts repository.

Parameters
TheURL of the online repository

Member Function Documentation

◆ attachFile()

void attachFile ( std::string  topleveluri,
std::string  filename 
)

Upload and attach a file to a TopLevel object in a PartShop.

Parameters
top_level_uriThe identity of the object to which the file will be attached
file_nameA path to the file attachment

◆ count()

int count ( )

Return the count of objects contained in a PartShop.

Template Parameters
SBOLClassThe type of SBOL object, usually a ComponentDefinition

◆ downloadAttachment()

void downloadAttachment ( std::string  attachment_uri,
std::string  path = "." 
)

Download a file attached to a TopLevel object in an online repository.

Parameters
attachment_uriThe full URI of the attached object
pathThe target path to which the file will be downloaded

◆ getURL()

string getURL ( )

Returns the network address of the PartShop.

Returns
The URL of the online repository

◆ login()

void login ( std::string  user_id,
std::string  password = "" 
)

In order to submit to a PartShop, you must login first.

Register on SynBioHub to obtain account credentials.

Parameters
emailThe email associated with the user's SynBioHub account
passwordThe user's password

◆ pull() [1/2]

void pull ( std::string  uri,
Document doc,
bool  recursive = true 
)

Retrieve an object from an online resource.

Parameters
uriThe identity of the SBOL object you want to retrieve
docA document to add the data to

◆ pull() [2/2]

void pull ( std::vector< std::string >  uris,
Document doc,
bool  recursive = true 
)

Retrieve an object from an online resource.

Parameters
urisA vector of URIs for multiple SBOL objects you want to retrieve
docA document to add the data to

◆ search() [1/3]

SearchResponse & search ( std::string  search_text,
std::string  object_type,
std::string  property_uri,
int  offset = 0,
int  limit = 25 
)

An EXACT search.

Scan the parts repository for objects that exactly match the specified criteria. In most uses of this function, LibSBOL's built-in RDF type constants (see constants.h) will come in handy. For instance, searching for all SBOL_COMPONENT_DEFINITION of type BIOPAX_DNA. (These constants follow a fairly systematic and consistent naming scheme (see constants.h). The number of records returned in the search is specified by offset and limit parameters.

Parameters
search_textThis may be a literal text value or it may be a URI.
object_typeThe RDF type of an SBOL object. See constants.h. For example, SBOL_COMPONENT_DEFINITION
property_uriThe RDF type of an SBOL property. Specifies which field of an SBOL object to search. For example, SBOL_ROLES. Refer to constants.h
offsetThe index of the first record to return. This parameter is indexed starting from zero.
limitThe total count number of records to return
Returns
Metadata formatted as a string encoding JSON.

◆ search() [2/3]

SearchResponse & search ( std::string  search_text,
std::string  object_type = SBOL_COMPONENT_DEFINITION,
int  offset = 0,
int  limit = 25 
)

A GENERAL search.

Search name, description, and displayId properties for a match to the search text, including matches to substrings of the property value. The type of object to search for can be further restricted by use of the second parameter, though this is set to SBOL_COMPONENT_DEFINITION by default. See constants.h for more of libSBOL's built-in RDF type constants. These constants follow a fairly predictable and consistent naming scheme. The number of records returned in the search is specified by offset and limit parameters.

Parameters
search_textA snippet of text to search for in a property's value.
object_typeThe RDF type of an SBOL object. See constants.h. For example, SBOL_COMPONENT_DEFINITION by default.
offsetThe index of the first record to return. This parameter is indexed starting from zero.
limitThe total count number of records to return
Returns
Metadata formatted as a string encoding JSON.

◆ search() [3/3]

SearchResponse & search ( SearchQuery q)

Perform an ADVANCED search using a SearchQuery object.

Parameters
search_queryA map of string key-value pairs. Keys are objectType, sbolTag, collection, dcterms:tag, namespace/tag, offset, limit.
Returns
Search metadata A vector of maps with key-value pairs.

◆ searchCount() [1/3]

int searchCount ( std::string  search_text,
std::string  object_type,
std::string  property_uri 
)

Returns the number of search records for an EXACT search matching the given criteria.

Returns
An integer count.

◆ searchCount() [2/3]

int searchCount ( std::string  search_text,
std::string  object_type = SBOL_COMPONENT_DEFINITION 
)

Returns the number of search records for a general search matching the given criteria.

Returns
An integer count.

◆ searchCount() [3/3]

int searchCount ( SearchQuery q)

Returns the number of search records matching the given criteria for an ADVANCED search.

Parameters
search_queryA map of string key-value pairs. See SearchQuery for required and optional criteria.
Returns
An integer count.

◆ searchRootCollections()

std::string searchRootCollections ( )

Returns all Collections that are not members of any other Collections.

Parameters
docA Document to add the Collections to

◆ searchSubCollections()

std::string searchSubCollections ( std::string  uri)

Returns all Collections that are members of the Collection specified by its URI.

Parameters
uriThe URI of a Collection of Collections
docA Document to add the subcollections to

◆ submit()

std::string submit ( Document doc,
std::string  collection = "",
int  overwrite = 0 
)

Submit an SBOL Document to SynBioHub.

Parameters
docThe Document to submit
collectionThe URI of an SBOL Collection to which the Document contents will be uploaded
overwriteAn integer code: '0' prevent, '1' overwrite, '2' merge and prevent, '3' merge and overwrite

The documentation for this class was generated from the following files: