use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testQnameFromEmail.
/**
The tests implied by the email where Chris suggested adding qnameFor;
shortForm generates illegal qnames but qnameFor does not.
*/
public void testQnameFromEmail() {
String uri = "http://some.long.uri/for/a/namespace#";
PrefixMapping ns = getMapping();
ns.setNsPrefix("x", uri);
assertEquals(null, ns.qnameFor(uri));
assertEquals(null, ns.qnameFor(uri + "non/fiction"));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testPrefixMappingMapping.
/**
test that a PrefixMapping maps names to URIs. The names and URIs are
all fully distinct - overlapping names/uris are dealt with in other tests.
*/
public void testPrefixMappingMapping() {
String toast = "ftp://ftp.nowhere.not/";
assertDiffer("crisp and toast must differ", crispURI, toast);
/* */
PrefixMapping ns = getMapping();
assertEquals("crisp should be unset", null, ns.getNsPrefixURI("crisp"));
assertEquals("toast should be unset", null, ns.getNsPrefixURI("toast"));
assertEquals("butter should be unset", null, ns.getNsPrefixURI("butter"));
/* */
ns.setNsPrefix("crisp", crispURI);
assertEquals("crisp should be set", crispURI, ns.getNsPrefixURI("crisp"));
assertEquals("toast should still be unset", null, ns.getNsPrefixURI("toast"));
assertEquals("butter should still be unset", null, ns.getNsPrefixURI("butter"));
/* */
ns.setNsPrefix("toast", toast);
assertEquals("crisp should be set", crispURI, ns.getNsPrefixURI("crisp"));
assertEquals("toast should be set", toast, ns.getNsPrefixURI("toast"));
assertEquals("butter should still be unset", null, ns.getNsPrefixURI("butter"));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testPrefixMappingMap.
/**
test that we can extract a proper Map from a PrefixMapping
*/
public void testPrefixMappingMap() {
PrefixMapping ns = getCrispyRope();
Map<String, String> map = ns.getNsPrefixMap();
assertEquals("map should have two elements", 2, map.size());
assertEquals(crispURI, map.get("crisp"));
assertEquals("scheme:rope/string#", map.get("rope"));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testEmptyPrefix.
/**
The empty prefix is specifically allowed [for the default namespace].
*/
public void testEmptyPrefix() {
PrefixMapping pm = getMapping();
pm.setNsPrefix("", crispURI);
assertEquals(crispURI, pm.getNsPrefixURI(""));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testNoMapping.
public void testNoMapping() {
String hURI = "http://test.prefixes/prefix#";
PrefixMapping A = getMapping();
assertTrue(A.hasNoMappings());
A.setNsPrefix("hr", hURI);
assertFalse(A.hasNoMappings());
}
Aggregations