Reputation: 121
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 ?
Upvotes: 1
Views: 245
Reputation: 3660
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.
Upvotes: 2