You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Nicholas Pacini <ni...@gmail.com> on 2011/08/04 17:06:29 UTC

exception while conencting to a sparql database

Hello all,

I’m having a problem and I’m searching for some help, hopefully you
could give me a hand. I’m trying to connect to a sdb using the
following snippet of code:

Store store = StoreFactory.create("sdb.ttl");
Model model = SDBFactory.connectDefaultModel(store);
model.createResource("http://someuri.com");

but I get a strange (for me at least) exception executing the second line:

Exception in thread "main" java.lang.NoSuchMethodError:
com.hp.hpl.jena.sparql.core.Quad.isQuadDefaultGraphGenerated(Lcom/hp/hpl/jena/graph/Node;)Z
       at com.hp.hpl.jena.sdb.graph.GraphSDB.createPrefixMapping(GraphSDB.java:100)
       at com.hp.hpl.jena.sparql.graph.GraphBase2.getPrefixMapping(GraphBase2.java:172)
       at com.hp.hpl.jena.rdf.model.impl.ModelCom.getPrefixMapping(ModelCom.java:763)
       at com.hp.hpl.jena.rdf.model.impl.ModelCom.withDefaultMappings(ModelCom.java:800)
       at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:55)
       at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51)
       at com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph(ModelFactory.java:146)
       at com.hp.hpl.jena.sdb.SDBFactory.createModelSDB(SDBFactory.java:386)
       at com.hp.hpl.jena.sdb.SDBFactory.connectDefaultModel(SDBFactory.java:326)

have you any idea of what causes this? For what I see the method is
present, though deprecated, in the com.hp.hpl.jena.sparql.core.Quad
class… any thoughts about this? Thanks.

Regards,
Nicholas

Re: exception while conencting to a sparql database

Posted by Andy Seaborne <an...@epimorphics.com>.

On 04/08/11 16:06, Nicholas Pacini wrote:
> Hello all,
>
> I’m having a problem and I’m searching for some help, hopefully you
> could give me a hand. I’m trying to connect to a sdb using the
> following snippet of code:
>
> Store store = StoreFactory.create("sdb.ttl");
> Model model = SDBFactory.connectDefaultModel(store);
> model.createResource("http://someuri.com");
>
> but I get a strange (for me at least) exception executing the second line:
>
> Exception in thread "main" java.lang.NoSuchMethodError:
> com.hp.hpl.jena.sparql.core.Quad.isQuadDefaultGraphGenerated(Lcom/hp/hpl/jena/graph/Node;)Z
>         at com.hp.hpl.jena.sdb.graph.GraphSDB.createPrefixMapping(GraphSDB.java:100)
>         at com.hp.hpl.jena.sparql.graph.GraphBase2.getPrefixMapping(GraphBase2.java:172)
>         at com.hp.hpl.jena.rdf.model.impl.ModelCom.getPrefixMapping(ModelCom.java:763)
>         at com.hp.hpl.jena.rdf.model.impl.ModelCom.withDefaultMappings(ModelCom.java:800)
>         at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:55)
>         at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51)
>         at com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph(ModelFactory.java:146)
>         at com.hp.hpl.jena.sdb.SDBFactory.createModelSDB(SDBFactory.java:386)
>         at com.hp.hpl.jena.sdb.SDBFactory.connectDefaultModel(SDBFactory.java:326)
>
> have you any idea of what causes this? For what I see the method is
> present, though deprecated, in the com.hp.hpl.jena.sparql.core.Quad
> class… any thoughts about this? Thanks.
>
> Regards,
> Nicholas

It's a java thing.  You have an incompatible set of jars (here ARQ and 
SDB jars).  Use the copy of ARQ in the SDB distribution.

It looks like you are using a newer version of ARQ.

You can get an SDB that shoudl work with latest ARQ from SVN of a 
snapshot build on http://openjena.org/repo-dev.

	Andy