use of de.uni_koblenz.aggrimm.icp.crypto.sign.graph.Triple in project webofneeds by researchstudio-sat.
the class ModelConverter method modelToGraphCollection.
private static GraphCollection modelToGraphCollection(String name, Model model, Map<String, String> pm) {
// Convert each subj pred obj in Jena Statement into String and add to
// SigningFramework's NamedGraph.
// The simpler approach with just using Jena's writer and Signingframework's
// reader to transform data between data structures won't work since
// Signingframework has problems with recognizing the [] structure
GraphCollection graphc = new GraphCollection();
NamedGraph namedGraph = new NamedGraph(enclose(name, "<", ">"), 0, null);
StmtIterator iterator = model.listStatements();
while (iterator.hasNext()) {
Statement stmt = iterator.nextStatement();
String subjString = rdfNodeAsString(stmt.getSubject());
String objString = rdfNodeAsString(stmt.getObject());
String predString = enclose(stmt.getPredicate().asResource().getURI(), "<", ">");
Triple gcTriple = new Triple(subjString, predString, objString);
namedGraph.addTriple(gcTriple);
}
graphc.addGraph(namedGraph);
for (String prefix : pm.keySet()) {
graphc.addPrefix(new Prefix(prefix + ":", "<" + pm.get(prefix) + ">"));
}
return graphc;
}
Aggregations