On 24/01/12 16:12, Paolo Castagna wrote:
Hi,
maybe I am doing something stupid (or maybe not).

I get a NullPointerException simply doing:

Location location = new Location ("/tmp/tdb");
Model model = TDBFactory.createDataset(location).getDefaultModel();
model.setNsPrefix("foaf", "http://xmlns.com/foaf/0.1/";);

I have run this on a clean DB and it works for me.

TDB, latest snapshot build.
ARQ 2.9.0-incubating
Jena Core 2.7.0-incubating

Prefixes don't work very well in TDB ... but ther shouldn't be any crashes.

It might be a symptom of fixed issues from before Xmas. They affect the database.

        Andy


Full stack trace:

Exception in thread "main" java.lang.NullPointerException
        at 
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefixMap(DatasetPrefixesTDB.java:175)
        at 
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.getNsPrefixMap(GraphPrefixesProjection.java:62)
        at 
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.getPrefixMapping(DatasetPrefixesTDB.java:224)
        at 
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.getPrefixMapping(DatasetPrefixesTDB.java:215)
        at 
com.hp.hpl.jena.tdb.store.GraphTriplesTDB.createPrefixMapping(GraphTriplesTDB.java:99)
        at 
com.hp.hpl.jena.sparql.graph.GraphBase2.getPrefixMapping(GraphBase2.java:194)
        at 
com.hp.hpl.jena.rdf.model.impl.ModelCom.getPrefixMapping(ModelCom.java:908)
        at 
com.hp.hpl.jena.rdf.model.impl.ModelCom.withDefaultMappings(ModelCom.java:952)
        at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:66)
        at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:62)
        at 
com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph(ModelFactory.java:166)
        at 
com.hp.hpl.jena.sparql.core.DatasetImpl.graph2model(DatasetImpl.java:262)
        at 
com.hp.hpl.jena.sparql.core.DatasetImpl.getDefaultModel(DatasetImpl.java:103)
        at dev.TDBError.main(TDBError.java:11)

In the classpath I have the following dependencies:

[INFO] |  +- org.apache.jena:jena-tdb:jar:0.9.0-incubating-SNAPSHOT:compile
[INFO] |  |  \- com.ibm.icu:icu4j:jar:3.4.4:compile
[INFO] |  +- org.apache.jena:jena-arq:jar:2.9.0-incubating:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.1.2:compile
[INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.1.3:compile
[INFO] |  +- org.apache.jena:jena-core:jar:2.7.0-incubating:compile
[INFO] |  |  \- org.apache.jena:jena-iri:jar:0.9.0-incubating:compile


I tried to use:

  - org.apache.jena:jena-core:jar:2.7.1-incubating-SNAPSHOT
  - org.apache.jena:jena-arq:jar:2.9.0-incubating-SNAPSHOT

but I see the same exception.

Thanks,
Paolo

Reply via email to