You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Sarven Capadisli <in...@csarven.ca> on 2013/01/16 20:19:26 UTC

Dependency issue for an enhancer using Entityhub

Hello all,

My goal is to dereference a FOAF URI and place its contents in RDF into 
the Entityhub.

It appears to be that I'm having a problem getting the dependency 
working for my enhancer. The bundle appears to be installed okay if I 
look at it under system/console/bundles and it is active.

However, under the hood, I get the following when I install the bundle:

16.01.2013 20:00:19.267 *INFO* [Background Install 
/tmp/install58447963373332243.tmp] demo.enhancer.engines.foafknows 
[eu.fusepool.demo.foaf.knows.FoafEnhancementEngine] Dependency not 
satisfied: entity
16.01.2013 20:00:19.267 *INFO* [Background Install 
/tmp/install58447963373332243.tmp] demo.enhancer.engines.foafknows 
[eu.fusepool.demo.foaf.knows.FoafEnhancementEngine] Dependency not 
satisfied: entityHubRepresentation
16.01.2013 20:00:19.267 *INFO* [Background Install 
/tmp/install58447963373332243.tmp] demo.enhancer.engines.foafknows 
[eu.fusepool.demo.foaf.knows.FoafEnhancementEngine] Not all dependencies 
satisified, cannot activate
16.01.2013 20:00:19.273 *INFO* [FelixDispatchQueue] 
demo.enhancer.engines.foafknows BundleEvent STARTED

If I actually try to run the chain:

curl -X POST -H "Accept: text/turtle" -H "Content-type: text/plain" 
--data "foo" http://localhost:8080/enhancer/chain/FOAFChain

understandably, I get an HTTP ERROR 500:

Error 500 Enhancement Chain failed because of required Engine 
'demoEngine' failed with Message: Unable to process ContentItem 
'&lt;urn:content-item-sha1-0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33&gt;' 
with Enhancement Engine 'demoEngine' because the engine is currently not 
active!



My pom.xml contains:

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

In my engine, I have the following key imports:

import org.apache.stanbol.entityhub.servicesapi.Entityhub;
import org.apache.stanbol.entityhub.servicesapi.EntityhubException;
import org.apache.stanbol.entityhub.servicesapi.model.Entity;
import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
import org.apache.stanbol.entityhub.servicesapi.model.Representation;

I have following references:

@Reference private Entityhub entityHub;
@Reference private Entity entity;
@Reference private Representation entityHubRepresentation;


and in my computeEnhancements():

Graph csarvenGraph = getURI("http://csarven.ca/contacts");

entityHubRepresentation.add("csarvenGraph", csarvenGraph);

Representation r = entity.getRepresentation();

Entity e = entityHub.store(r);


My understanding about how loading entities into the Entityhub is 
supposed to work is that, in order to store into the entityhub it needs 
to pass some representation of it. For that to happen, a representation 
of some RDF graph is (temporarily?) added - although I don't think I 
understand what "representation" really means here - and then that 
representation is passed to entityHub.store().

I'm not certain if in the right direction, so, any help is appreciated. 
:) If someone can point me to a small "load entities into entityhub with 
the Java API" example, that'd be great as well.


Thanks!

http://csarven.ca/#i


Re: Dependency issue for an enhancer using Entityhub

Posted by Rupert Westenthaler <ru...@gmail.com>.
Hi Sarven

On Wed, Jan 16, 2013 at 8:19 PM, Sarven Capadisli <in...@csarven.ca> wrote:
> @Reference private Entity entity;
> @Reference private Representation entityHubRepresentation;

Entity and Representation are no Services. You will need to use the
API of the Entityhub to CRUD with Entities and their Representation.
Injecting them via @Reference will not work

best
Rupert



--
| Rupert Westenthaler             rupert.westenthaler@gmail.com
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen

Re: Dependency issue for an enhancer using Entityhub

Posted by Reto Bachmann-Gmür <re...@apache.org>.
Hi Sarven

The bundle is satified but your component is not.

You're referencing 3 services with

@Reference private Entityhub entityHub;
@Reference private Entity entity;
@Reference private Representation entityHubRepresentation;

But only the entityHub is available as service.

One way to see what services are available it to use the shell to which you
can connect with: ssh -l admin localhost:8022

zz>$[Entityhub]
res1: org.apache.stanbol.entityhub.servicesapi.Entityhub =
org.apache.stanbol.entityhub.core.impl.EntityhubImpl@2f8f12a8
zz>$[Entity]
res2: org.apache.stanbol.entityhub.servicesapi.model.Entity = null
zz>$[Representation]
res3: org.apache.stanbol.entityhub.servicesapi.model.Representation = null
zz>

So here you can see that there is a service for Entityhub but not for
Entity  and Representation.

Cheers,
Reto


On Wed, Jan 16, 2013 at 8:19 PM, Sarven Capadisli <in...@csarven.ca> wrote:

> Hello all,
>
> My goal is to dereference a FOAF URI and place its contents in RDF into
> the Entityhub.
>
> It appears to be that I'm having a problem getting the dependency working
> for my enhancer. The bundle appears to be installed okay if I look at it
> under system/console/bundles and it is active.
>
> However, under the hood, I get the following when I install the bundle:
>
> 16.01.2013 20:00:19.267 *INFO* [Background Install
> /tmp/install58447963373332243.**tmp] demo.enhancer.engines.**foafknows
> [eu.fusepool.demo.foaf.knows.**FoafEnhancementEngine] Dependency not
> satisfied: entity
> 16.01.2013 20:00:19.267 *INFO* [Background Install
> /tmp/install58447963373332243.**tmp] demo.enhancer.engines.**foafknows
> [eu.fusepool.demo.foaf.knows.**FoafEnhancementEngine] Dependency not
> satisfied: entityHubRepresentation
> 16.01.2013 20:00:19.267 *INFO* [Background Install
> /tmp/install58447963373332243.**tmp] demo.enhancer.engines.**foafknows
> [eu.fusepool.demo.foaf.knows.**FoafEnhancementEngine] Not all
> dependencies satisified, cannot activate
> 16.01.2013 20:00:19.273 *INFO* [FelixDispatchQueue] demo.enhancer.engines.
> **foafknows BundleEvent STARTED
>
> If I actually try to run the chain:
>
> curl -X POST -H "Accept: text/turtle" -H "Content-type: text/plain" --data
> "foo" http://localhost:8080/**enhancer/chain/FOAFChain<http://localhost:8080/enhancer/chain/FOAFChain>
>
> understandably, I get an HTTP ERROR 500:
>
> Error 500 Enhancement Chain failed because of required Engine 'demoEngine'
> failed with Message: Unable to process ContentItem
> '&lt;urn:content-item-sha1-**0beec7b5ea3f0fdbc95d0dd47f3c5b**c275da8a33&gt;'
> with Enhancement Engine 'demoEngine' because the engine is currently not
> active!
>
>
>
> My pom.xml contains:
>
> <dependency>
>   <groupId>org.apache.stanbol</**groupId>
>   <artifactId>org.apache.**stanbol.entityhub.servicesapi<**/artifactId>
>   <version>0.11.0-SNAPSHOT</**version>
> </dependency>
> <dependency>
>   <groupId>org.apache.stanbol</**groupId>
>   <artifactId>org.apache.**stanbol.entityhub.core</**artifactId>
>   <version>0.11.0-SNAPSHOT</**version>
> </dependency>
>
> In my engine, I have the following key imports:
>
> import org.apache.stanbol.entityhub.**servicesapi.Entityhub;
> import org.apache.stanbol.entityhub.**servicesapi.**EntityhubException;
> import org.apache.stanbol.entityhub.**servicesapi.model.Entity;
> import org.apache.stanbol.entityhub.**servicesapi.query.FieldQuery;
> import org.apache.stanbol.entityhub.**servicesapi.query.**QueryResultList;
> import org.apache.stanbol.entityhub.**servicesapi.model.**Representation;
>
> I have following references:
>
> @Reference private Entityhub entityHub;
> @Reference private Entity entity;
> @Reference private Representation entityHubRepresentation;
>
>
> and in my computeEnhancements():
>
> Graph csarvenGraph = getURI("http://csarven.ca/**contacts<http://csarven.ca/contacts>
> ");
>
> entityHubRepresentation.add("**csarvenGraph", csarvenGraph);
>
> Representation r = entity.getRepresentation();
>
> Entity e = entityHub.store(r);
>
>
> My understanding about how loading entities into the Entityhub is supposed
> to work is that, in order to store into the entityhub it needs to pass some
> representation of it. For that to happen, a representation of some RDF
> graph is (temporarily?) added - although I don't think I understand what
> "representation" really means here - and then that representation is passed
> to entityHub.store().
>
> I'm not certain if in the right direction, so, any help is appreciated. :)
> If someone can point me to a small "load entities into entityhub with the
> Java API" example, that'd be great as well.
>
>
> Thanks!
>
> http://csarven.ca/#i
>
>