Showing posts with label api. Show all posts
Showing posts with label api. Show all posts

Wednesday, November 25, 2009

Ontology-Based Software Application Development -- Java and .NET


Consider the following scenario: A programmer needs to read data from a database via the JDBC interface. The system administrator of the organization provides user name and password, which obviously need to be used in the process. Then, the programmer

1. Searches the entire API for a method call (or calls), which takes a database user name as an input parameter.

2. Has to understand how various API calls should be sequenced in order to go from the connection information all the way to actually receiving data from the database.

If the APIs are not semantically rich (i.e., they contain only syntactic information, which the programmers have to read and interpret), understanding, learning and using an API can be a very time consuming task.

For a discussion of how the application of ideas from the areas of "Knowledge Management" and "Knowledge Representation" -- The enrichment of purely syntactic information of APIs with semantic information -- will allow the computer to perform certain tasks that normally the human programmer has to perform, see

http://www.aifb.uni-karlsruhe.de/WBS/aeb/smartapi/smartapi.pdf


A similar semantification of Web services (Ontology-enabled Services) is being widely discussed and implemented today.




See, for example,

http://www.cs.vu.nl/~maksym/pap/Onto-SOA-WAI.pdf

and

http://www.computer.org/portal/web/csdl/doi/10.1109/AICT-ICIW.2006.141


A number of my earlier post have been about Protégé , the popular ontology development tool, and OWL, one of the main ontology languages. To continue that discussion, see

http://www.sandsoft.com/edoc2004/KnublauchMDSW2004.pdf


which discusses a realistic application scenario -- some initial thoughts on a software architecture and a development methodology for Web services and agents for the Semantic Web. Their architecture is driven by formal domain models (ontologies).

Central to their design is Jena, a Java framework for building Semantic Web applications. It provides a programmatic environment for RDF, RDFS and OWL, SPARQL and includes a rule-based inference engine.

Jena is open source and grown out of work with the HP Labs Semantic Web Programme.

For more on Jena, see

http://jena.sourceforge.net/documentation.html

Jena is a programming toolkit that uses the Java programming language. While there are a few command-line tools to help you perform some key tasks using Jena, mostly you use Jena by writing Java programs.

But, .NET developers have similar resources. See, for example

http://www.ic.uff.br/~esteban/files/sbgames09_Alex.pdf


for a development environment using Microsoft Visual Studio, the base language C#, and the graphical library XNA. Protégé has been used for designing the ontology, and the application uses the OwlDotNetApi library.

This 2009 work demonstrates a step-by-step implementation, from the definition of an ontological knowledge base to the implementation of the main classes of a strategy game. It aims at serving as a basic reference for developers interested in starting .NET development of ontology-based applications.

Friday, June 5, 2009

Program Your Applications To "Tweet" Their Status Updates To A Private Account


Databases like Oracle and SQL Server can automatically notify the outside world when a wide variety of events occur. For example,
  • The number of patients in the the emergency room has reached its limit.
  • The number of widgets in inventory has dropped to the reorder point.
  • A long-running search has ended.
  • An X-ray or other file has been accessed by someone without authorization.

Typically, notification that such an event has occurred is generated by code contained within a database procedure.

But, database-centric applications aren’t the only kind that can programmatically generate events. For example, when a security breach, employee mishap or other emergency is detected by the code written in a Web application, notification, often via redundant channels, may be sent.

Traditionally, a text (e.g., via email server) or speech (e.g., via a speech server) message is generated. However, suddenly, tweeting (a short message sent by
Twitter) has become a popular option.

What is Twitter?

To understand the usefulness of an interface to Twitter, you need to know what Twitter is.

It's sort of like IM but without the expectation that any particular person will be there to answer. It's very public. If you start your day off with a "Hello, Mom", everyone who “follows” you (that is, who has configured their feed to include your messages) will see it. This capability is sometimes called “micro-blogging”.

However, for the scenario under discussion, you can configure Twitter to allow only the people (or person) you want to see your tweet – with or without the need to authenticate.



The Twitter API supports Basic Authentication. Basic authentication allows a user to pass in a user name/password associated with a URL. If you've ever tried to navigate to a Web site and it popped up a dialog and asked for a username and password, that site was probably protected by basic authentication. (Twitter has just recently started offering OAuth authentication.)

Messages on Twitter are called “tweets” and cannot be longer than 140 characters.

In general, the goal of Twitter for most people is to communicate and stay in touch with people you know, would like to know, or have interests in common. You follow people much like you would “friend” them on other social networks. The people you follow show up in your stream. People talk about whatever it is that's on their minds. Sometimes you'll see people replying to each other and at other times, they just want to share a thought. However, these uses are quite different from the use we’re considering here.

The Twitter API

To make calls to Twitter from a database, one needs a method for plugging into Twitter. Fortunately, Twitter provides an API for performing almost any interaction that you might wish for, including the ability to post a tweet.

The first thing to do is to set up a Twitter account for your messages. You may want to setup a special Twitter account for this purpose, rather than using your primary account.

A caveat: internet access from within a corporate firewall, especially from a database server, is an iffy proposition at best. Many places don’t allow it at all. Some do allow it via a proxy. The larger an organization, the less likely it is to allow internet access from a database server.

There are Twitter-supplied libraries for 13 programming languages:

  • C#/.NET
  • Java
  • ActionScript/Flash
  • PHP
  • Ruby
  • PL/SQL
  • JavaScript
  • C++
  • Python
  • Scala
  • Perl
  • Eiffel
  • Objective-C/Cocoa