Auto generation of entity classes from Owlim Repository

71 views
Skip to first unread message

Paul

unread,
Jan 30, 2012, 7:18:42 AM1/30/12
to Empire, palit.s...@gmail.com
Hi.
I'm very new to semantic web. I noticed that only Empire implements
JPA for RDF and SPARQL. So I decided to use it for my current project.
I'm accessing a Owlim repository trough sesame. I tried to use
com.clarkparsia.empire.codegen.BeanGenerator to auto generate
JavaBeans from the database. I'm using the following code:

try{

BeanGenerator.generateSourceFiles("com.someapps.empiretest.entity",new
URL(""), RDFFormat.RDFXML, new File("src/com/someapps/empiretest/
entity"));
} catch (Exception e){
e.printStackTrace();
}

I'm getting the following error.

java.io.FileNotFoundException: http://localhost:9080/openrdf-sesame/repository/owlim-se-test
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1610)
at java.net.URL.openStream(URL.java:1035)
at
com.clarkparsia.empire.codegen.BeanGenerator.generateSourceFiles(Unknown
Source)
at com.snetapps.empiretest.Main.main(Main.java:167)

However I can generate the pojos from a local owl or rdf file.

How can I generate the pojos directly from the repository.

Thanking all.

PAUL

Paul

unread,
Jan 30, 2012, 7:26:01 AM1/30/12
to Empire

Hi.
SORRY THERE WAS SOME MISTAKE IN THE LAST POST. SO I'M POSTING AGAIN.

I'm very new to semantic web. I noticed that only Empire implements
JPA for RDF and SPARQL. So I decided to use it for my current project.

I'm accessing a Owlim repository trough sesame. I tried to use
com.clarkparsia.empire.codegen.BeanGenerator to auto generate
JavaBeans from the database. The database connection URL is
http://localhost:9080/openrdf-sesame/repository/owlim-se-test. I'm
using the following code:

try{

BeanGenerator.generateSourceFiles("com.snetapps.empiretest.entity",new
URL("http://localhost:9080/openrdf-sesame/repository/owlim-se-test"),
RDFFormat.RDFXML, new File("src/com/snetapps/empiretest/entity"));

Mike Grove

unread,
Feb 10, 2012, 5:09:14 PM2/10/12
to empir...@googlegroups.com
Paul,

Sorry for the delay in response, this message got lost in the moderation queue.

BeanGenerator will only generate classes from an ontology on disk, not
a remote database, the URL parameter should be a file or jar URL.

It would not be hard to modify BeanGenerator such that it took a
handle to a Repository directly and generated beans from that, if you
look at the first few lines of generateSourceFiles, you'll see the
first thing we do is read the RDF into a local Repository instance.

Cheers,

Mike

Message has been deleted

Mike Grove

unread,
Dec 10, 2012, 8:32:33 AM12/10/12
to empir...@googlegroups.com



On Fri, Dec 7, 2012 at 11:43 PM, Samuel Lawrence <sam.l...@gmail.com> wrote:
Hi Paul,

I am too new bie empire and OWLIM.

Can you please help me to connect Empire with OWLIM? I have tried sometime but I didn’t succeeded.

If possible please give me a sample code snippet that connects OWLIM repository using Empire.

I have never used OWLIM, so I cannot help you with anything OWLIM specific.  However, OWLIM implements the Sesame API, so the out of the box support for Sesame would probably work fine for OWLIM, and if not, it should only require minor modifications to make it work.  

If you look at RepositoryDataSourceFactory, you can see how we're currently initializing a Sesame repository from the configuration.  Again, since OWLIM implements the Sesame API, that might just work straight away, but if not, you can create a new DataSourceFactory implementation for OWLIM based on the core Sesame one and make the appropriate modifications.

Also, if you search the archives of the list, you can find some examples of how to pass a Repository instance directly into a configuration, which would be another option for using OWLIM, though not the ideal solution.

Cheers,

Mike
 

Thank You
Reply all
Reply to author
Forward
0 new messages