public class SynBioHubFrontend extends Object
Constructor and Description |
---|
SynBioHubFrontend(String backendUrl)
Creates an instance of the SynBioHub API.
|
SynBioHubFrontend(String backendUrl,
int timeout)
Creates an instance of the SynBioHub API.
|
SynBioHubFrontend(String backendUrl,
String uriPrefix)
Creates an instance of the SynBioHub API.
|
SynBioHubFrontend(String backendUrl,
String uriPrefix,
int timeout)
Creates an instance of the SynBioHub API.
|
Modifier and Type | Method and Description |
---|---|
void |
addToCollection(URI collectionUri,
boolean overwrite,
File file)
Add file to an existing private collection on SynBioHub
|
void |
addToCollection(URI collectionUri,
boolean overwrite,
InputStream inputStream)
Add file to an existing private collection on SynBioHub
|
void |
addToCollection(URI collectionUri,
boolean overwrite,
SBOLDocument document)
Add SBOL document to an existing private collection on SynBioHub
|
void |
addToCollection(URI collectionUri,
boolean overwrite,
String filename)
Add file to an existing private collection on SynBioHub
|
void |
attachFile(URI topLevelUri,
File file)
Attach a file to an object in SynBioHub.
|
void |
attachFile(URI topLevelUri,
InputStream inputStream)
Attach a file to an object in SynBioHub.
|
void |
attachFile(URI topLevelUri,
InputStream inputStream,
String filename)
Attach a file to an object in SynBioHub.
|
void |
attachFile(URI topLevelUri,
String filename)
Attach a file to an object in SynBioHub.
|
void |
createCollection(String id,
String version,
String name,
String description,
String citations,
boolean overwrite)
Create a new private collection on SynBioHub
|
void |
createCollection(String id,
String version,
String name,
String description,
String citations,
boolean overwrite,
File file)
Create a new private collection on SynBioHub and add the contents of the file to this collection
|
void |
createCollection(String id,
String version,
String name,
String description,
String citations,
boolean overwrite,
InputStream inputStream)
Create a new private collection on SynBioHub and add the contents of the file to this collection
|
void |
createCollection(String id,
String version,
String name,
String description,
String citations,
boolean overwrite,
SBOLDocument document)
Create a new private collection on SynBioHub and add the contents of the
SBOL document to this collection
|
void |
createCollection(String id,
String version,
String name,
String description,
String citations,
boolean overwrite,
String filename)
Create a new private collection on SynBioHub and add the contents of the file to this collection
|
String |
getAttachment(URI attachmentUri,
OutputStream outputStream)
Retrieve an attachment from a SynBioHub instance using its URI,
and save into the provided output stream.
|
String |
getAttachment(URI attachmentUri,
String path)
Retrieve an attachment from a SynBioHub instance using its URI,
and save to the path provided.
|
String |
getBackendUrl()
Returns the URL for the SynBioHub instance.
|
int |
getCount(String objectType)
Return the total number of objects of a specified type in the repository.
|
ArrayList<IdentifiedMetadata> |
getMatchingComponentDefinitionMetadata(String name,
Set<URI> roles,
Set<URI> types,
Set<URI> collections,
Integer offset,
Integer limit)
Search the default store for ComponentDefinition instances matching a name and/or a set of roles
|
static ArrayList<WebOfRegistriesData> |
getRegistries()
Fetch data about all registries in the web of registries.
|
static ArrayList<WebOfRegistriesData> |
getRegistries(String webOfRegistriesUrl)
Fetch data about all registries in the web of registries.
|
ArrayList<IdentifiedMetadata> |
getRootCollectionMetadata()
Search the default store for Collections that are not members of any other Collections
|
SBOLDocument |
getSBOL(URI topLevelUri)
Retrieve SBOL TopLevel object from a SynBioHub instance using its URI.
|
SBOLDocument |
getSBOL(URI topLevelUri,
boolean recursive)
Retrieve SBOL TopLevel object from a SynBioHub instance using its URI.
|
ArrayList<IdentifiedMetadata> |
getSubCollectionMetadata(URI parentCollectionUri)
Search the default store for Collections that are members of the specified Collection
|
String |
getUsername()
Returns the username of the logged in user
|
boolean |
isSetUsername()
Returns if a user is logged in
|
void |
login(String email,
String password)
Login to the SynBioHub.
|
void |
logout()
Sets the user to null to indicate that no user is logged in.
|
void |
removeRegistryParts(SBOLDocument document)
Remove all parts from this registry from a given SBOL document
|
void |
removeSBOL(URI topLevelUri)
Remove SBOL TopLevel object from a SynBioHub instance using its URI.
|
void |
replaceSBOL(URI topLevelUri)
Remove SBOL TopLevel object from a SynBioHub instance using its URI,
but leave references to this object, since it is going to be replaced.
|
ArrayList<IdentifiedMetadata> |
search(SearchQuery query)
Search this SynBioHub instance for objects matching a search query
|
String |
sparqlQuery(String query)
Perform a SPARQL query
|
public SynBioHubFrontend(String backendUrl, String uriPrefix)
backendUrl
- - URL for the SynBioHub instance.uriPrefix
- - prefix for all URIs stored in this repositorypublic SynBioHubFrontend(String backendUrl)
backendUrl
- - URL for the SynBioHub instance.public SynBioHubFrontend(String backendUrl, int timeout)
backendUrl
- - URL for the SynBioHub instance.timeout
- - timeout for connections in secondspublic SynBioHubFrontend(String backendUrl, String uriPrefix, int timeout)
backendUrl
- - URL for the SynBioHub instance.uriPrefix
- - prefix for all URIs stored in this repositorytimeout
- - timeout for connections in secondspublic String getBackendUrl()
public int getCount(String objectType) throws SynBioHubException
objectType
- The object type to count
(Collection, ComponentDefinition, Sequence, ModuleDefinition, Model, etc.).SynBioHubException
- if there was an error communicating with the SynBioHubpublic SBOLDocument getSBOL(URI topLevelUri) throws SynBioHubException
topLevelUri
- The URI of the SBOL TopLevelSynBioHubException
- if there was an error communicating with the SynBioHubpublic SBOLDocument getSBOL(URI topLevelUri, boolean recursive) throws SynBioHubException
topLevelUri
- The URI of the SBOL TopLevelrecursive
- indicates if the complete SBOL document should be fetched recursivelySynBioHubException
- if there was an error communicating with the SynBioHubpublic String getAttachment(URI attachmentUri, String path) throws SynBioHubException, IOException
attachmentUri
- The URI of the SBOL Attachment objectpath
- The path to store the downloaded attachmentSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic String getAttachment(URI attachmentUri, OutputStream outputStream) throws SynBioHubException, IOException
attachmentUri
- The URI of the SBOL Attachment objectoutputStream
- The output stream to store the downloaded attachmentSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic void removeSBOL(URI topLevelUri) throws SynBioHubException
topLevelUri
- The URI of the SBOL TopLevelSynBioHubException
- if there was an error communicating with the SynBioHubpublic void replaceSBOL(URI topLevelUri) throws SynBioHubException
topLevelUri
- The URI of the SBOL TopLevelSynBioHubException
- if there was an error communicating with the SynBioHubpublic ArrayList<IdentifiedMetadata> getMatchingComponentDefinitionMetadata(String name, Set<URI> roles, Set<URI> types, Set<URI> collections, Integer offset, Integer limit) throws SynBioHubException
name
- The dcterms:title to search for, or nullroles
- A set of role URIs to search for, or nulltypes
- A set of type URIs to search for, or nullcollections
- A set of Collection URIs to search for, or nulloffset
- The offset of the results to begin at, or null to begin at 0limit
- The maximum number of results to return, or null to return all resultsSynBioHubException
- if there was an error communicating with the SynBioHubpublic ArrayList<IdentifiedMetadata> search(SearchQuery query) throws SynBioHubException
query
- the search querySynBioHubException
- if there was an error communicating with the SynBioHubpublic ArrayList<IdentifiedMetadata> getRootCollectionMetadata() throws SynBioHubException
SynBioHubException
- if there was an error communicating with the SynBioHubpublic static ArrayList<WebOfRegistriesData> getRegistries() throws SynBioHubException
SynBioHubException
- if there was an error communicating with the WebOfRegistriespublic static ArrayList<WebOfRegistriesData> getRegistries(String webOfRegistriesUrl) throws SynBioHubException
webOfRegistriesUrl
- The URL for the web-of-registries.SynBioHubException
- if there was an error communicating with the web-of-registriespublic String sparqlQuery(String query) throws SynBioHubException
query
- SPARQL query stringSynBioHubException
- if there was an error communicating with the SynBioHubpublic ArrayList<IdentifiedMetadata> getSubCollectionMetadata(URI parentCollectionUri) throws SynBioHubException
parentCollectionUri
- URI for Collection to search for member CollectionsSynBioHubException
- if there was an error communicating with the SynBioHubpublic void logout()
public boolean isSetUsername()
public String getUsername()
public void login(String email, String password) throws SynBioHubException
email
- The user's emailpassword
- The user's passwordSynBioHubException
- if there was an error communicating with the SynBioHubpublic void removeRegistryParts(SBOLDocument document)
document
- The document to remove all registry parts frompublic void attachFile(URI topLevelUri, String filename) throws SynBioHubException, FileNotFoundException
topLevelUri
- identity of the object to attach the file tofilename
- the name of the file to attachSynBioHubException
- if there was an error communicating with the SynBioHubFileNotFoundException
- if the file is not foundpublic void attachFile(URI topLevelUri, File file) throws SynBioHubException, FileNotFoundException
topLevelUri
- identity of the object to attach the file tofile
- the file to attachSynBioHubException
- if there was an error communicating with the SynBioHubFileNotFoundException
- if the file is not foundpublic void attachFile(URI topLevelUri, InputStream inputStream) throws SynBioHubException
topLevelUri
- identity of the object to attach the file toinputStream
- the inputStream to attachSynBioHubException
- if there was an error communicating with the SynBioHubpublic void attachFile(URI topLevelUri, InputStream inputStream, String filename) throws SynBioHubException
topLevelUri
- identity of the object to attach the file toinputStream
- the inputStream to attachfilename
- name of file to attachSynBioHubException
- if there was an error communicating with the SynBioHubpublic void addToCollection(URI collectionUri, boolean overwrite, SBOLDocument document) throws SynBioHubException
collectionUri
- Identity of the private collectionoverwrite
- if object exists in collection, overwrite itdocument
- the SBOL document to submitSynBioHubException
- if there was an error communicating with the SynBioHubpublic void addToCollection(URI collectionUri, boolean overwrite, String filename) throws SynBioHubException, IOException
collectionUri
- Identity of the private collectionoverwrite
- if object exists in collection, overwrite itfilename
- filename to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic void addToCollection(URI collectionUri, boolean overwrite, File file) throws SynBioHubException, IOException
collectionUri
- Identity of the private collectionoverwrite
- if object exists in collection, overwrite itfile
- file to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic void addToCollection(URI collectionUri, boolean overwrite, InputStream inputStream) throws SynBioHubException
collectionUri
- Identity of the private collectionoverwrite
- if object exists in collection, overwrite itinputStream
- inputStream to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHubpublic void createCollection(String id, String version, String name, String description, String citations, boolean overwrite) throws SynBioHubException
id
- The submission identifierversion
- The submission versionname
- The submission namedescription
- The submission descriptioncitations
- The pubMedIds for this submissionoverwrite
- if collection exists, overwrite itSynBioHubException
- if there was an error communicating with the SynBioHubpublic void createCollection(String id, String version, String name, String description, String citations, boolean overwrite, SBOLDocument document) throws SynBioHubException
id
- The submission identifierversion
- The submission versionname
- The submission namedescription
- The submission descriptioncitations
- The pubMedIds for this submissionoverwrite
- if collection exists, overwrite itdocument
- the SBOL document to submitSynBioHubException
- if there was an error communicating with the SynBioHubpublic void createCollection(String id, String version, String name, String description, String citations, boolean overwrite, String filename) throws SynBioHubException, IOException
id
- The submission identifierversion
- The submission versionname
- The submission namedescription
- The submission descriptioncitations
- The pubMedIds for this submissionoverwrite
- if collection exists, overwrite itfilename
- filename to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic void createCollection(String id, String version, String name, String description, String citations, boolean overwrite, File file) throws SynBioHubException, IOException
id
- The submission identifierversion
- The submission versionname
- The submission namedescription
- The submission descriptioncitations
- The pubMedIds for this submissionoverwrite
- if collection exists, overwrite itfile
- file to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHubIOException
- if there is an I/O errorpublic void createCollection(String id, String version, String name, String description, String citations, boolean overwrite, InputStream inputStream) throws SynBioHubException
id
- The submission identifierversion
- The submission versionname
- The submission namedescription
- The submission descriptioncitations
- The pubMedIds for this submissionoverwrite
- if collection exists, overwrite itinputStream
- inputStream to submit to SynBioHubSynBioHubException
- if there was an error communicating with the SynBioHub