-- 
-- SPARQL query to add missing chromosome type (triples) to EnsEMBL RDF graph.
--
-- Prerequisite: GRANT SPARQL_UPDATE to "SPARQL";
--

PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

INSERT INTO <http://ensembl.org/Sus_scrofa> {
   ?chr2 a obo:SO_0000340
}  
WHERE {
   GRAPH <http://www.animalgenome.org/QTLdb/pig> {
      ?chr1 a obo:SO_0000340 .
      BIND(uri(concat('http://rdf.ebi.ac.uk/resource/ensembl/86/sus_scrofa/Sscrofa10.2/', replace(str(?chr1), '.+/', ''))) AS ?chr2)
   }
}

--
-- SPARQL query to delete above triples
--
-- PREFIX owl: <http://www.w3.org/2002/07/owl#>
-- WITH  <http://ensembl.org/Sus_scrofa>
-- DELETE { ?s ?p ?o }
-- { ?s ?p ?o ; a obo:SO_0000340 }

-- 
-- SPARQL query to add missing chromosome type (triples) to EnsEMBL RDF graph.
--
-- Prerequisite: GRANT SPARQL_UPDATE to "SPARQL";
--

PREFIX obo: <http://purl.obolibrary.org/obo/>

INSERT INTO <http://ensembl.org/Sus_scrofa> {
   ?chr2 a obo:SO_0000340
}  
WHERE {
   GRAPH <http://www.animalgenome.org/QTLdb/pig> {
      ?chr1 a obo:SO_0000340 .
      BIND(uri(concat('http://rdf.ebi.ac.uk/resource/ensembl/86/sus_scrofa/Sscrofa10.2/', replace(str(?chr1), '.+/', ''))) AS ?chr2)
   }
}

--
-- SPARQL query to delete above triples
--
-- PREFIX obo: <http://purl.obolibrary.org/obo/>
-- WITH  <http://ensembl.org/Sus_scrofa>
-- DELETE { ?s ?p ?o }
-- { ?s ?p ?o ; a obo:SO_0000340 }
