jDowdle.com header image 1

cfCalais – A Coldfusion tag to easily create semantic data

February 16th, 2010 · Code, coldfusion

Something that I've been interested in for a while now is the semantic web. I don't claim to be any kind of expert on it and have barely scratched the surface.

After finding about the Open Calais service from Thompson Reuters I was pretty excited. I've created a custom tag that sends data to the service which in turn returns the resulting semantic data.

The tag is pretty easy to use. Just surround the text you want to parse with the <cf_calais>  tags and off you go. The default variable returned is cfcalais. You can override this by setting the "name" attribute.

Introduction to OpenCalais

Home
If you are unfamiliar with the OpenCalais service, here is a short description:

We want to make all the world's content more accessible, interoperable and valuable. Some call it Web 2.0, Web 3.0, the Semantic Web or the Giant Global Graph - we call our piece of it Calais.

Calais is a rapidly growing toolkit of capabilities that allow you to readily incorporate state-of-the-art semantic functionality within your blog, content management system, website or application.

Taken from OpenCalais website

Tag Use

  1. Obtain a license key at http://www.opencalais.com/
  2. Place in a directory where your CFML engine can find it
  3. Wrap your content like this:
    <cf_calais name="myLittlePony" license='#myLicenseKey#'>
    Some content here
    </cf_calais>
    
  4. Use the returned data

Return Variable

A structure is returned which contains various keys depending on the content that was parsed. A full list of returned metadata returned can be found here: http://www.opencalais.com/documentation/calais-web-service-api/api-metadata/entity-index-and-definitions

For the example content (taken from tagTest.cfm):

Amazon's Kindle e-book reader is going on sale in more than 100 countries around the world, including the UK. The reader has been confined to the US since its launch in November 2007; Amazon expects to have sold a million of the devices by the end of the year. The global version will run on the 3G network, although Amazon has not specified the networks that will provide connectivity for the devices. The Kindle store will offer over 200,000 English-language titles. Hundreds of publishers are signed up including Penguin, Faber and Faber, and HarperCollins. It will also carry more than 85 US and international newspapers and magazines. "We have millions of customers in countries all over the world who read English-language books. Kindle enables these customers to think of a book and download it in less than 60 seconds," said Amazon founder Jeff Bezos. Penguin chief executive John Makinson hopes it will kickstart digital book sales in Europe. "The publishing industry is experiencing explosive growth in digital book sales in the US," he said. KINDLE IN EUROPE Amazon Kindle 0.36 inches thick with 6in e-ink display 2GB of internal memory QWERTY keyboard to add notes to text Battery life "weeks on a single charge" USB synching for people out of coverage area The look and feel of the device will be the same as the US version with the exception of network access. Following difficulties making the Kindle's Whispernet wireless download system work in the Europe, Amazon has decided to make downloads available via the 3G network. This means that people wishing to download a book outside of a 3G coverage area will have to transfer content over USB. In May of this year, Amazon unveiled a new version of its e-reader aimed at reading magazines, newspapers and documents. The Kindle DX is currently available only in the US. The European version of the Kindle will begin shipping on October 19 with a $279 (£175) price tag.

Returns a structure that would have the following keys and values:

  • Technology : 3G
  • socialTag : Technology_Internet,Printing,Ur,Mass media,E-book,Amazon Kindle,Amazon.com,Media technology,Publishing,Linux based devices,Electronic publishing,E Ink,3G
  • Country : United Kingdom,United States
  • Person : John Makinson,Jeff Bezos
  • Position : chief executive
  • Company : Amazon,Penguin
  • Facility : Kindle store
  • Currency : GBP,USD
  • Product : Kindle
  • Continent : Europe
  • IndustryTerm : e-reader,e-ink,e-book,wireless download system work,3G network

Download the tag and code here: http://github.com/jonDowdle/cfCalais

I hope you find this tag useful and let's make Coldfusion an integral part of building Web 3.0!

→ 6 CommentsTags:···

Make CF Builder and OS X Prettier

October 20th, 2009 · Uncategorized

At CFinNC, Sam Farmer mentioned that one draw back of using CF Builder as a plugin was that you don't have the CF Builder icon displayed. While I agree this isn't a huge issue, it does take a bit away from the 'experience' (OS X looks good and who are we to detract from that?)

Good news, it's an easy fix. You'll soon have a nice high-resolution icon for both your dock icons and Eclipse.app.

  1. Save the Coldfusion PNG from Wikipedia (http://en.wikipedia.org/wiki/File:ColdFusion_icon.png) to your hard drive
  2. Convert the PNG from step 1 to an ICNS and save back to your hard drive. (I used iConvert http://iconverticons.com/)
  3. Open /Applications/eclipse (or wherever you installed Eclipse)
  4. Right click on Eclipse, select Show Package Contents
  5. Go to Contents > Resources
  6. [Optional] Rename Eclipse.icns to Eclipse_old.icns
  7. Copy Eclipse.icns from step 1 into the Resources folder
  8. Launch Eclipse
  9. Enjoy.

You should then see something like this:

→ 1 CommentTags: