Hi,
I'm working with a dynamic environment and have instances with some of
their properties that get updated with time, such as the rank property below

<http://jena.apache.org/documentation/tdb/tdb_transactions.html>
        a       <http://test.org/vocabulary/actions/Node> ;
        <http://test.org/vocabulary/actions/id>
                92 ;
        <http://test.org/vocabulary/actions/rank>
                "2.181"^^<http://www.w3.org/2001/XMLSchema#double> ,
"1.672"^^<http://www.w3.org/2001/XMLSchema#double> , "0.233"^^<
http://www.w3.org/2001/XMLSchema#double> , "0.466"^^<
http://www.w3.org/2001/XMLSchema#double> , "0.274"^^<
http://www.w3.org/2001/XMLSchema#double> , "0.543"^^<
http://www.w3.org/2001/XMLSchema#double> , "0.86"^^<
http://www.w3.org/2001/XMLSchema#double> , "1.234"^^<
http://www.w3.org/2001/XMLSchema#double> .

>From the excerpt it can be seen that multiple rank values are being added.

I'm using sparql's combination of delete/insert to delete the current value
and add the updated one, as follows:

String pre = StrUtils.strjoinNL
                (" PREFIX  : <http://test.org/vocabulary/actions/>"
                        , "PREFIX text: <http://jena.apache.org/text#>"
                        , "PREFIX rdfs: <
http://www.w3.org/2000/01/rdf-schema#>"
                        ,"PREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>"
                        ," PREFIX actions: <
http://test.org/vocabulary/actions/>"
                        ,"PREFIX rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#>") ;

String prop = StrUtils.strjoinNL(
                        node,
                        " actions:rank ?rank . ");

dataset.begin(ReadWrite.WRITE) ;
        String dq = StrUtils.strjoinNL
                (
                    "DELETE { ",
                              prop, " }",
                     "INSERT {", data, "}",
                    "WHERE { ",
                                prop," }"
                    );
        try {
            UpdateRequest update = UpdateFactory.create(pre+"\n"+dq);
            GraphStore graphStore = GraphStoreFactory.create(dataset);
            UpdateAction.execute(update,graphStore);
            dataset.commit();
        }catch(Exception ex){
        ex.printStackTrace();
        }finally { dataset.end() ; }

any ideas as to why the values are not being deleted?

thanks in advance.

Reply via email to