sparql insert with where clause

560 views Asked by At

How to insert insert query with "where" condition in 4store sparql As far as I have searched I got to know that we have to use curl command for the same.I tried using this

         Process p = Runtime.getRuntime().exec(new String[]{"bash","-c","curl -i -d 'update=INSERT+DATA+{+?subject2+<http://www.w3.org/2002/07/owl/sameAs>+?subject3+.+}+WHERE+{+?subject2+<http://localhost:2020/vocab/Schema_feature>+\""+first[0]+"\"+.+?subject3+<http://localhost:2020/vocab/Schema_feature>+\""+first[1]+"\"+.+}' http://localhost:8000/update/"});

but it is saying "WHERE" should not be there.What I am doing wrong? Is there any other way to do that With simple insert command I am not able to work in sparql

It is working but for ?subject3 it is entering empty value.I don't know why.When I check the triples for where condition they are showing values

1

There are 1 answers

6
Joshua Taylor On BEST ANSWER

You don't

insert data { ... } where { ... }

You can either insert constant data with:

insert data { ... }

or you can compute the data to insert with

insert { ... } where { ... }

It looks like that latter one is what you want here.