use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class SHACLC method withStandardPrefixes.
/**
* Return a copy of the {@link PrefixMap} with the SHACLC standard prefixes added
*/
public static PrefixMap withStandardPrefixes(PrefixMap pmap) {
PrefixMap pmap2 = PrefixMapFactory.create();
addStandardPrefixes(pmap2);
// Add second to override any of the standard settings.
pmap2.putAll(pmap);
return pmap2;
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class TestDatasetPrefixes method dsg_prefixes_basic_4.
@Test
public void dsg_prefixes_basic_4() {
DatasetGraph dsg = create();
Txn.executeWrite(dsg, () -> {
PrefixMap pmap = dsg.prefixes();
pmap.add("ex", "http://example/");
pmap.delete("ex");
String x = pmap.get("ex");
assertNull(x);
assertEquals(0, pmap.size());
assertTrue(pmap.isEmpty());
});
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class TestDatasetPrefixes method dsg_prefixes_basic_3.
@Test
public void dsg_prefixes_basic_3() {
DatasetGraph dsg = create();
Txn.executeWrite(dsg, () -> {
PrefixMap pmap = dsg.prefixes();
pmap.add("ex", "http://example/");
pmap.add("ex", "http://example/1");
String x = pmap.get("ex");
assertEquals("http://example/1", x);
assertEquals(1, pmap.size());
assertFalse(pmap.isEmpty());
});
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class TestDatasetPrefixes method dsg_prefixes_basic_5.
@Test
public void dsg_prefixes_basic_5() {
Assume.assumeTrue(unifiedPrefixMaps);
DatasetGraph dsg = create();
Txn.executeWrite(dsg, () -> {
PrefixMap pmap = dsg.prefixes();
pmap.add("ex", "http://example/");
PrefixMap pmapDft = Prefixes.adapt(dsg.getDefaultGraph().getPrefixMapping());
String x1 = pmapDft.get("ex");
assertEquals("http://example/", x1);
pmapDft.add("ex", "http://example/ns2");
PrefixMap pmapUnion = Prefixes.adapt(dsg.getUnionGraph().getPrefixMapping());
String x2 = pmapUnion.get("ex");
assertEquals("http://example/ns2", x2);
String x3 = pmap.get("ex");
assertEquals("http://example/ns2", x2);
});
}
use of org.apache.jena.riot.system.PrefixMap in project jena by apache.
the class ShaclCompactParser method iriOrLiteral.
// iriOrLiteral: If there is an iri, return the node derived from iri. Otherwise,
// apply Turtle's parsing rules to turn the string literal into an RDF literal.
// (from the test cases, this does not mean parse the node string again)
private Node iriOrLiteral(Node x) {
if (x.isURI())
return x;
String s = x.getLiteralLexicalForm();
PrefixMap pmap = super.profile.getPrefixMap();
Node n = TokenizerText.create().fromString(s).build().next().asNode(pmap);
return n;
}
Aggregations