SADI Plugin For Protege

The SADI plugin for Protege is a collection of views, available in a single tab, that simplify the provision of SADI services.

Available to SADI service authors are views that:

Now SADI service writers can define the ontologies that their services will utilize and implement the services all from one common interface.

Table of Contents

Prerequisites

In order to use this plugin, you will need to make sure to download Protege version 4.1 or higher.

For those of you wishing to implement your SADI services with Perl, you will need to install SADI::Simple and OWL2Perl from CPAN.

SADI services written with JAVA will need a JAVA JDK version 1.6 or higher.

Finally, you will need to make sure that you have obtained and installed the plugin. You can install the plugin using Protege's "Check for plugins ..." feature. You will know that the plugin has been successfully installed when an additional "SADI" entry appears under the Window => Tabs submenu in Protege.

Features

SADI services require a lot of preliminary planning before you can realize them. One of the very first steps in creating a SADI service is to define their inputs and outputs. More often than not, a SADI service writer will use Protege to do this. Once the inputs and outputs have been defined, the next step is to define the SADI service signature and to generate an implementation. Once the implementation is complete, the next natural step is to test the service. The SADI plugin for Protege can help the user do all of these things!

Features of the SADI plugin include:

SADI Code Generator:

A view that helps you generate the scaffold of your service implementation.

SADI service generator view

SADI OWL 2 Code Generator:

A view that helps you generate JAVA classes or Perl modules from OWL entities for use with your SADI services or other OWL related projects.

SADI OWL 2 Code Generator View

SADI Simple Client:

This view provides an easy way for you to call SADI services with predefined input taken from files or with individuals selected from the Protege Individuals view.

SADI simple client view

Generating your service code

The SADI Service Generator can generate source code for SADI services in either Perl or Java. Depending on the language you wish to generate your service code in, you will see 2 subsections for this view.

One the subsections is called the SADI Service Signature section. This section remains constant regardless of whether you choose to generate services in JAVA or Perl. The second subsection is language specific and is either called Java Generator User Fields or Perl Generator User Fields. This subsection allows you to provide language specific options for generating your services. The specifics of this second subsection will be outlined later on.

SADI Service Signature

The SADI Service Signature subsection allows you to provide the key pieces of information required to describe a SADI service. In order to describe a SADI service, you need to provide:

Service Name
a name for the service that you wish to create.
Service Provider URI
a URI representing your organization (e.g. yourdomain.com); no http-prefix, and no trailing path information is allowed.
Service Type (optional)
an rdf:type URI indicating the type of service that you are creating.
Input Class
an OWL class describing the schema of a service input; this needs to be a complete OWL URI.
Output Class
an OWL class describing the schema of a service output; this needs to be a complete OWL URI.
Description
a comprehensive human readable description of your service.
Authoriative
a boolean value that indicates whether or not your service is using your resources or if you are wrapping third-party data/software.
Email Address
your email address; used to notify you of service errors, etc.
Service Endpoint (optional)
the URL where your service will be accessed.
Synchronous or Asynchronous
Synchronous services compute their full output before returning a response to the client, whereas asynchronous services return a response immediately but must be polled for the output. In general, asynchronous services are a better choice because they may run for an arbitrarily long amount of time. However, synchronous services may be more efficient in cases where trivial operations are being performed.

Generating service code in Perl

In order to generate a Perl service, select the Perl subtab on the SADI Code Generator tab, as shown below:

SADI Code Generator for Perl Services

Perl Generator User Fields

Choose a SADI Service Target Directory where the generated Perl file will be saved. Then click the Generate button to generate the file.

The newly created file will contain a complete implementation of a SADI service as a Perl CGI script. The next step is to edit the file and add your business logic to the process_it routine. To deploy the service, copy the file to the cgi-bin directory on the target server. Please note that you will need to install SADI::Simple on the target server, as well as any other Perl modules that are required by the business logic part of your service.

For more information about SADI service provision in Perl, see the appropriate documentation in Getting Help below.

Generating Service Code in JAVA

The JAVA SADI Code Generator is much like the Perl generator in that it can produce source code for your SADI services. In addition to generating source code for your SADI services, the JAVA generator can also create WAR files for you to deploy to a JAVA Servlet container like Tomcat or Jetty, as well as deploy your services locally for testing purposes. All that is needed for you to use the JAVA generator is to ensure that the Java tab is selected (as shown below):

SADI Code Generator in JAVA

There are 2 sections to this view: a SADI Service Signature section (as described above) and a Java Generator User Fields section.

Java Generator User Fields

The Java Generator User Fields subsection is where you enter configuration required for service provision in Java.

In order to successfully generate a SADI service in Java, you will need to specify a couple of things:

Depending on whether or not your service is time-consuming, you can choose to generate either a synchronous or asynchronous service skeleton.

Once you have filled out both sections of the SADI Code Generator, you can click the Generate button and your service will be generated for you!

For more information on SADI service provision in Java, see the appropriate documentation in Getting Help below.

Generating Code from OWL ontologies

OWL to Perl Generator

The OWL 2 Code Generator can generate Perl modules from your OWL classes. These classes can come from either a file or by selecting an OWL class from Protege's OWL Class Hierarchy.

OWL 2 Code Generator

To generate code from an existing ontology, make sure to select Generate Code from OWL File and to enter the absolute path to the ontology.

If you prefer to generate code for just those OWL classes that you wish to use in your service, then click on the radio button Choose OWL Class from ontology and then select the OWL class from Protege's OWL Class Hierarchy.

Next select the tab for the language you want to generate classes/modules in (Perl or Java). At the current time, only the Perl generator has been implemented. Click Generate to generate the modules (this process can take several minutes).

Testing SADI services

The SADI plugin for Protege has a very simple client that can be used to test SADI services. The SADI Simple Client view is composed of 3 sub panels: Service Invocation, Input Data and Service Results.

SADI Simple Client

Service Invocation

This sub panel is where the URL for the service is specified. Assuming that you have already specified the input for the service (using the Input Data sub panel), you can call the service by clicking on the Call Service button. If you feel like cancelling the service call, then hit Cancel.

Input Data

The Input Data sub panel allows you to either select a file to send a SADI service or to choose an OWL individual from Protege's OWL Individual view.

Choosing an individual from Protege's OWL Individual view allows you, in addition, to also save the individual in a separate file. To save the selected individual, click on the Save Input button.

Service Results

Service results are shown in the Service Results sub panel. This sub panel displays either output RDF data or error messages in the case of a failed service invocation.

FAQ

Errors while generating SADI services in JAVA

Why do I get the error java.lang.ClassNotFoundException: org.protege.common.log.ProtegeRotatingAppender?

Our plugin cannot find that class, but you knew that. You can silence this error by adding an Optional maven argument:

-Dlog4j.configuration=log4j.xml  

SADI service generation is unaffected by that reported error.

Getting help

Obtaining Human Contact

For help with this plugin, or to report any bugs or inconsistencies, feel free to contact me via email.

The best place to get information about the SADI framework is to visit the SADI home page located at http://sadiframework.org.

There are numerous mailing lists for users/developers of the SADI framework, some of the more common ones are:

Tutorials

Perl Resources

Java