The GEOSS Discovery And Access Broker APIs
Authors: Fabrizio Papeschi, Mattia Santoro, Stefano Nativi
API version: 1.4.1-beta

DAB JavaScript API

In order to simplify the development of applications and clients making use of the DAB, this high level client-side Open APIs (Application Program Interface) have been designed and developed in JavaScript along with this documentation and the following usage examples

See also the RESTful API

Important changes from version 1.2.x

There are some important changes from the previous version 1.2.x. These changes redesigns the API in order to achieve the following goals: In particular there are the following major changes: Users of the previous versions of the API, are invited to update the code of their applications considering in particular the deprecated methods and properties depicted above.

The UI package

The UI package contains a complete set of widget and components which allow to easily create Graphical User interfaces; see here for a complete usage example.

New widgets and components as well as new functionalities for the existing ones are supplied continuously; often check these docs to be always updated!

Getting started

The DAB is modeled in this API by the DAB object which is the API entry point. DAB resources are modeled by nodes whose characteristics are described by a report. Nodes can be expanded to retrieve their content, or discovered to retrieve all the DAB nodes matching the given optional constraints. The following code snippet shows a basic discover example

    // creates a new DAB instance with the given endpoint
    var dab = GIAPI.DAB('http://api.eurogeoss-broker.eu/dab');

    // defines discover response callback function
    var onResponse = function(response){
    	
    	// retrieves the result set
    	// only one result set is expected (discover not expanded)     
        var resultSet = response[0];
    	
    	if(resultSet.error){
    	     document.writeln("Error occurred: "+resultSet.error); 
             return;
        }
        
        // retrieves the paginator   
        var paginator = resultSet.paginator;
                        
        // prints the result set
        document.writeln("<h3>- Result set -</h3>");
        document.writeln("start:"+resultSet.start+"<br>"); 
        document.writeln("size:"+resultSet.size+"<br>"); 
        document.writeln("pageCount:"+resultSet.pageCount+"<br>"); 
        document.writeln("pageIndex:"+resultSet.pageIndex+"<br>"); 
        document.writeln("pageSize:"+resultSet.pageSize+"<br>"); 
 
        // the current paginator page (the first of the result set)    
        var page = paginator.page();
        
        // printing page nodes
        document.writeln("<h3>- Nodes of first result set page-</h3>"); 
        document.writeln("<pre>"); 

        while(page.hasNext()){

            // retrieving the next page node
            var node = page.next();
        
            // retrieving the node report
            var report = node.report();     
                           
            document.writeln(JSON.stringify(report,null,4));
        }
        document.writeln("</pre>");
        document.close();
    };

    // discover constraints
    var constraints = {
        
        "where": {
            "south": 40,
            "west": -3,
            "north": 46,
            "east": 26
         },
         
         "when": {
             "from": "2000-01-01",
             "to": "2013-01-01"
         },
         
         "what": "temperature"               
    };
    
    // set page size
    var options = {
        
        "pageSize": 5           
    };
                
    // start discover
    dab.discover(onResponse, constraints, options);
    
Brokered sources are modeled by DABSource objects, a specialized type of node with the ability to be included or excluded from the discover.

Semantics-enrichment is modeled with the discover extension option which allows to retrieve more than one result set, one for each concept derived from the extension.

Access of resources is done by means of the GINode accessOptions and GINode accessLink methods.

API Usage Examples

    Demo portal build with widget and components of the UI package
    Simple demo portal which makes use of the view feature

Other usage examples will come soon!

API Dependencies

No dependencies are required since all the JavaScript libraries used by this API are included in the minified file.

Currently the API makes use of the following libraries:
  • jQuery (version currently used 1.11.3)
  • jQuery UI (version currently used 1.11.14)
  • jTable (version currently used 2.4.0)
  • YUI 2 (version currently used 2.9.0)
  • OpenLayers 2 (version currently used 2.13.1)
The following CSS is required with the API UI module components GINodeTree and ConceptTree: The following CSS is required with the API UI module component TermFrequencyWidget: If you want to apply the JQuery UI theme to the jTable of the TermFrequencyWidget, add the following script:

    <script type="text/javascript">
        $.extend(true, $.hik.jtable.prototype.options, {
            jqueryuiTheme: true
        });
    </script>
    

Support