@Test public void supportsNQuadsUdDeletions() throws Exception { RDFParserRegistry.getInstance().add(new NquadsUdParserFactory()); RdfProcessor rdfProcessor = mock(RdfProcessor.class); StringReader reader = new StringReader("-<http: Rdf4jRdfParser instance = new Rdf4jRdfParser(); instance.importRdf(rdfPatchLog(reader, File.createTempFile("test", "rdf")), "", "", rdfProcessor); verify(rdfProcessor).onQuad( DELETE, "http: "http: "12", "http: null, "http: ); }
@Override public void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor) throws RdfProcessingFailedException, RdfProcessingParseException { try { RDFFormat format = Rio.getParserFormatForMIMEType(input.getMimeType().toString()) .orElseThrow( () -> new UnsupportedRDFormatException(input.getMimeType() + " is not a supported rdf type.") ); RDFParser rdfParser = Rio.createParser(format); rdfParser.setPreserveBNodeIDs(true); rdfParser.setRDFHandler(new TimRdfHandler(rdfProcessor, baseUri, defaultGraph, input.getFile().getName())); rdfParser.parse(input.getReader(), baseUri); } catch (IOException | UnsupportedRDFormatException e) { throw new RdfProcessingFailedException(e); } catch (RDFParseException e) { throw new Rdf4jRdfProcessingParseException(e, input); } catch (RDFHandlerException e) { if (e.getCause() instanceof RdfProcessingFailedException) { throw (RdfProcessingFailedException) e.getCause(); } else { throw new RdfProcessingFailedException(e); } } }
Rdf4jRdfParser implements RdfParser { @Override public void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor) throws RdfProcessingFailedException, RdfProcessingParseException { try { RDFFormat format = Rio.getParserFormatForMIMEType(input.getMimeType().toString()) .orElseThrow( () -> new UnsupportedRDFormatException(input.getMimeType() + " is not a supported rdf type.") ); RDFParser rdfParser = Rio.createParser(format); rdfParser.setPreserveBNodeIDs(true); rdfParser.setRDFHandler(new TimRdfHandler(rdfProcessor, baseUri, defaultGraph, input.getFile().getName())); rdfParser.parse(input.getReader(), baseUri); } catch (IOException | UnsupportedRDFormatException e) { throw new RdfProcessingFailedException(e); } catch (RDFParseException e) { throw new Rdf4jRdfProcessingParseException(e, input); } catch (RDFHandlerException e) { if (e.getCause() instanceof RdfProcessingFailedException) { throw (RdfProcessingFailedException) e.getCause(); } else { throw new RdfProcessingFailedException(e); } } } }
Rdf4jRdfParser implements RdfParser { @Override public void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor) throws RdfProcessingFailedException, RdfProcessingParseException { try { RDFFormat format = Rio.getParserFormatForMIMEType(input.getMimeType().toString()) .orElseThrow( () -> new UnsupportedRDFormatException(input.getMimeType() + " is not a supported rdf type.") ); RDFParser rdfParser = Rio.createParser(format); rdfParser.setPreserveBNodeIDs(true); rdfParser.setRDFHandler(new TimRdfHandler(rdfProcessor, baseUri, defaultGraph, input.getFile().getName())); rdfParser.parse(input.getReader(), baseUri); } catch (IOException | UnsupportedRDFormatException e) { throw new RdfProcessingFailedException(e); } catch (RDFParseException e) { throw new Rdf4jRdfProcessingParseException(e, input); } catch (RDFHandlerException e) { if (e.getCause() instanceof RdfProcessingFailedException) { throw (RdfProcessingFailedException) e.getCause(); } else { throw new RdfProcessingFailedException(e); } } }  }
Rdf4jRdfParser implements RdfParser { @Override public void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor) throws RdfProcessingFailedException, RdfProcessingParseException { try { RDFFormat format = Rio.getParserFormatForMIMEType(input.getMimeType().toString()) .orElseThrow( () -> new UnsupportedRDFormatException(input.getMimeType() + " is not a supported rdf type.") ); RDFParser rdfParser = Rio.createParser(format); rdfParser.setPreserveBNodeIDs(true); rdfParser.setRDFHandler(new TimRdfHandler(rdfProcessor, baseUri, defaultGraph, input.getFile().getName())); rdfParser.parse(input.getReader(), baseUri); } catch (IOException | UnsupportedRDFormatException e) { throw new RdfProcessingFailedException(e); } catch (RDFParseException e) { throw new Rdf4jRdfProcessingParseException(e, input); } catch (RDFHandlerException e) { if (e.getCause() instanceof RdfProcessingFailedException) { throw (RdfProcessingFailedException) e.getCause(); } else { throw new RdfProcessingFailedException(e); } } }  @Override void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor); }
Rdf4jRdfParser implements RdfParser { @Override public void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor) throws RdfProcessingFailedException, RdfProcessingParseException { try { RDFFormat format = Rio.getParserFormatForMIMEType(input.getMimeType().toString()) .orElseThrow( () -> new UnsupportedRDFormatException(input.getMimeType() + " is not a supported rdf type.") ); RDFParser rdfParser = Rio.createParser(format); rdfParser.setPreserveBNodeIDs(true); rdfParser.setRDFHandler(new TimRdfHandler(rdfProcessor, baseUri, defaultGraph, input.getFile().getName())); rdfParser.parse(input.getReader(), baseUri); } catch (IOException | UnsupportedRDFormatException e) { throw new RdfProcessingFailedException(e); } catch (RDFParseException e) { throw new Rdf4jRdfProcessingParseException(e, input); } catch (RDFHandlerException e) { if (e.getCause() instanceof RdfProcessingFailedException) { throw (RdfProcessingFailedException) e.getCause(); } else { throw new RdfProcessingFailedException(e); } } }  @Override void importRdf(CachedLog input, String baseUri, String defaultGraph, RdfProcessor rdfProcessor);  }