@Test void testShouldSkipNamespace() { final String foo = "http: final String ns = "http: final Set<String> namespaces = singleton(ns); assertFalse(JenaIOService.shouldAddNamespace(namespaces, ns, null), "Added namespace that already exists"); assertFalse(JenaIOService.shouldAddNamespace(namespaces, foo, null), "Added namespace with null base definition"); assertFalse(JenaIOService.shouldAddNamespace(namespaces, foo, "http: "Added namespace with matching scheme/host/port"); assertFalse(JenaIOService.shouldAddNamespace(namespaces, "not a url", "also not a url"), "Added invalid namespace"); assertTrue(JenaIOService.shouldAddNamespace(namespaces, foo, "http: "Missed namespace with different port definition!"); assertTrue(JenaIOService.shouldAddNamespace(namespaces, foo, "https: "Missed namespace with different scheme!"); assertTrue(JenaIOService.shouldAddNamespace(namespaces, foo, "http: "Missed namespace with different port definition!"); assertTrue(JenaIOService.shouldAddNamespace(namespaces, "http: "Missed namespace with different host!"); }
static boolean shouldAddNamespace(final Set<String> namespaces, final String namespace, final String base) { if (!namespaces.contains(namespace) && base != null) { try { final URL url1 = new URL(namespace); final URL url2 = new URL(base); return !url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort(); } catch (final MalformedURLException ex) { LOGGER.debug("Skipping malformed URL: {}", ex.getMessage()); } } return false; }
JenaIOService implements IOService { static boolean shouldAddNamespace(final Set<String> namespaces, final String namespace, final String base) { if (!namespaces.contains(namespace) && base != null) { try { final URL url1 = new URL(namespace); final URL url2 = new URL(base); return !url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort(); } catch (final MalformedURLException ex) { LOGGER.debug("Skipping malformed URL: {}", ex.getMessage()); } } return false; } }
JenaIOService implements IOService { static boolean shouldAddNamespace(final Set<String> namespaces, final String namespace, final String base) { if (!namespaces.contains(namespace) && base != null) { try { final URL url1 = new URL(namespace); final URL url2 = new URL(base); return !url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort(); } catch (final MalformedURLException ex) { LOGGER.debug("Skipping malformed URL: {}", ex.getMessage()); } } return false; } JenaIOService();  JenaIOService(final NamespaceService namespaceService);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer); @Inject  JenaIOService(final NamespaceService namespaceService,
            final RDFaWriterService htmlSerializer,
            @TrellisProfileCache final CacheService<String, String> cache); private  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Config config);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final String allowedContexts, final String allowedContextDomains,
            final boolean relativeIRIs);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Set<String> allowedContexts,
            final Set<String> allowedContextDomains, final boolean relativeIRIs); }
JenaIOService implements IOService { static boolean shouldAddNamespace(final Set<String> namespaces, final String namespace, final String base) { if (!namespaces.contains(namespace) && base != null) { try { final URL url1 = new URL(namespace); final URL url2 = new URL(base); return !url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort(); } catch (final MalformedURLException ex) { LOGGER.debug("Skipping malformed URL: {}", ex.getMessage()); } } return false; } JenaIOService();  JenaIOService(final NamespaceService namespaceService);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer); @Inject  JenaIOService(final NamespaceService namespaceService,
            final RDFaWriterService htmlSerializer,
            @TrellisProfileCache final CacheService<String, String> cache); private  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Config config);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final String allowedContexts, final String allowedContextDomains,
            final boolean relativeIRIs);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Set<String> allowedContexts,
            final Set<String> allowedContextDomains, final boolean relativeIRIs); @Override List<RDFSyntax> supportedReadSyntaxes(); @Override List<RDFSyntax> supportedWriteSyntaxes(); @Override List<RDFSyntax> supportedUpdateSyntaxes(); @Override void write(final Stream<Triple> triples, final OutputStream output, final RDFSyntax syntax,
            final String baseUrl, final IRI... profiles); @Override Stream<Triple> read(final InputStream input, final RDFSyntax syntax, final String base); @Override void update(final Graph graph, final String update, final RDFSyntax syntax, final String base); }
JenaIOService implements IOService { static boolean shouldAddNamespace(final Set<String> namespaces, final String namespace, final String base) { if (!namespaces.contains(namespace) && base != null) { try { final URL url1 = new URL(namespace); final URL url2 = new URL(base); return !url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort(); } catch (final MalformedURLException ex) { LOGGER.debug("Skipping malformed URL: {}", ex.getMessage()); } } return false; } JenaIOService();  JenaIOService(final NamespaceService namespaceService);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer); @Inject  JenaIOService(final NamespaceService namespaceService,
            final RDFaWriterService htmlSerializer,
            @TrellisProfileCache final CacheService<String, String> cache); private  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Config config);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final String allowedContexts, final String allowedContextDomains,
            final boolean relativeIRIs);  JenaIOService(final NamespaceService namespaceService, final RDFaWriterService htmlSerializer,
            final CacheService<String, String> cache, final Set<String> allowedContexts,
            final Set<String> allowedContextDomains, final boolean relativeIRIs); @Override List<RDFSyntax> supportedReadSyntaxes(); @Override List<RDFSyntax> supportedWriteSyntaxes(); @Override List<RDFSyntax> supportedUpdateSyntaxes(); @Override void write(final Stream<Triple> triples, final OutputStream output, final RDFSyntax syntax,
            final String baseUrl, final IRI... profiles); @Override Stream<Triple> read(final InputStream input, final RDFSyntax syntax, final String base); @Override void update(final Graph graph, final String update, final RDFSyntax syntax, final String base); static final String CONFIG_IO_JSONLD_PROFILES; static final String CONFIG_IO_JSONLD_DOMAINS; static final String CONFIG_IO_RELATIVE_IRIS; }