// now process all the collected StmtKeys:
for ( StmtKey stmtKey : stmtRsrsMap.keySet() ) {
// create and add the mapping to the list:
Mapping mapping = new Mapping(stmtKey.getSubject(), stmtKey.getPredicate(), stmtKey.getObject());
mappings.add(mapping);
// get the associated resources (reified statements) if any, to collect the metadata:
Map<String,String> md = new HashMap<String,String>();
for ( Resource stmtRsr : stmtRsrsMap.get(stmtKey) ) {
_getMetadataForReified(stmtRsr, md);
//
// TODO Note that later elements in this loop will overwrite common metadata properties.
// To be more concrete, if the (s,p,o) mapping happens to appear in two or more
// reified statements, each with its associated metadata, we are not *aggregating*
// such metadata (for example, rdfs:comment properties may be multiple), but
// *overwriting*, EVEN in the same reified statement, actually.
}
// assign the metadata map only if non-empty:
if ( md.size() > 0 ) {
mapping.setMetadata(md);
}
}
// sort the mappings lexicographically by <left><relation><right>:
Collections.sort(mappings, new Comparator<Mapping>() {