@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
Worksheet worksheet = workspace.getWorksheet(worksheetId);
SuperSelection selection = getSuperSelection(worksheet);
RepFactory factory = workspace.getFactory();
TripleStoreUtil util = new TripleStoreUtil();
HashMap<String, List<String>> result = null;
nodeUri = nodeUri.trim();
Map<String, Label> parents = workspace.getOntologyManager().getSuperClasses(nodeUri, true);
Set<String> classes = new HashSet<String>(parents.keySet());
classes.add(nodeUri);
StringBuilder builder = new StringBuilder();
nodeUri = builder.append("<").append(nodeUri).append(">").toString();
try {
result = util.getPredicatesForTriplesMapsWithSameClass(tripleStoreUrl, context, classes);
} catch (KarmaException e) {
LOG.error("Unable to find predicates for triples maps with same class as: " + nodeUri, e);
}
final JSONArray array = new JSONArray();
List<JSONObject> objects = new ArrayList<JSONObject>();
List<String> concatenatedPredicateObjectMapsList = result.get("predicateObjectMaps");
List<String> predicates = result.get("predicates");
List<String> otherClasses = result.get("otherClasses");
Iterator<String> concatenatedPredicateObjectMapsListItr = concatenatedPredicateObjectMapsList.iterator();
Iterator<String> predicatesItr = predicates.iterator();
Iterator<String> otherClassesItr = otherClasses.iterator();
String hNodeId = FetchHNodeIdFromAlignmentCommand.gethNodeId(AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId), columnUri);
if (hNodeId == null) {
return new UpdateContainer(new AbstractUpdate() {
@Override
public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) {
pw.print(array.toString());
}
});
}
HNode hnode = factory.getHNode(hNodeId);
List<Table> dataTables = new ArrayList<Table>();
CloneTableUtils.getDatatable(worksheet.getDataTable(), factory.getHTable(hnode.getHTableId()), dataTables, selection);
KR2RMLBloomFilter uris = new KR2RMLBloomFilter(KR2RMLBloomFilter.defaultVectorSize, KR2RMLBloomFilter.defaultnbHash, Hash.JENKINS_HASH);
Set<String> uriSet = new HashSet<String>();
for(Table t : dataTables) {
for(Row r : t.getRows(0, t.getNumRows(), selection)) {
Node n = r.getNode(hNodeId);