return null;
}
private boolean saveMapping(String modelUrl, String graphContext) {
try {
TripleStoreUtil utilObj = new TripleStoreUtil();
if (graphContext == null || graphContext.trim().compareTo("") == 0)
return false;
URL url = new URL(modelUrl);
StringWriter test = new StringWriter();
Model model = WorksheetR2RMLJenaModelParser.loadSourceModelIntoJenaModel(url);
Property rdfTypeProp = model.getProperty(Uris.RDF_TYPE_URI);
RDFNode node = model.getResource(Uris.KM_R2RML_MAPPING_URI);
ResIterator res = model.listResourcesWithProperty(rdfTypeProp, node);
List<Resource> resList = res.toList();
for(Resource r: resList)
{
model.add(r, model.getProperty(Uris.OWL_SAMEAS_URI), model.getResource(url.toString()));
}
model.write(test,"TTL");
model.close();
String content = test.getBuffer().toString();
test.close();
if (utilObj.testURIExists(tripleStoreUrl, graphContext, modelUrl)) {
utilObj.deleteMappingFromTripleStore(tripleStoreUrl, graphContext, modelUrl);
}
boolean result = utilObj.saveToStoreFromString(content, tripleStoreUrl, graphContext, new Boolean(false), null);
return result;
}catch (Exception e) {
return false;
}
}