--sparql SELECT ?g count(?g) as ?cnt {  GRAPH ?g {?s ?p ?o .} }  GROUP BY ?g order by ?cnt;

--delete FROM DB.DBA.RDF_QUAD WHERE g = iri_to_id ('http://temp/testR2RML');
SPARQL CLEAR GRAPH <http://trush.me/1>;

--delete FROM DB.DBA.RDF_QUAD WHERE g = iri_to_id ('http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource');

DB.DBA.TTLP
  (' 
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix pest: <http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .


<#TriplesMapANNEXES> a rr:TriplesMap;
		rr:logicalTable [ 
				rr:tableSchema "DB" ;
            rr:tableOwner "pest" ;
            rr:tableName "ANNEXES" 
    ]; 
		rr:subjectMap [ 
				rr:termType rr:IRI  ;
        rr:template "http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource/annex-{ANNEXES_ID}";
        rr:class pest:Annex;
        rr:graph <http://test/rdfGen1> ];
		rr:predicateObjectMap [ 
				rr:predicateMap [
            rr:constant pest:annexId ] ;
        rr:objectMap [
            rr:column "ANNEXES_ID" ]; ] ;
		rr:predicateObjectMap [ 
				rr:predicateMap [
            rr:constant pest:annexName ] ;
        rr:objectMap [
            rr:column "ANNEXES_NAMES" ]; ] ;
		rr:predicateObjectMap [ 
				rr:predicateMap [
            rr:constant pest:annexPart ] ;
        rr:objectMap [
            rr:column "ANNEXES_PART" ]; ] ;
		rr:predicateObjectMap [ 
				rr:predicateMap [
            rr:constant pest:annexSpecial ] ;
        rr:objectMap [
            rr:column "ANNEXES_SPECIAL" ]; 
    ] .



',
  'http://trush.me/1',
  'http://trush.me/1')
;


EXEC ('SPARQL ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('http://trush.me/1'));


--DB.DBA.OVL_VALIDATE ('http://temp/testR2RML', 'http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource');