# A FAIR Resource Recommender System for Smart Open Scientific Inquiries
## 3 The Deep Web Communication Protocol
### Message Structure and Data Model  
Currently, DWCP uses discovery_request and discovery_response as message types. We formalize the set of allowed types as  
* discovery_request;
* discovery_response;access_path (to explicitly request a pre-defined access pattern execution);
* error (to report protocol-level errors). DWCP messages follow a consistent JSON structure. Each message includes mandatory fields for protocol version and message type. The payload varies according to the specific operation being performed. Resource discovery represents the fundamental DWCP operation. A target URL receives a discovery request from an agent. The request outlines the desired resource types and the agent's capabilities. In response, services provide structured explanations of the resources that are available, along with data schemas and access patterns. In DWCP, a discovery request \(r_{d}\) is sent to the service \(s\) to describe the agent's capabilities and the target resource (Listing 1):  
```
{'version'': ''i.0'', ''type'': ''discovery_request'', ''target'': ''[[http://caspedia.org/](http://caspedia.org/)]([http://caspedia.org/](http://caspedia.org/))'', ''capabilities'': [''form_submission'', ''table_parsing''] }
```  
Listing 1: Example of a DWCP discovery request message sent to a service. The corresponding response \(p_{d}\) from the service describes the available resources, including metadata, headers, sample rows, and the form structure (Listing 2):  
```
{ ''version'': ''i.0'', ''type'': ''discovery_response'', ''has_data'': true, ''access_type'': ''form'', ''headers'': [''Type Protein'', ''Cas ID'', ''Protein_Accession'', ''Origin''], ''sample_rows'': [ { ''Type Protein'': ''AsCas12a'', ''Cas ID'', ''3.4.3'', ''Protein_Accession'': ''WP_011454710.1'', ''Function'': ''nuclease'', ''Origin'': ''Acidaminococcus sp.'' } }, ''download_links'': ''[[http://caspedia.org/](http://caspedia.org/)]([http://caspedia.org/](http://caspedia.org/))'', ''form_type'': ''POST'', ''form_summary'': ''This form enables searching... database. '', ''form'': { ''form_action'': ''[[http://caspedia.org/](http://caspedia.org/)]([http://caspedia.org/](http://caspedia.org/))'', ''form_method'': ''post'', ''form_textarea_1'': { ''id_name'': ''search-box'', ''name'': ''query_sequence'', ''placeholder'': ''Enter FASTA sequence or search term'', ''xpath'': ''/*[@id='search-box']'' }, ''input_1'': { ''name'': ''search_type'',
```
''type'':''select'', ''value'':''sequence'', ''xpath'':''/*[Oid='search-container']/form/select'' }, ''button_1'':{ ''value'':''SearchDatabase'', ''type'':''submit'', ''xpath'':''/*[Oid='search-container']/form/input[Otype='submit']'' } } }
```
To strengthen DWCP as a standardized protocol rather than a convention, we use the following optional fields:

* message_id: A UUID identifying the message uniquely. * timestamp: ISO8601-formatted timestamp indicating when the message was generated. * session_id (optional): Identifier for a session of interactions between the agent and service (if multi-step workflows are needed). * recipient_id: Identifiers of the agent and service endpoints. These fields do not interfere with the mandatory DWCP payload structure but add robustness for real-world deployment. DWCP uses the access-type field to define three basic access patterns. Interactive interfaces that need parameter submission via HTML forms are described by form-based patterns. Resources that are available as static HTML tables are specified by direct table access patterns (\"html-table\"). Datasets accessible as downloadable files via direct links are identified by file download patterns (\"ftp\"). All of the metadata required for automated interaction is included in each access pattern. Interaction specifications, such as XPath selectors for DOM elements, parameter names and types, and submission endpoints, are provided by the form field. While sample rows offer specific instances of data that can be retrieved, the header field outlines the anticipated data structure.