Iterator<String> otherClassesItr = otherClasses.iterator();
String hNodeId = FetchHNodeIdFromAlignmentCommand.gethNodeId(AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId), columnUri);
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);
if(n != null && n.getValue() != null && !n.getValue().isEmptyValue() && n.getValue().asString() != null && !n.getValue().asString().trim().isEmpty() ) {
String value = n.getValue().asString().trim().replace(" ", "");;
builder = new StringBuilder();
String baseURI = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.baseURI);
try {
URI uri = new URI(value);
if (!uri.isAbsolute() && baseURI != null) {
value = baseURI + value;
}
} catch (URISyntaxException e) {
}
value = builder.append("<").append(value).append(">").toString(); //String builder
uriSet.add(value);
uris.add(new Key(value.getBytes(UTF8_CHARSET)));
}
}
}
Set<String> maps = new HashSet<String>();
Map<String, String> bloomfilterMapping = new HashMap<String, String>();
try{
for (String concatenatedPredicateObjectMaps : concatenatedPredicateObjectMapsList) {
List<String> predicateObjectMaps = new ArrayList<String>(Arrays.asList(concatenatedPredicateObjectMaps.split(",")));
maps.addAll(predicateObjectMaps);
if (maps.size() > limit) {
bloomfilterMapping.putAll(util.getBloomFiltersForMaps(tripleStoreUrl, null, maps));
maps = new HashSet<String>();
}
}
if (maps.size() > 0)
bloomfilterMapping.putAll(util.getBloomFiltersForMaps(tripleStoreUrl, null, maps));
} catch (KarmaException e1) {
e1.printStackTrace();
}
while(concatenatedPredicateObjectMapsListItr.hasNext() && predicatesItr.hasNext() && otherClassesItr.hasNext())
{
String concatenatedPredicateObjectMaps = concatenatedPredicateObjectMapsListItr.next();
List<String> predicateObjectMaps = new ArrayList<String>(Arrays.asList(concatenatedPredicateObjectMaps.split(",")));
String predicate = predicatesItr.next();
String otherClass = otherClassesItr.next();
try {
KR2RMLBloomFilter intersectionBF = new KR2RMLBloomFilter(KR2RMLBloomFilter.defaultVectorSize, KR2RMLBloomFilter.defaultnbHash, Hash.JENKINS_HASH);
for (String triplemap : predicateObjectMaps) {
String serializedBloomFilter = bloomfilterMapping.get(triplemap);
if (serializedBloomFilter != null) {
KR2RMLBloomFilter bf = new KR2RMLBloomFilter();
bf.populateFromCompressedAndBase64EncodedString(serializedBloomFilter);
intersectionBF.or(bf);
}
}
intersectionBF.and(uris);
int estimate = intersectionBF.estimateNumberOfHashedValues();