Java Code Examples for com.googlecode.javaewah.EWAHCompressedBitmap#get()

The following examples show how to use com.googlecode.javaewah.EWAHCompressedBitmap#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastOwlSim.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private double getAttributeGraphInformationContentSimilarity(
		int cix, int dix) throws UnknownOWLClassException {
	long t = System.currentTimeMillis();
	EWAHCompressedBitmap bmc = ancsBitmapCachedModifiable(cix);
	EWAHCompressedBitmap bmd = ancsBitmapCachedModifiable(dix);
	EWAHCompressedBitmap cad = bmc.and(bmd);
	EWAHCompressedBitmap cud = bmc.or(bmd);

	double sumICboth = 0;
	double sumICunion = 0;
	// faster than translating to integer list
	IntIterator it = cud.intIterator();
	while (it.hasNext()) {
		int x = it.next();
		double ic = getInformationContentForAttribute(x);
		// TODO - we can avoid doing this twice by using xor in the bitmap
		sumICunion += ic;

		if (cad.get(x)) {
			sumICboth += ic;
		}
	}
	totalTimeGIC += tdelta(t);
	this.totalCallsGIC++;
	return sumICboth / sumICunion;
}
 
Example 2
Source File: FastOwlSim.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public double getElementGraphInformationContentSimilarity(
		OWLNamedIndividual i, OWLNamedIndividual j) throws UnknownOWLClassException {
	// TODO - optimize
	long t = System.currentTimeMillis();
	EWAHCompressedBitmap bmc = ancsBitmapCachedModifiable(i);
	EWAHCompressedBitmap bmd = ancsBitmapCachedModifiable(j);
	EWAHCompressedBitmap cad = bmc.and(bmd);
	EWAHCompressedBitmap cud = bmc.or(bmd);


	//Set<Node<OWLClass>> ci = getNamedCommonSubsumers(i, j);
	//Set<Node<OWLClass>> cu = getNamedUnionSubsumers(i, j);
	double sumICboth = 0;
	double sumICunion = 0;

	// faster than translating to integer list
	IntIterator it = cud.intIterator();
	while (it.hasNext()) {
		int x = it.next();
		double ic = getInformationContentForAttribute(x);
		// TODO - we can avoid doing this twice by using xor in the bitmap
		sumICunion += ic;

		if (cad.get(x)) {
			sumICboth += ic;
		}
	}

	totalTimeGIC += tdelta(t);
	this.totalCallsGIC++;

	return sumICboth / sumICunion;
}