public List<String> parseResponse(final String resourceUri, String requestUrl, Repository triples, InputStream in, String contentType) throws DataRetrievalException {
RDFFormat format = RDFParserRegistry.getInstance().getFileFormatForMIMEType(contentType, RDFFormat.RDFXML);
try {
InterceptingRepositoryConnection con =
new InterceptingRepositoryConnectionWrapper(triples,triples.getConnection());
con.addRepositoryConnectionInterceptor(new RepositoryConnectionInterceptorAdapter() {
@Override
public boolean add(RepositoryConnection conn, Resource s, org.openrdf.model.URI p, Value o, Resource... contexts) {
if(s instanceof org.openrdf.model.URI) {
// if s is a URI and subject a KiWiUriResource, return true if they are different
return !s.stringValue().equals(resourceUri);
} else {
// in all other cases, return true to filter out the triple
return true;
}
};
@Override
public boolean remove(RepositoryConnection conn, Resource s, org.openrdf.model.URI p, Value o, Resource... contexts) {
if(s instanceof org.openrdf.model.URI) {
// if s is a URI and subject a KiWiUriResource, return true if they are different
return !s.stringValue().equals(resourceUri);
} else {
// in all other cases, return true to filter out the triple
return true;
}
}
});
con.add(in, resourceUri,format);
con.commit();
con.close();
return Collections.emptyList();
} catch (RepositoryException e) {
throw new DataRetrievalException("error while initializing temporary RDF store",e);
} catch (RDFParseException e) {