Hello!
I tryng to modify an existing TripleMap, adding a new predicateObjectMap, but I recive the error.
SQLState: 37000
Message: SQ074: Line 158: SP031: SPARQL compiler: The statement contains two identical declarations of mappings
I started executing this R2RML:
(Creation of Work (TriplesMapGSDRB_SCHEDA_RB), Instance(TriplesMapGSDRB_SUB_CDE) and relation between Work—>>>Instance and Work<<<—Instance
SPARQL
prefix rr: <http://www.w3.org/ns/r2rml#>
prefix DBTEST: <http://localhost:8890/schemas/DBTEST/>
prefix dbtest-stat: <http://localhost:8890/DBTEST/stat#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix void: <http://rdfs.org/ns/void#>
prefix scovo: <http://purl.org/NET/scovo#>
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix bf: <http://id.loc.gov/ontologies/bibframe/>
INSERT { GRAPH <urn:dbtest:tables:r2rml:mappings>
{
<#TriplesMapGSDRB_SCHEDA_RB> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "DBTEST" ; rr:tableOwner "DBA" ; rr:tableName "GSDRB_SCHEDA_RB" ];
rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://localhost:8890/DBTEST/work/{ID_CATALOGO}#this"; rr:class bf:Work ; rr:graph <http://localhost:8890/DBTEST#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:id_catalogo ] ; rr:objectMap [ rr:column "ID_CATALOGO" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:tsk ] ; rr:objectMap [ rr:column "TSK" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:oss ] ; rr:objectMap [ rr:column "OSS" ]; ] ;
rr:predicateObjectMap
[ rr:predicateMap
[ rr:constant bf:hasInstance ] ;
rr:objectMap
[ rr:parentTriplesMap <#TriplesMapGSDRB_SUB_CDE>;
rr:joinCondition
[ rr:child "ID_CATALOGO" ;
rr:parent "REF_CATALOGO"
] ;
];
] .
<#TriplesMapGSDRB_SUB_CDE> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "DBTEST" ; rr:tableOwner "DBA" ; rr:tableName "GSDRB_SUB_CDE" ];
rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://localhost:8890/DBTEST/instance/{SUBCOUNTER}#this"; rr:class bf:Instance; rr:graph <http://localhost:8890/DBTEST#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:subcounter ] ; rr:objectMap [ rr:column "SUBCOUNTER" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:ref_catalogo ] ; rr:objectMap [ rr:column "REF_CATALOGO" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:cdep ] ; rr:objectMap [ rr:column "CDEP" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:cdef ] ; rr:objectMap [ rr:column "CDEF" ]; ] ;
rr:predicateObjectMap
[ rr:predicateMap
[ rr:constant bf:instanceOf ] ;
rr:objectMap
[ rr:parentTriplesMap <#TriplesMapGSDRB_SCHEDA_RB>;
rr:joinCondition
[ rr:child "REF_CATALOGO" ;
rr:parent "ID_CATALOGO"
] ;
];
] .
}
};
-- Generate & Execute Virtual RDF Views
-- from R2RML mappings
EXEC ('SPARQL ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('urn:dbtest:tables:r2rml:mappings'));
Then i added a new piece of R2RML code.
The creation of Item (TriplesMapGSDRB_SUB_CP) related to Instance(TriplesMapGSDRB_SUB_CDE):
-- R2RML GRAPH
-- Load R2RML script
-- Creation node Item e arc Item->Instance
SPARQL
prefix rr: <http://www.w3.org/ns/r2rml#>
prefix DBTEST: <http://localhost:8890/schemas/DBTEST/>
prefix dbtest-stat: <http://localhost:8890/DBTEST/stat#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix void: <http://rdfs.org/ns/void#>
prefix scovo: <http://purl.org/NET/scovo#>
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix bf: <http://id.loc.gov/ontologies/bibframe/>
INSERT { GRAPH <urn:dbtest:tables:r2rml:mappings>
{
<#TriplesMapGSDRB_SUB_CP> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "DBTEST" ; rr:tableOwner "DBA" ; rr:tableName "GSDRB_SUB_CP" ];
rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://localhost:8890/DBTEST/item/{SUBCOUNTER}#this"; rr:class bf:Item; rr:graph <http://localhost:8890/DBTEST#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:subcounter ] ; rr:objectMap [ rr:column "SUBCOUNTER" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:ref_catalogo ] ; rr:objectMap [ rr:column "REF_CATALOGO" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:cpzo ] ; rr:objectMap [ rr:column "CPZO" ]; ] ;
rr:predicateObjectMap
[ rr:predicateMap
[ rr:constant bf:itemOf ] ;
rr:objectMap
[ rr:parentTriplesMap <#TriplesMapGSDRB_SUB_CDE>;
rr:joinCondition
[ rr:child "REF_CATALOGO" ;
rr:parent "REF_CATALOGO"
] ;
];
] .
}
};
-- Generate & Execute Virtual RDF Views
-- from R2RML mappings
EXEC ('SPARQL ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('urn:dbtest:tables:r2rml:mappings'));
Up to this point everything worked fine.
After that I attempted to modify the TriplesMapGSDRB_SUB_CDE, that is my class bf:Instance, trying to add a new relationship between Instance—>>>Item (the join with TriplesMapGSDRB_SUB_CP)
SPARQL
prefix rr: <http://www.w3.org/ns/r2rml#>
prefix DBTEST: <http://localhost:8890/schemas/DBTEST/>
prefix dbtest-stat: <http://localhost:8890/DBTEST/stat#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix void: <http://rdfs.org/ns/void#>
prefix scovo: <http://purl.org/NET/scovo#>
prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix bf: <http://id.loc.gov/ontologies/bibframe/>
INSERT { GRAPH <urn:dbtest:tables:r2rml:mappings>
{
<#TriplesMapGSDRB_SUB_CDE> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "DBTEST" ; rr:tableOwner "DBA" ; rr:tableName "GSDRB_SUB_CDE" ];
rr:subjectMap [ rr:termType rr:IRI ; rr:template "http://localhost:8890/DBTEST/instance/{SUBCOUNTER}#this"; rr:class bf:Instance; rr:graph <http://localhost:8890/DBTEST#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:subcounter ] ; rr:objectMap [ rr:column "SUBCOUNTER" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:ref_catalogo ] ; rr:objectMap [ rr:column "REF_CATALOGO" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:cdep ] ; rr:objectMap [ rr:column "CDEP" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant DBTEST:cdef ] ; rr:objectMap [ rr:column "CDEF" ]; ] ;
rr:predicateObjectMap
[ rr:predicateMap
[ rr:constant bf:instanceOf ] ;
rr:objectMap
[ rr:parentTriplesMap <#TriplesMapGSDRB_SCHEDA_RB>;
rr:joinCondition
[ rr:child "REF_CATALOGO" ;
rr:parent "ID_CATALOGO"
] ;
];
] ;
rr:predicateObjectMap
[ rr:predicateMap
[ rr:constant bf:hasItem ] ;
rr:objectMap
[ rr:parentTriplesMap <#TriplesMapGSDRB_SUB_CP>;
rr:joinCondition
[ rr:child "REF_CATALOGO" ;
rr:parent "REF_CATALOGO"
] ;
];
] .
}
};
-- Generate & Execute Virtual RDF Views
-- from R2RML mappings
EXEC ('SPARQL ' || DB.DBA.R2RML_MAKE_QM_FROM_G ('urn:dbtest:tables:r2rml:mappings'));
But I recive the error:
There is a way to modify (or delete and recreate) a TriplesMap (in my case the TriplesMapGSDRB_SUB_CDE) without getting similar errors?
I hope I clearly described what I did, the problem and what I would like to achieve.