1

I am trying to insert values using INSERT WHERE. I am using 4Store as the semantic repository.

The query is as follows,

INSERT { 
    <http://some.com#test2> rdf:type <http://dbpedia.org/ontology/Floor> . 
    ?URI1257846444363706 <http://dbpedia.org/ontology/TestFloor> <http:// some.com #test2> . 
    <http:// some.com #test2> <http://dbpedia.org/ontology/floorNo> 'B11' . 
       } 
WHERE { 
    ?URI1257846444278864 rdf:type <http://dbpedia.org/ontology/Campus> . 
    ?URI1257846444278864 <http://dbpedia.org/ontology/hasCampusCode> 'ABC' . 
    ?URI1257846444363706 rdf:type <http://dbpedia.org/ontology/Building> . 
    ?URI1257846444278864 <http://dbpedia.org/ontology/Building> ?URI1257846444363706 . 
    ?URI1257846444363706 <http://dbpedia.org/ontology/hasBuildingCode> 'XYZ' . 
    }

When I run the above query the triples in INSERT are not inserted in the store (I tried retrieving the triples using a SELECT query, but it returns no results). I have checked all the triples in WHERE clause and all of them do exist in the store.

PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
SELECT * { 
    ?URI1257846444278864 rdf:type <http://dbpedia.org/ontology/Campus> .
    ?URI1257846444278864 <http://dbpedia.org/ontology/hasCampusCode> 'ABC' .
    ?URI1257846444363706 rdf:type <http://dbpedia.org/ontology/Building> .
    ?URI1257846444278864 <http://dbpedia.org/ontology/Building> ?URI1257846444363706 .
    ?URI1257846444363706 <http://dbpedia.org/ontology/hasBuildingCode> 'XYZ' . 

    }

Results:

<head>
    <variable name="URI1257846444278864"/>
    <variable name="URI1257846444363706"/>
  </head>
  <results>
    <result>
      <binding name="URI1257846444278864"><uri>http://some.com/Ontology/2012.owl#ranfa1087b9-6cee-4433-a4d3-816e9b1af208</uri></binding>
      <binding name="URI1257846444363706"><uri>http://some.com/Ontology/2012.owl#ran1224548700931885</uri></binding>
    </result>
  </results>

But the same INSERT WHERE with just one variable works fine,

INSERT { 
    <http://some.com#test2> rdf:type <http://dbpedia.org/ontology/Floor> . 
    ?URI1257846444363706 <http://dbpedia.org/ontology/TestFloor> <http:// some.com #test2> . 
    <http:// some.com #test2> <http://dbpedia.org/ontology/floorNo> 'B11' . 
    } 
WHERE { 
    ?URI1257846444363706 rdf:type <http://dbpedia.org/ontology/Building> . 
    ?URI1257846444363706 <http://dbpedia.org/ontology/hasBuildingCode> 'XYZ' . 
    }

Is something wrong in the 1st INSERT WHERE ?

Nikhil
  • 121
  • 1
  • 4
  • This probably isn't the problem as you say the 2nd `INSERT` works, but `` is not a valid IRI because it contains spaces. – cygri May 06 '12 at 10:06

1 Answers1

2

It's hard to tell if the query is correct without seeing the data.

Try running just the WHERE part with a SELECT *. That will tell you if there are any matches for it.

Also, you don't say what version of 4store you're running. Early ones only had partial INSERT support.

Steve Harris
  • 3,590
  • 19
  • 22
  • I did try the SELECT * with just the WHERE part. I have attached the results above with my question. I am using following versions, Raptor version 2.0.4 Rasqal version 0.9.26 4Store v1.1.4-168-g98398ef – Nikhil May 06 '12 at 07:10