use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestPrefixMappingUtils method prefixes3.
@Test
public void prefixes3() {
// Some URIs without prefixes.
String data = StrUtils.strjoinNL("@prefix : <http://example/> .", "", "<http://other/s1> :p :x1 .");
Graph graph1 = create(data);
PrefixMapping pmap = PrefixMappingUtils.calcInUsePrefixMapping(graph1);
PrefixMapping pmapExpected = new PrefixMappingImpl();
pmapExpected.setNsPrefix("", "http://example/");
Assert.assertTrue(sameMapping(pmapExpected, pmap));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestPrefixMappingTDBExtra method persistent1.
// Persistent.
@Test
public void persistent1() {
String dir = ConfigTest.getTestingDir();
FileOps.clearAll(dir);
DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(Location.create(dir));
Txn.execute(dsg, () -> {
PrefixMapping pmap1 = dsg.getDefaultGraph().getPrefixMapping();
String x = pmap1.getNsPrefixURI("x");
assertNull(x);
});
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class GraphContractTest method testGetPrefixMapping.
@ContractTest
public void testGetPrefixMapping() {
Graph g = producer.newInstance();
txnBegin(g);
PrefixMapping pm = g.getPrefixMapping();
assertNotNull("Must return prefix mapping", pm);
assertSame("getPrefixMapping must always return the same object", pm, g.getPrefixMapping());
txnRollback(g);
pm.setNsPrefix("pfx1", "http://example.com/");
pm.setNsPrefix("pfx2", "scheme:rope/string#");
txnBegin(g);
// assert same after adding to other mapl
assertSame("getPrefixMapping must always return the same object", pm, g.getPrefixMapping());
txnRollback(g);
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class BuilderPrefixMapping method build.
public static PrefixMapping build(Item elt) {
PrefixMapping pmap = new PrefixMappingImpl();
build(pmap, elt);
return pmap;
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestFmtUtils method getPrefixMapping.
private PrefixMapping getPrefixMapping() {
PrefixMapping pmap = new PrefixMappingImpl();
pmap.setNsPrefix("zz", aUri);
return pmap;
}
Aggregations