jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enes Bulut <enesbulut1...@gmail.com>
Subject SPARQL Update on default RDF model
Date Wed, 08 Aug 2012 06:51:51 GMT
Hi all,

I tried to update my RDF model using SPARQL, my model in memory,
then i had an exception that you can see below.

First I create a default model.

Model model= new ModelFactory.createDefaultModel();
...


Query string is something like that:

String queryStr = "PREFIX foaf:  <http://xmlns.com/foaf/0.1/> "
                                + "WITH <" + "http://example/addresses" +
"> "
                                + "DELETE { ?person foaf:givenName
\"Bill\" } "
                                + "INSERT { ?person foaf:givenName
\"William\" } "
                                + "WHERE {  ?person foaf:givenName
\"Bill\" } ";


UpdateRequest upReq = UpdateFactory.create();
upReq.add(queryStr);
UpdateAction.execute(upReq, model.getGraph);


When I run the project NullPointerException has occurred:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern$TripleMapper.<init>(
 QueryIterTriplePattern.java:80)
        at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern.nextStage(QueryIterTriplePattern.java:53)
        at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:113)
        at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65)
...

Is there any way to update the model-in-memory using SPARQL?

Regards

Enes

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message