My last post, Microsoft, Interoperability at XML-in-Practice 2009 mentioned a project called Open Government Data Initiative (OGDI) which complements Data.gov by providing an SDK that allows you to easily access publicly available government data. It’s a pretty useful tool to quickly build applications on top of the datasets. I had a couple of questions on this project and how to interact with the PHP language and I wanted to highlight some simple ways on how you can do so.
The most interesting way you can do so is by using PHP via our Toolkit for PHP with ADO.NET Data Services. This project makes it easier for PHP developer to take advantage of the ADO.NET Data Services, a set of features now available in the .NET framework. It simply exposes data in a RESTful way via proxy classes that are generated by the toolkit at design time by using the metadata that is exposed. Your code at runtime uses these classes to work with the .NET based service over http. You can easily adapt the example given in the toolkit also described by Claudio here, to use the OGDI service.
You will want to install the toolkit as per instructions (/docs folder has a good Users Guide, it’s also available here) by copying all the files and folders into an accessible folder with the proper include_path reference in your php.ini file, as well creating the proper variables and enabling the proper extensions such as php_curl an php_xsl. This stumped quite a few folks as generating proxy classes using the PHPDataSvcUtil.php client will not work otherwise and neither will the proxy, editor or the entity you generate. With that done, you should be able to point to the uri, you want on the OGDI data service (e.g. http://ogdi.cloudapp.net/v1/dc/ ) and with that you can generate your proxy classes or Entity Container. You can find a working example that has a full browser for the data at http://ogdiphpsample.cloudapp.net/ , with source code available that you can reference. There is also an ADO.NET Data Services Client Library that can be found here in which you can build using Visual Studio 2008, Service Pack 1 or later and create a svc proxy using the above method.
There is also the ability to return your data in Geospatial form by using the Keyhole Markup Language (KML) which is compatible with popular mapping tools including Bing Maps and services from Google and yahoo. All you need to do is to append format=kml to your query just like the filters and you will be able to visualize the data that is returned. You will find some good examples of usage in the data catalog mentined earlier. That should add some interesting color to your application along with the other methods mentioned above if the data lends itself to the solution you create.
Jas Sandhu Senior Technical Evangelist, Interop Vendor Alliance Manager, Interoperability Strategy Team Twitter@jassand, FriendFeed@jassand