@Test public void testWithbase$emptyDoc$NamespacesAreDiscarded() throws Exception { withBase.startRDF(); withBase.handleNamespace(NS1_PX1, NS1_NAMESPACE); withBase.endRDF(); assertThat(outWithBase.toString(),containsString(BASE_DIRECTIVE)); assertThat(outWithBase.toString(),not(containsString(prefixDirective(NS1_PX1, NS1_NAMESPACE)))); }
@Test public void testWithbase$simpleDoc$UnusedNamespacesAreDiscarded() throws Exception { withBase.startRDF(); withBase.handleNamespace(NS1_PX1, NS1_NAMESPACE); withBase.handleNamespace(NS2_PX, NS2_NAMESPACE); withBase.handleNamespace(NO_PX,NO_NAMESPACE); withBase.handleStatement(statement(uriRef(NS1_NAMESPACE,URI1),uriRef(NS2_NAMESPACE,URI2),blankNode(BN_FOLDED))); withBase.endRDF(); assertThat(outWithBase.toString(),containsString(BASE_DIRECTIVE)); assertThat(outWithBase.toString(),containsString(prefixDirective(NS1_PX1, NS1_NAMESPACE))); assertThat(outWithBase.toString(),containsString(prefixDirective(NS2_PX, NS2_NAMESPACE))); assertThat(outWithBase.toString(),containsString(qname(NS1_PX1,URI1))); assertThat(outWithBase.toString(),containsString(qname(NS2_PX,URI2))); assertThat(outWithBase.toString(),containsString(blankNode(BN_FOLDED).toString())); assertThat(outWithBase.toString(),not(containsString(prefixDirective(NO_PX, NO_NAMESPACE)))); assertThat(outWithBase.toString(),not(containsString(uriRef(NS1_NAMESPACE,URI1).toString()))); assertThat(outWithBase.toString(),not(containsString(uriRef(NS2_NAMESPACE,URI2).toString()))); }
@Test public void testWithbase$simpleDoc$NamespacePrefixesOverlap() throws Exception { withBase.startRDF(); withBase.handleNamespace(NS1_PX1, NS1_NAMESPACE); withBase.handleNamespace(NS2_PX, NS2_NAMESPACE); withBase.handleNamespace(NS1_PX2,NS1_NAMESPACE); withBase.handleStatement(statement(uriRef(NS1_NAMESPACE,URI1),uriRef(NS2_NAMESPACE,URI2),blankNode(BN_FOLDED))); withBase.endRDF(); assertThat(outWithBase.toString(),containsString(BASE_DIRECTIVE)); assertThat(outWithBase.toString(),containsString(prefixDirective(NS1_PX2, NS1_NAMESPACE))); assertThat(outWithBase.toString(),containsString(prefixDirective(NS2_PX, NS2_NAMESPACE))); assertThat(outWithBase.toString(),containsString(qname(NS1_PX2,URI1))); assertThat(outWithBase.toString(),containsString(qname(NS2_PX,URI2))); assertThat(outWithBase.toString(),containsString(blankNode(BN_FOLDED).toString())); assertThat(outWithBase.toString(),not(containsString(prefixDirective(NS1_PX1, NS1_NAMESPACE)))); assertThat(outWithBase.toString(),not(containsString(qname(NS1_PX1,URI1)))); assertThat(outWithBase.toString(),not(containsString(uriRef(NS1_NAMESPACE,URI1).toString()))); assertThat(outWithBase.toString(),not(containsString(uriRef(NS2_NAMESPACE,URI2).toString()))); }
@Test public void testNobase$emptuDoc$NamespacesAreDiscarded() throws Exception { noBase.startRDF(); noBase.handleNamespace(NS1_PX1, NS1_NAMESPACE); noBase.endRDF(); assertThat(outNoBase.toString(),isEmptyString()); }