use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class SecuredPrefixMappingTest method runTests.
public static void runTests(final SecurityEvaluator securityEvaluator, final PrefixMapping prefixMapping) throws Exception {
final PrefixMapping pm = prefixMapping;
Assert.assertNotNull("PrefixMapping may not be null", pm);
Assert.assertTrue("PrefixMapping should be secured", pm instanceof SecuredPrefixMapping);
final SecuredPrefixMappingTest pmTest = new SecuredPrefixMappingTest(securityEvaluator) {
@Override
public void setup() {
this.securedMapping = (SecuredPrefixMapping) pm;
}
};
Method lockTest = null;
for (final Method m : pmTest.getClass().getMethods()) {
if (m.isAnnotationPresent(Test.class)) {
// lock test must come last
if (m.getName().equals("testLock")) {
lockTest = m;
} else {
pmTest.setup();
m.invoke(pmTest);
}
}
}
Assert.assertNotNull("Did not find 'testLock' method", lockTest);
pmTest.setup();
lockTest.invoke(pmTest);
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestGraphOverDataset method graphDSG_prefixes_1.
// ---- prefixes
@Test
public void graphDSG_prefixes_1() {
Graph g = makeNamedGraph(baseDSG, gn1);
PrefixMapping pmap = g.getPrefixMapping();
assertNotNull(pmap);
}
use of org.apache.jena.shared.PrefixMapping in project webofneeds by researchstudio-sat.
the class CommentModeratedFacet method connectFromOwner.
@Override
public void connectFromOwner(Connection con, Model content, WonMessage wonMessage) throws NoSuchNeedException, IllegalMessageForNeedStateException, ConnectionAlreadyExistsException {
super.connectFromOwner(con, content, wonMessage);
/* when connected change linked data*/
PrefixMapping prefixMapping = PrefixMapping.Factory.create();
prefixMapping.setNsPrefix(SIOC.getURI(), "sioc");
content.withDefaultMappings(prefixMapping);
content.setNsPrefix("sioc", SIOC.getURI());
Resource post = content.createResource(con.getConnectionURI() + "/p/", SIOC.POST);
content.add(content.createStatement(content.getResource(con.getConnectionURI().toString()), SIOC.HAS_REPLY, content.getResource(con.getRemoteConnectionURI().toString())));
logger.debug(RdfUtils.toString(content));
con.getDatasetHolder().getDataset().setDefaultModel(content);
datasetHolderRepository.save(con.getDatasetHolder());
}
use of org.apache.jena.shared.PrefixMapping in project webofneeds by researchstudio-sat.
the class WonLinkedDataUtils method getConnectionNetwork.
public static Dataset getConnectionNetwork(URI atomURI, URI webId, LinkedDataSource linkedDataSource) {
assert linkedDataSource != null : "linkedDataSource must not be null";
int depth = 5;
int maxRequests = 1000;
List<Path> propertyPaths = new ArrayList<>();
PrefixMapping pmap = new PrefixMappingImpl();
pmap.withDefaultMappings(PrefixMapping.Standard);
pmap.setNsPrefix("won", WON.getURI());
pmap.setNsPrefix("msg", WONMSG.getURI());
propertyPaths.add(PathParser.parse("won:connections", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member", pmap));
return linkedDataSource.getDataForResourceWithPropertyPath(atomURI, webId, propertyPaths, maxRequests, depth);
}
use of org.apache.jena.shared.PrefixMapping in project webofneeds by researchstudio-sat.
the class WonLinkedDataUtils method getFullAtomDataset.
public static Dataset getFullAtomDataset(URI atomURI, LinkedDataSource linkedDataSource) {
assert linkedDataSource != null : "linkedDataSource must not be null";
int depth = 7;
int maxRequests = 1000;
List<Path> propertyPaths = new ArrayList<>();
PrefixMapping pmap = new PrefixMappingImpl();
pmap.withDefaultMappings(PrefixMapping.Standard);
pmap.setNsPrefix("won", WON.getURI());
pmap.setNsPrefix("msg", WONMSG.getURI());
propertyPaths.add(PathParser.parse("won:connections", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member/msg:correspondingRemoteMessage", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:messageContainer/rdfs:member/msg:previousMessage", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer/rdfs:member", pmap));
propertyPaths.add(PathParser.parse("won:connections/rdfs:member/won:sourceAtom/won:messageContainer/rdfs:member/msg:previousMessage", pmap));
return linkedDataSource.getDataForResourceWithPropertyPath(atomURI, atomURI, propertyPaths, maxRequests, depth);
}
Aggregations