0

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.

Community
  • 1
  • 1
kurious
  • 1,024
  • 10
  • 29
  • Same as http://stackoverflow.com/questions/31234300/ – AndyS Jul 06 '15 at 18:02
  • I tried the following code but it doesn't work: INSERT{?s ?p ?o} WHERE { my_namespace:Rota owl:sameAs :Rotavirus_vaccine. BIND(my_namespace:Rota AS ?s) } Please let me know what I need to change. – kurious Jul 06 '15 at 20:45
  • See the other question which explains what is going on. – AndyS Jul 07 '15 at 14:34
  • I'm not sure I understand why the query above doesn't work. This question is slightly different from the other one. Here, my_namespace:Rota and :Rotavirus_vaccine (retrieved from DBpedia) already exist in the repository. In the other question, I was retrieving information from DBpedia to add to the repository. In essence, I'm trying to assert that my_namespace:Rota is the same thing as :Rotavirus_vaccine so that the former can inherit the latter's properties. How does one assert such a relationship within the repository? – kurious Jul 07 '15 at 17:15

1 Answers1

1

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}
kurious
  • 1,024
  • 10
  • 29