use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.
the class SHACLC method withStandardPrefixes.
/**
* Return a copy of the {@link PrefixMapping} with the SHACLC standard prefixes added
*/
public static PrefixMapping withStandardPrefixes(PrefixMapping prefixMapping) {
PrefixMapping pm = new PrefixMappingImpl();
addStandardPrefixes(pm);
// Add second to override any of the standard settings.
pm.setNsPrefixes(prefixMapping);
return pm;
}
use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.
the class TestSolverTDB method beforeClass.
@BeforeClass
public static void beforeClass() {
dataset = TDBFactory.createDataset();
dataset.begin(ReadWrite.WRITE);
String graphData = ConfigTest.getTestingDataRoot() + "/Data/solver-data.ttl";
RDFDataMgr.read(dataset, graphData);
pmap = new PrefixMappingImpl();
pmap.setNsPrefix("", "http://example/");
}
use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.
the class SecuredPrefixMappingTest method testWithDefaultMappings.
@Test
public void testWithDefaultMappings() {
PrefixMapping pm = new PrefixMappingImpl();
pm.setNsPrefix("example", "http://example.com");
try {
// make sure that it must update
securedMapping.withDefaultMappings(pm);
if (!securityEvaluator.evaluate(principal, Action.Update, securedMapping.getModelNode())) {
Assert.fail("Should have thrown UpdateDeniedException");
}
} catch (final UpdateDeniedException e) {
if (securityEvaluator.evaluate(principal, Action.Update, securedMapping.getModelNode())) {
Assert.fail(String.format("Should not have thrown UpdateDeniedException Exception: %s - %s", e, e.getTriple()));
}
}
}
use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.
the class WhereHandlerTest method testAddOptionalObjectsWithPath.
@Test
public void testAddOptionalObjectsWithPath() {
PrefixMapping pmap = new PrefixMappingImpl();
pmap.setNsPrefix("ts", "urn:test:");
Path path = PathParser.parse("ts:two/ts:dos", pmap);
handler.addOptional(new TriplePath(NodeFactory.createURI("one"), path, ResourceFactory.createLangLiteral("three", "en-US").asNode()));
handler.build();
ElementPathBlock epb = new ElementPathBlock();
ElementOptional optional = new ElementOptional(epb);
TriplePath tp = new TriplePath(NodeFactory.createURI("one"), path, ResourceFactory.createLangLiteral("three", "en-US").asNode());
epb.addTriplePath(tp);
WhereValidator visitor = new WhereValidator(optional);
handler.getQueryPattern().visit(visitor);
assertTrue(visitor.matching);
}
use of org.apache.jena.shared.impl.PrefixMappingImpl in project jena by apache.
the class WhereHandlerTest method testAddWhereObjectsWithPath.
@Test
public void testAddWhereObjectsWithPath() {
PrefixMapping pmap = new PrefixMappingImpl();
pmap.setNsPrefix("ts", "urn:test:");
Path path = PathParser.parse("ts:two/ts:dos", pmap);
handler.addWhere(new TriplePath(NodeFactory.createURI("one"), path, ResourceFactory.createLangLiteral("three", "en-US").asNode()));
handler.build();
TriplePath tp = new TriplePath(NodeFactory.createURI("one"), path, ResourceFactory.createLangLiteral("three", "en-US").asNode());
ElementPathBlock epb = new ElementPathBlock();
epb.addTriple(tp);
WhereValidator wv = new WhereValidator(epb);
query.getQueryPattern().visit(wv);
assertTrue(wv.matching);
}
Aggregations