" <http://resource.org/fragment1> <http://ontology.org#shows> <http://resource.org/subject1>." +
"} WHERE {}";
RepositoryConnection connectionInsert = repository.getConnection();
try {
Update u = connectionInsert.prepareUpdate(QueryLanguage.SPARQL, insert);
u.execute();
connectionInsert.commit();
} finally {
connectionInsert.close();
}
//update quadruples
String update =
"WITH <http://resource.org/video>" +
"DELETE { " +
" ?annotation ?p ?v." +
" ?fragment ?r ?s." +
" <http://resource.org/video> <http://ontology.org#hasFragment> ?fragment." +
"} INSERT {" +
" <http://resource.org/video> <http://ontology.org#hasFragment> <http://resource.org/fragment1>." +
" <http://resource.org/annotation1> <http://ontology.org#hasTarget> <http://resource.org/fragment1>." +
" <http://resource.org/annotation1> <http://ontology.org#hasBody> <http://resource.org/subject1>." +
" <http://resource.org/fragment1> <http://ontology.org#shows> <http://resource.org/subject1>." +
"} WHERE {" +
" ?annotation <http://ontology.org#hasTarget> ?fragment." +
" ?annotation ?p ?v." +
" OPTIONAL {" +
" ?fragment ?r ?s" +
" }" +
" FILTER (?fragment = <http://resource.org/fragment1>)" +
"} ";
RepositoryConnection connectionUpdate = repository.getConnection();
try {
Update u = connectionUpdate.prepareUpdate(QueryLanguage.SPARQL, update);
u.execute();
connectionUpdate.commit();
} finally {
connectionUpdate.close();
}