Hi,

I've been thinking recently that we could make Stanbol's content
enhancement services more accessible to the average developer by
providing a simplified POJO-like client API.

A secondary idea is to use that same API for other content enhancement
services, making it possible to combine them and/or make them
interchangeable.

This means losing the flexibility of RDF, but by using an Adapter
pattern we can remain sufficiently flexible while making it much
simpler to get started with Stanbol services.

The suggested name of this API is SINR (SINR Is Not RDF). Pronounced "sinner".

Here's an initial overview of what this could look like. Comments welcome.

Simple interfaces like Category, Annotation, Keyword are used to
represent content enhancements.

Here's Category, for example (credits to Reto for this one). Plain and simple:

interface Category {
  String getId();
  String getLabel();
  Category getParent();
}

To enhance content with categories and keywords, you call the
SinrEnhancer service like this:

InputStream content = ....
String mimeType = ...
// Specifying which enhancement types are desired allows the enhancer
// to avoid doing unnecessary work, while making it possible to define
// new types of enhancements later.
Class [] desiredEnhancements = new Class[] { Category.class, Keyowrds.class };
SinrResult r = enhancer.process(content, mimeType, desiredEnhancements);

An Adapter pattern allows you to convert the SINRresult to the various
data types:

List<Category> c = r.getResultsOfType(Category.class);
List<Keyowrd> k = r.getResultsOfType(Keywords.class);

With this pattern, new enhancement types can be added without changing
the SinrEnhancer interface.

We might create two SINR implementations, one that talks to an OSGi
service directly and another one that talks to a Stanbol server over
HTTP.

WDYT?
-Bertrand

Reply via email to