I'm trying to add a triple to my Sesame repository using the SPARQL Update function. The statement is as below:
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX my_namespace: <http://purl.org/net/ontology_name/my_namespace/>
INSERT {my_namespace:Rota owl:sameAs ?o}
WHERE
{my_namespace:Rota owl:sameAs :Rotavirus_vaccine}
The query gets executed but no triples are added to the repository. What do I need to do differently?
This question is different from the one in Sesame repository not being updated using INSERT despite no error. In this question, I am not adding any external data. my_namespace:Rota and :Rotavirus_vaccine (from dbpedia) already exist in the triplestore. I want to assert that my_namespace:Rota is the same entity as :Rotavirus_vaccine so that the former can inherit all the information associated with the latter in dbpedia.
Got it! When entering a complete triple (i.e.,without variables), one is supposed to use INSERT DATA instead of INSERT. This is from the SPARQL documentation:
"The difference between INSERT / DELETE and INSERT DATA / DELETE DATA is that INSERT DATA and DELETE DATA do not take a template and pattern. The DATA forms require concrete data (no named variables). Having specific operations means that a request can be streamed so that large, pure-data, updates can be done." The code is:
PREFIX my_namespace: <http://purl.org/net/ontology_name/my_namespace/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://dbpedia.org/resource/>
INSERT DATA {my_namespace:Rota owl:sameAs :Rotavirus_vaccine}