Search

From ToxBank API Wiki
(Difference between revisions)
Jump to: navigation, search
m (Alerts)
(Search)
 
(62 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{REST_resource}}
 +
 
= Search =
 
= Search =
  
{{REST Operations
+
== Query language ==
|REST_op_description=Search in the default space
+
|REST_op_method=GET
+
|REST_op_uri=/query
+
|REST_op_params=TBD, search parameters, page parameters
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=URIs of the results, or in other supported format
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,400,401,402,403
+
}}
+
  
= Search Protocols =
+
Suggestion:
  
{{REST Operations
+
Queries will be passed as parameters to the search URI.  Valid query parameters are as follows:
|REST_op_description=Search protocols
+
|REST_op_method=GET
+
|REST_op_uri=/query/protocols
+
|REST_op_params=TBD, search parameters, page parameters
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=URIs of the protocols found, or in other supported format
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,400,401,402,403
+
}}
+
  
= Search Studies =
+
    keyword=some_keyword
 +
        Search only keywords for given keyword
 +
    metadata=free_text
 +
        Search all metadata for given free text
 +
    resourceType=protocol|data
 +
        Limit search to either protocol or data.  All resource types are searched if omitted.
 +
    timeModified=epoch-epoch
 +
        Limit search to give time period.  Times must be represented as seconds since the epoch.
 +
        timeModified=0 - all times equal to and after the value.
 +
        timeModified=-11111111 - all times up to and including the value.
 +
        timeMOdified=1234-11111111 - all times inclusive of value range.
  
{{REST Operations
+
== Search Ad Hoc Query ==
|REST_op_description=Search studies
+
{{HasOperation |id=Search:AdHocQuery}}
|REST_op_method=GET
+
|REST_op_uri=/query/study
+
|REST_op_params=TBD, search parameters, page parameters
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=URIs of the studies found, or in other supported format
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,400,401,402,403
+
}}
+
  
= Search Data=
+
== Get Indexed Investigation ==
 +
{{HasOperation |id=Search:GetIndexedInvestigation}}
  
{{REST Operations
+
== Get Indexed Protocol ==
|REST_op_description=Search data
+
{{HasOperation |id=Search:GetIndexedProtocol}}
|REST_op_method=GET
+
|REST_op_uri=/query/data
+
|REST_op_params=TBD, search parameters, page parameters
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=URIs of the datasets found, or in other supported format
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,400,401,402,403
+
}}
+
  
= Create a predefined query =
+
== Index Investigation ==
 +
{{HasOperation |id=Search:IndexInvestigation}}
  
{{REST Operations
+
== Index Protocol ==
|REST_op_description=Create a predefined query
+
{{HasOperation |id=Search:IndexProtocol}}
|REST_op_method=POST
+
|REST_op_uri=/query
+
|REST_op_params=TBD
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=URI of the new query, e.g. /query/Q999
+
|REST_op_mime_output=text/uri-list
+
|REST_op_status=200,400,401,402,403
+
}}
+
  
= Alerts =
+
== Delete Indexed Investigation ==
 +
{{HasOperation |id=Search:DeleteIndexedInvestigation}}
  
An alert is defined by query URI and a frequency.
+
== Delete Indexed Protocol ==
 +
{{HasOperation |id=Search:DeleteIndexedProtocol}}
  
=== [http://www.w3.org/DesignIssues/Notation3 N3] representation of an alert ===
+
== Administer Index Resources ==
<http://toxbank.net/services/alerts/Alert_33>
+
{{HasOperation |id=Search:AdministerIndexResources}}
      a      tb:Alert ;
+
      dc:title "My first alert";
+
      tb:hasQuery <http://toxbank.net/services/query/Q456>;
+
      tb:frequency tb:Daily;
+
      tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>.
+
  
== Retrieve alerts ==
+
== Keyword hierarchy ==
  
{{REST Operations
+
Web service access to ontologies
|REST_op_description=Retrieve alerts
+
|REST_op_method=GET
+
|REST_op_uri=/user/{obfuscatedid}/alerts
+
|REST_op_params=TBD, search paratemers to filter alerts
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=
+
|REST_op_result=content in supported formats
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,202,400,401,402,403
+
}}
+
  
=== cURL example ===
+
== Filtering the query ==
$curl -X GET http://toxbank.net/services/alerts -H "Accept:text/n3"
+
TBD
....
+
<http://toxbank.net/services/alerts/Alert_33>
+
      a      tb:Alert ;
+
      dc:title "My first alert";
+
      tb:hasQuery <http://toxbank.net/services/query/Q456>;
+
      tb:frequency tb:Daily;
+
      tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>.
+
<http://toxbank.net/services/alerts/Alert_34>
+
      a      tb:Alert ;
+
      dc:title "My second alert";
+
      tb:hasQuery <http://toxbank.net/services/query/Q789>;
+
      tb:frequency tb:Weekly;
+
      tb:userToBeNotified <http://toxbank.net/services/user/U8247634857324857>.
+
  
== Create an alert ==
+
= Alerts =
 
+
{{REST Operations
+
|REST_op_description=Creates an alert
+
|REST_op_method=POST
+
|REST_op_uri=/user/{obfuscatedid}/alerts
+
|REST_op_params=query uri, frequency (predefined list),name
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=Task URI, when complete - URI of the new alert , e.g. /user/U8247634857324857/alerts/Alert_5678
+
|REST_op_mime_output=text/uri-list
+
|REST_op_status=200,202,400,401,402,403
+
}}
+
 
+
=== cURL example ===
+
$curl -X POST http://toxbank.net/services/alerts -d "query=http://toxbank.net/services/query/Q789" -d "frequency=Weekly"
+
>HTTP/1.1 200 OK
+
>http://toxbank.net/services/alerts/Alert_34
+
 
+
== Retrieve an Alert ==
+
 
+
{{REST Operations
+
|REST_op_description=Retrieve an alert
+
|REST_op_method=GET
+
|REST_op_uri=/user/{obfuscatedid}/alerts/{id}
+
|REST_op_params=
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=
+
|REST_op_result=content in supported formats
+
|REST_op_mime_output=text/uri-list, RDF, JSON
+
|REST_op_status=200,202,400,401,402,403
+
}}
+
 
+
== Update an Alert ==
+
 
+
{{REST Operations
+
|REST_op_description=Update an alert
+
|REST_op_method=PUT
+
|REST_op_uri=/user/{obfuscatedid}/alerts/{id}
+
|REST_op_params=
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=application/x-www-form-urlencoded, RDF,  JSON
+
|REST_op_result=Task uri, including error reports
+
|REST_op_mime_output=text/uri-list
+
|REST_op_status=200,202,400,401,402,403
+
}}
+
 
+
== Delete an Alert ==
+
  
{{REST Operations
+
An [[API_Alert|Alert]] is defined by [[API_Query|Query]] URI ,frequency and an [[API_User|User]] to be notified.
|REST_op_description=Deletes an alert
+
|REST_op_method=DELETE
+
|REST_op_uri=/user/{obfuscatedid}/alerts/{id}
+
|REST_op_params=nons
+
|REST_header_param=subjectid:SECURITY-TOKEN
+
|REST_op_mime_input=none
+
|REST_op_result=
+
|REST_op_mime_output=text/uri-list
+
|REST_op_status=200,202,400,401,402,403
+
}}
+

Latest revision as of 20:50, 21 January 2013

Search


Contents

Search

Query language

Suggestion:

Queries will be passed as parameters to the search URI. Valid query parameters are as follows:

   keyword=some_keyword
       Search only keywords for given keyword
   metadata=free_text
       Search all metadata for given free text
   resourceType=protocol|data
       Limit search to either protocol or data.  All resource types are searched if omitted.
   timeModified=epoch-epoch
       Limit search to give time period.  Times must be represented as seconds since the epoch.
       timeModified=0 - all times equal to and after the value.
       timeModified=-11111111 - all times up to and including the value.
       timeMOdified=1234-11111111 - all times inclusive of value range.

Search Ad Hoc Query

Description Search an ad hoc query
Resource Search
Method GET
URI /search
Parameters See query language
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results URIs of the results
Media Type (output) text/uri-list
Status code 200,400,401,402,403

Links: Page, Edit with form



Get Indexed Investigation

Description Get uri of index investigation
Resource Index
Method GET
URI /search/index/investigation
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results
Media Type (output) uri of resource if it exists in index
Status code 200,400,401,402,403

Links: Page, Edit with form



Get Indexed Protocol

Description Get uri of indexed protocol
Resource Index
Method GET
URI /search/index/protocol
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results
Media Type (output) uri of resource if it exists in index
Status code 200,400,401,402,403

Links: Page, Edit with form



Index Investigation

Description Add investigation to query index
Resource Index
Method PUT
URI /search/index/investigation
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) text/uri
Results
Media Type (output)
Status code 200,400,401,402,403

Links: Page, Edit with form



Index Protocol

Description Add protocol to query index
Resource Index
Method PUT
URI /search/index/protocol
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input) text/uri
Results
Media Type (output)
Status code 200,400,401,402,403

Links: Page, Edit with form



Delete Indexed Investigation

Description Delete an indexed investigation
Resource Index
Method DELETE
URI /search/index/investigation
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results
Media Type (output)
Status code 200,400,401,402,403

Links: Page, Edit with form



Delete Indexed Protocol

Description Delete an indexed protocol
Resource Index
Method DELETE
URI /search/index/protocol
Parameters resourceUri={resourceUri}
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results
Media Type (output)
Status code 200,400,401,402,403

Links: Page, Edit with form



Administer Index Resources

Description Sync search index with actual data
Resource Index
Method POST
URI /search/index
Parameters admin=sync
Header Parameters subjectid:SECURITY-TOKEN
Media Type (input)
Results
Media Type (output)
Status code 200,400,401,402,403

Links: Page, Edit with form



Keyword hierarchy

Web service access to ontologies

Filtering the query

TBD

Alerts

An Alert is defined by Query URI ,frequency and an User to be notified.