2011/11/6 Paolo Castagna <[email protected]>: >> There is no such documentation yet unfortunately. > > I don't mind, is there some code example or unit test somewhere I could > look at to see how to use one of the "Enhancement Engines"?
You can start from the JAX-RS resource that publishes enhancement engines as an HTTP service: see the class EnginesRootResources This class in delegate the processing of the text to the active instance of the EnhancementJobManager service that maintains a reference on the list of registered enhancement engines. >> In order to achieve >> this you will have to startup a felix runtime (or any other OSGi >> runtime such as Eclipse Equinox for instance) and deploy the >> InMemoryJobManager, the engines you mention, the entityhub and the >> dbpedia referenced site configuration and their dependencies (you have >> the exact list of bundles in the list.xml file of the stable >> launcher), then wrap your text into a content item and use the job >> manager. > > Is it possible to add a dependency to one or more Stanbol modules and > avoid using an OSGi runtime (such Apache Felix and/or Eclipse Equinox)? The enhancement engines are OSGi services and need the runtime to find their configuration and resources. However embedding an OSGi runtime into your Java app is not such a big deal, felix is very lightweight. Here is the documentation: https://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-StandardFelixFrameworkLauncher Once you have the runtime with the deployed bundles you can lookup services using a ServiceTracker to find a service implementing the EnhancementJobManager interface and then: ContentItem ci = new InMemoryContentItem(content.getBytes("UTF-8"), "text/plain"); jobManager.enhanceContent(ci); Then you can lookup the resulting annotation in the RDF graph returned by: ci.getMetaData(); The RDF triple-based API is a bit low level unfortunately but that's the price of modularity. -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel
