use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestPrefixMappingTDB method persistent2.
// Persistent.
@Test
public void persistent2() {
String dir = ConfigTest.getTestingDir();
FileOps.clearDirectory(dir);
DatasetPrefixesTDB prefixes = createTesting(Location.create(dir), new DatasetControlMRSW());
PrefixMapping pmap1 = prefixes.getPrefixMapping();
pmap1.setNsPrefix("x", "http://foo/");
prefixes.close();
prefixes = createTesting(Location.create(dir), new DatasetControlMRSW());
assertEquals("http://foo/", pmap1.getNsPrefixURI("x"));
prefixes.close();
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class Prologue method sub.
public Prologue sub(PrefixMapping newMappings, String base) {
// New prefix mappings
PrefixMapping ext = getPrefixMapping();
if (newMappings != null)
ext = new PrefixMapping2(ext, newMappings);
// New base.
IRIResolver r = resolver;
if (base != null)
r = IRIResolver.create(base);
return new Prologue(ext, r);
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestSSE_Forms method beforeClass.
@BeforeClass
public static void beforeClass() {
original = SSE.getPrefixMapRead();
PrefixMapping pmaptest = new PrefixMappingImpl().setNsPrefixes(original).removeNsPrefix("").removeNsPrefix("ex");
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestModelPrefixMapping method doOnlyFreshPrefixes.
/**
* Test that existing prefixes are not over-ridden by the default ones.
*/
private void doOnlyFreshPrefixes() {
final String newURI = "abc:def/";
final Graph g = Factory.createDefaultGraph();
final PrefixMapping pm = g.getPrefixMapping();
pm.setNsPrefix(TestModelPrefixMapping.alphaPrefix, newURI);
final Model m = ModelFactory.createModelForGraph(g);
Assert.assertEquals(newURI, m.getNsPrefixURI(TestModelPrefixMapping.alphaPrefix));
Assert.assertEquals(TestModelPrefixMapping.betaURI, m.getNsPrefixURI(TestModelPrefixMapping.betaPrefix));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class FusekiLib method addDataInto.
public static void addDataInto(DatasetGraph src, DatasetGraph dest) {
Iterator<Quad> iter = src.find(Node.ANY, Node.ANY, Node.ANY, Node.ANY);
for (; iter.hasNext(); ) {
Quad q = iter.next();
dest.add(q);
}
PrefixMapping pmapSrc = src.getDefaultGraph().getPrefixMapping();
PrefixMapping pmapDest = dest.getDefaultGraph().getPrefixMapping();
pmapDest.withDefaultMappings(pmapSrc);
}
Aggregations