Overview

The OGDI (Open Government Data Initiative) DataLab platform leverages by defaut the Microsoft Azure Platform, an open cloud-based runtime and hosting environment helping developers to quickly and easily create, deploy, manage and run applications and Web services across the Internet. The Azure platform allows developers to focus on their core business: applications and Web services. Developers uses their own existing skills (NET, Ruby, Python, Java, PHP, etc.) and their current tools and IDEs (Visual Studio, Eclipse, etc.) to develop these applications and Web services and deploy them to the cloud. For more information, please go to the homepage of the Microsoft Azure Platform.

OGDI DataLab is written in C#, leveraging ASP.NET MVC and the .NET Framework. The data service in OGDI DataLab exposes data for programmatic access via a number of formats, including the standard Open Data Protocol (OData)**, an extension to **Atom Publishing Protocol (AtomPub), Keyhole Markup Language (KML), JavaScript Object Notation (JSON) and JSONP. OGDI DataLab uses jQuery and a variety of other open source components and enables users to browse and query published data.

Querying OGDI DataLab

OGDI DataLab exposes data through REST web services. The basic format of an OGDI DataLab service call is
http://project.cloudapp.net[:8080]/v1/catalog/dataset?query, where:

  • project is the name of the deployment project for the OGDI DataLab platform in Azure (for example, "ogdifrance" for the testing instance provided by Microsoft France). Port 8080 is used starting with version 2013-06 (v6) of OGDI DataLab.
  • catalog is the name of the catalog/container (for example, "frOpenData" for the data sets in the default demo catalog).
  • dataset is the name of the data set (for example, "RennesPAV" for the one of the data sets in the frOpenData container).
  • query is your set of query parameters, expressed using a subset of the OData query syntax.
Note that OGDI DataLab currently only supports the $top, $skip, $orderby, $filter and $top query options in the OData query syntax.

Also note that if a property has a null value for a particular entity in the data set, it will be omitted entirely from the result set returned by OGDI DataLab. Your (modern) application design should take this into account and handle potentially missing properties.

Data Formats

AtomPub

By default, OGDI DataLab returns data in the Open Data Protocol (OData) format. This format extends the broadly adopted Atom Publishing Protocol and can be easily consumed by a variety of platforms, including Microsoft .NET, Java, Ruby, PHP, and Python. Refer to the code samples on the Data Browser page for examples.

JSON

OGDI DataLab can also return data in the JavaScript Object Notation (JSON) format, which can be conveniently consumed using JavaScript and other technologies. To return data in JSON format, simply append the format=json parameter to your query:

http://ogdifrance.cloudapp.net:8080/v1/frOpenData/RennesPAV/?$filter=flux eq 'VE' &format=json

JSONP

To mitigate security vulnerabilities associated with cross-site scripting attacks, Web browsers generally prevent client-side JavaScript applications originating in one network domain (for example, yourdomain.com) from making HTTP requests to other network domains (for example, the ogdi.cloudapp.net network domain that hosts the OGDI DataLab data services). This can prevent JavaScript applications hosted in another domain from making straight-forward calls to the OGDI DataLab data services, but there a variety of techniques that can be used, such as this widely-used IFRAMES-based technique.

The OGDI DataLab's data service also provides direct support for the JSONP technique. Using this technique, OGDI DataLab's data services will call a callback function that you specify, passing in the results of your query in JSON format as an input format. To use this technique, issue a query with the following additional parameters: format=json&callback=yourCallback, where yourCallback is the name of a JavaScript callback function defined on the Web page issuing the request.

Refer to the JavaScript sample one the OGDI DataLab’s Data Browser page here for an example of using JSONP with OGDI DataLab. In that sample, the AdditionalDataLoaded() function is the JSONP callback function.

RDF

OGDI DataLab can also return data in the RDF (Resource Description Framework) format. RDF is a graph model for describing formally web resources and their associated metadata. Developed by W3C, RDF is a base language for semantic Web. To return data in RDF format, simply append the format=rdf parameter to your query:

http://ogdifrance.cloudapp.net:8080/v1/frOpenData/RennesPAV/?$filter=flux eq 'VE' &format=rdf

Geospatial Data

Many of the data sets in OGDI DataLab also include geospatial data, which is returned in the KML (Keyhole Markup Language)format. This format is compatible with popular desktop and Web-based mapping technologies including Google Earth, Google Maps, ou encore Yahoo! Maps. To return geospatial data in KML format, append the format=kml parameter to your query. For example, to retrieve geospatial points in KML format for crime incidents in DC that occurred during the police department's evening shift:

http://ogdifrance.cloudapp.net:8080/v1/frOpenData/RennesPAV/?$filter=flux eq 'VE' &format=kml

Note that if the data set that you are using does not include any geospatial data, a KML query to OGDI DataLab will return an empty result set.

Paging

OGDI DataLab and the underlying Azure Table Storage service support paging through large sets of query results. The documentation for Query Timeout and Pagination in the Azure Table Storage service provides a complete description of how OGDI DataLab and the underlying Azure platform support paging. You can also refer to the "C#/ASP.NET Paging" sample on the OGDI DataLab’s Data Browser page here, which demonstrates how to perform paged queries using the WCF Data Services client library.

Client Libraries

Developers using Microsoft Visual Studio 2010 (and above) can use WCF Data Services to access data from OGDI DataLab through easy-to-use .NET classes. Within Visual Studio, this is accomplished by using the Add Service Reference feature (see .NET samples on the OGDI DataLab’s Data Browser page here). To make accessing OGDI DataLab data easier from their language of choice, developers can refer to the various libraries listed on the OData web sites. Java developers can use for example ODataJClient. Conversely, PHP developers can take advantage of the OData SDK for PHP.