Getting started with jena

186 views
Skip to first unread message

Lorenzo Cianciaruso

unread,
May 31, 2014, 12:11:21 PM5/31/14
to empir...@googlegroups.com
Hi to everybody,

I'm getting start using Empire with Jena. I don't understand what I have to do to configure Empire.
Can someone give me an explanation, step by step, of what I sould do?
Or link me a guide if exists, please

thank you

Lorenzo


Mike Grove

unread,
Jun 2, 2014, 7:51:36 AM6/2/14
to empir...@googlegroups.com
On Sat, May 31, 2014 at 12:11 PM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
Hi to everybody,

I'm getting start using Empire with Jena. I don't understand what I have to do to configure Empire.

Configuration is done via a simple Java properties file that is read in on startup, this [1] is the one used for tests which shows the simple case of an in-memory, ie temporary, jena backed DataSource.  You might also want to review the factory [2] which creates Jena models to get a better idea of all the configuration options available.

Cheers,

Mike

 
Can someone give me an explanation, step by step, of what I sould do?
Or link me a guide if exists, please

thank you

Lorenzo


--
You received this message because you are subscribed to the Google Groups "Empire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to empire-rdf+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lorenzo Cianciaruso

unread,
Jun 3, 2014, 3:49:32 AM6/3/14
to empir...@googlegroups.com
Ok thank you. I'm trying to run the example with jena-fuseki, I set the configuration as you told me, but I get this exception at runtime:

Exception in thread "main" javax.persistence.PersistenceException: No EntityManagerFactory have been created in the list of '1' providers available. 

What's the problem? Do I have to change anything in the Main of the example?

The idea is to use Empire to create/delete instances of classes in jena-fuseki, is it possible to this operations using Empire?

Thank you

Mike Grove

unread,
Jun 3, 2014, 6:53:26 AM6/3/14
to empir...@googlegroups.com
On Tue, Jun 3, 2014 at 3:49 AM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
Ok thank you. I'm trying to run the example with jena-fuseki, I set the configuration as you told me, but I get this exception at runtime:

Exception in thread "main" javax.persistence.PersistenceException: No EntityManagerFactory have been created in the list of '1' providers available. 

That usually means it did not find your configuration file, or it's simply incorrect.
 

What's the problem? Do I have to change anything in the Main of the example?

Hard to say.  You might try telling us what you tried so we don't have to read your mind.
 

The idea is to use Empire to create/delete instances of classes in jena-fuseki, is it possible to this operations using Empire?

Yes.  The intent is that it would work just like, say, Hibernate, but for RDF & SPARQL rather than RDBMS and SQL.

Cheers,

Mike
 

Thank you

Lorenzo Cianciaruso

unread,
Jun 3, 2014, 9:05:25 AM6/3/14
to empir...@googlegroups.com
Ok, I solved the problem and the example runs correctly now.

But I have a last doubt, what parameters should I configure to persist the data on my own jena that is running somewhere?

Thank you so much

Lorenzo 

Mike Grove

unread,
Jun 3, 2014, 9:08:47 AM6/3/14
to empir...@googlegroups.com
On Tue, Jun 3, 2014 at 9:05 AM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
Ok, I solved the problem and the example runs correctly now.

But I have a last doubt, what parameters should I configure to persist the data on my own jena that is running somewhere?

Look at how the TDB initialization works.  Or even the remote Sesame Repository based factory would be fine.  You just have to make sure Empire gets a handle to a DataSource backed by something persistent.

Cheers,

Mike

Lorenzo Cianciaruso

unread,
Jun 4, 2014, 5:06:15 AM6/4/14
to empir...@googlegroups.com
Hi,
thank you for you answers.

I have this configuration right now:

0.name = jena-test-data-source
0.factory = jena
0.type= TDB
0.localDS= jena-test-data-source
0.database_rdf.url=jdbc:jena:tdb:location=MyPathToJena-Fuseki/DB
0.location=MyPathToJena-Fuseki/DB

is it correct?

But I still have an error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/hpl/jena/graph/NodeFactory
at com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefixMap(DatasetPrefixesTDB.java:168)
at com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.getNsPrefixMap(GraphPrefixesProjection.java:62)
at com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.getPrefixMapping(DatasetPrefixesTDB.java:223)
at com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.getPrefixMapping(DatasetPrefixesTDB.java:214)
at com.hp.hpl.jena.tdb.store.GraphTriplesTDB.createPrefixMapping(GraphTriplesTDB.java:62)
at com.hp.hpl.jena.graph.impl.GraphBase.getPrefixMapping(GraphBase.java:186)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.getPrefixMapping(ModelCom.java:961)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.withDefaultMappings(ModelCom.java:1005)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:76)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:72)
at com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph(ModelFactory.java:176)
at com.hp.hpl.jena.tdb.TDBFactory.createModel(TDBFactory.java:196)
at com.clarkparsia.empire.jena.BaseJenaDataSourceFactory.getTDBModel(BaseJenaDataSourceFactory.java:98)
at com.clarkparsia.empire.jena.BaseJenaDataSourceFactory.createModel(BaseJenaDataSourceFactory.java:69)
at com.clarkparsia.empire.jena.DefaultJenaDataSourceFactory.create(DefaultJenaDataSourceFactory.java:76)
at com.clarkparsia.empire.impl.EntityManagerFactoryImpl.newEntityManager(EntityManagerFactoryImpl.java:100)
at com.clarkparsia.empire.impl.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:139)
at com.clarkparsia.empire.impl.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:130)
at com.clarkparsia.empire.examples.Main.main(Main.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

called at:

EntityManager aManager = Persistence.createEntityManagerFactory("jena-test-data-source")
                .createEntityManager();

Mike Grove

unread,
Jun 4, 2014, 6:16:54 AM6/4/14
to empir...@googlegroups.com
On Wed, Jun 4, 2014 at 5:06 AM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
Hi,
thank you for you answers.

I have this configuration right now:

0.name = jena-test-data-source
0.factory = jena
0.type= TDB
0.localDS= jena-test-data-source
0.database_rdf.url=jdbc:jena:tdb:location=MyPathToJena-Fuseki/DB
0.location=MyPathToJena-Fuseki/DB

is it correct?

But I still have an error:

This is because you have to include the Jena libraries on your classpath if you want to use Jena.

Cheers,

Mike

Lorenzo Cianciaruso

unread,
Jun 5, 2014, 10:39:57 AM6/5/14
to empir...@googlegroups.com
Thank you, now it works properly.

But unfortunately I still have the problem that the instances are not persisted on my running server. Would you kindly tell me wich are the properties that I have to configure in the configuration file?

And where are the instances stored if they are not stored on my fuseki?

Thank you

Lorenzo

Mike Grove

unread,
Jun 5, 2014, 10:43:21 AM6/5/14
to empir...@googlegroups.com
On Thu, Jun 5, 2014 at 10:39 AM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
Thank you, now it works properly.

But unfortunately I still have the problem that the instances are not persisted on my running server. Would you kindly tell me wich are the properties that I have to configure in the configuration file?

Are you persisting the objects to your EntityManager?

How do you know they're not persisted?
 

And where are the instances stored if they are not stored on my fuseki?

Are you sure you have created a DataSource backed by TDB and not in in-memory version?

Cheers,

Mike

Lorenzo Cianciaruso

unread,
Jun 5, 2014, 10:50:07 AM6/5/14
to empir...@googlegroups.com
This is the code I'm working with:

 System.setProperty("empire.configuration.file", "examples/examples.empire.config.properties");

        Empire.init(new JenaEmpireModule());

        EntityManager aManager = Persistence.createEntityManagerFactory("jena-test-data-source")
                .createEntityManager();


I know that are not persisted because if I try to get all the data stored on jena, it gives me empty set

Mike Grove

unread,
Jun 5, 2014, 11:02:13 AM6/5/14
to empir...@googlegroups.com
On Thu, Jun 5, 2014 at 10:50 AM, Lorenzo Cianciaruso <lor...@gmail.com> wrote:
This is the code I'm working with:

 System.setProperty("empire.configuration.file", "examples/examples.empire.config.properties");

        Empire.init(new JenaEmpireModule());

        EntityManager aManager = Persistence.createEntityManagerFactory("jena-test-data-source")
                .createEntityManager();


I know that are not persisted because if I try to get all the data stored on jena, it gives me empty set

Look, if you want to provide an actual working example of the behavior [1], I'll look into it.

But I can't spend my time guessing at what you might, or might not be doing, it's not a good use if my time, or yours.

Cheers,

Mike

Lorenzo Cianciaruso

unread,
Jun 5, 2014, 12:34:26 PM6/5/14
to empir...@googlegroups.com
I think that I'm working on a in-memory version, that's the point. And I should work on a datasource backed by TDB as you said. 

eshghe baghal

unread,
Jun 6, 2019, 9:51:26 AM6/6/19
to Empire
Hi Lorenzo, 
I've encountered the same error,  "javax.persistence.PersistenceException: No EntityManagerFactory has been created in the list of '0' providers available."
you mentioned it means that it has not found the configuration file, do you mean the "Empire.Configuration.java" or the "framework.config.properties"  file?
in the codes I have a pointer to the second file : 

        System.setProperty("empire.configuration.file", "src/main/resources/framework.config.properties");

...

any clue? how to solve the issue?


thanks a lot

Baghali



Thank you
To unsubscribe from this group and stop receiving emails from it, send an email to empir...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages