Hello Rupert,

thanks, the annotation works fine. One more thing to add to the pom is the
following dependency

<dependency>
        <groupId>org.apache.stanbol</groupId>
        <artifactId>org.apache.stanbol.entityhub.serviceapi</artifactId>
        <version>0.11.0-SNAPSHOT</version>
</dependency>

Regards

Luigi



2013/1/10 Rupert Westenthaler <[email protected]>

> Hi Luigi
>
> To get the Entityhub injected it is typically enough to add a field
> with an @Reference annotation to your EnhancementEngine
>
>
>    @Reference
>    protected Entityhub entityhub;
>
>
> Please make sure that your pom.xml file includes the
>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-scr-plugin</artifactId>
>       </plugin>
>
> maven plugin as this will consume those annotations.
>
> If you want to use a ServiceTracker you can do so. In this case you
> need to create and open the ServiceTracker in the "activate" method
> and close it in the "deactivate" method. During operation you can
> obtain the Entityhub by calling "Entityhub entityhub =
> (Entityhub)tracker.getService();"
>
> I hope this answers your question
>
> best
> Rupert
>
>
> On Thu, Jan 10, 2013 at 4:35 PM, Gabriel Vince
> <[email protected]> wrote:
> > Hello Luigi,
> >
> > 1. to add custom enhancements to the content you can just add triples
> > to the content's metadata graph (accessible in the enhancement
> > engine).
> >
> > 2. if you really want a reference to the EntityHub, indeed you can use
> > the OSGi API (through a BundleContent from your Activator).
> >
> http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#getServiceReference%28java.lang.Class%29
> >
> >
> >
> > Carpe diem
> >                 Gabriel
> >
> > On Thu, Jan 10, 2013 at 4:18 PM, Luigi Selmi <[email protected]>
> wrote:
> >> Hi Rafa,
> >> thanks for your quick response. I know that enhancements are
> automatically
> >> stored into a triple collections for the documents metadata. Maybe my
> >> example was not clear. What I need to know is how to get a reference to
> the
> >> Entityhub using the Java API (not the REST API).
> >>
> >> Best
> >>
> >> Luigi
> >>
> >>
> >>
> >> 2013/1/10 Rafa Haro <[email protected]>
> >>
> >>> Hi Luigi,
> >>>
> >>> El 10/01/13 16:00, Luigi Selmi escribió:
> >>>
> >>>  Hello all,
> >>>> as in the subject of the email I need to store the enhancements that
> are
> >>>> extracted from some text passed to my enhancer in a ContentItem. I am
> >>>> quite
> >>>> new to Stanbol and OSGi programming and thought I should get a
> reference
> >>>> to
> >>>> the Entityhub service through its interface
> >>>>
> >>> I think that the enhancement graph is automatically store in the
> >>> ContentHub associated with the ContentItem. You can the retrieve it
> using
> >>> ContentHub REST API. Take a look to the API documentation:
> >>>
> >>> http://dev.iks-project.eu:**8081/contenthub/contenthub/**store/#<
> http://dev.iks-project.eu:8081/contenthub/contenthub/store/#>
> >>>
> >>>
> >>> Regards
> >>>
> >>>  (org.apache.stanbol.entityhub.**serviceapi.Entityhub ? ) and then call
> >>>> the
> >>>> store(..) method to store an enhancement into the Entityhub.
> Following the
> >>>> Felix documentation I should use a ServiceReference or a
> ServiceTracker to
> >>>> get the reference of the Entityhub but an enhancer in Stanbol must
> >>>> implement an EnhancementEngine interface that is different from a
> >>>> BundleActivator so I am not sure how to get the Entityhub's
> reference. Any
> >>>> help, best with some example code, will be greatly appreciated.
> >>>>
> >>>> Regards
> >>>>
> >>>> Luigi
> >>>>
> >>>>
> >>> This message should be regarded as confidential. If you have received
> this
> >>> email in error please notify the sender and destroy it immediately.
> >>> Statements of intent shall only become binding when confirmed in hard
> copy
> >>> by an authorised signatory.
> >>>
> >>> Zaizi Ltd is registered in England and Wales with the registration
> number
> >>> 6440931. The Registered Office is 222 Westbourne Studios, 242 Acklam
> Road,
> >>> London W10 5JJ, UK.
> >>>
> >>>
> >
> >
> >
> > --
> > Gabriel Vince
> > Senior Consultant
> > Apogado
> > http://www.apogado.com
>
>
>
> --
> | Rupert Westenthaler             [email protected]
> | Bodenlehenstraße 11                             ++43-699-11108907
> | A-5500 Bischofshofen
>

Reply via email to