44import org .rdfhdt .hdt .compact .bitmap .ModifiableBitmap ;
55import org .rdfhdt .hdt .dictionary .Dictionary ;
66import org .rdfhdt .hdt .dictionary .DictionaryDiff ;
7- import org .rdfhdt .hdt .dictionary .impl .utilCat .*;
7+ import org .rdfhdt .hdt .dictionary .impl .utilCat .CatElement ;
8+ import org .rdfhdt .hdt .dictionary .impl .utilCat .CatIntersection ;
9+ import org .rdfhdt .hdt .dictionary .impl .utilCat .CatMapping ;
10+ import org .rdfhdt .hdt .dictionary .impl .utilCat .CatUnion ;
11+ import org .rdfhdt .hdt .dictionary .impl .utilCat .SectionUtil ;
812import org .rdfhdt .hdt .dictionary .impl .utilDiff .DiffWrapper ;
9- import org .rdfhdt .hdt .hdt .HDTVocabulary ;
1013import org .rdfhdt .hdt .listener .ProgressListener ;
1114import org .rdfhdt .hdt .options .ControlInfo ;
1215import org .rdfhdt .hdt .options .ControlInformation ;
1316
14- import java .io .*;
17+ import java .io .FileInputStream ;
18+ import java .io .FileOutputStream ;
19+ import java .io .IOException ;
20+ import java .io .InputStream ;
21+ import java .io .OutputStream ;
1522import java .nio .file .Files ;
1623import java .nio .file .Paths ;
17- import java .util .*;
24+ import java .util .ArrayList ;
25+ import java .util .HashMap ;
26+ import java .util .Iterator ;
27+ import java .util .List ;
28+ import java .util .Map ;
1829
1930public class FourSectionDictionaryDiff implements DictionaryDiff {
2031
@@ -29,7 +40,7 @@ public FourSectionDictionaryDiff(String location) {
2940 }
3041
3142 @ Override
32- public void diff (Dictionary dictionary , Map <String , ModifiableBitmap > bitmaps , ProgressListener listener ) {
43+ public void diff (Dictionary dictionary , Map <String , ModifiableBitmap > bitmaps , ProgressListener listener ) throws IOException {
3344 allMappings .put ("predicate" , new CatMapping (location , "predicate" , dictionary .getPredicates ().getNumberOfElements ()));
3445 allMappings .put ("subject" , new CatMapping (location , "subject" , dictionary .getSubjects ().getNumberOfElements ()));
3546 allMappings .put ("object" , new CatMapping (location , "object" , dictionary .getObjects ().getNumberOfElements ()));
@@ -60,11 +71,7 @@ public void diff(Dictionary dictionary, Map<String, ModifiableBitmap> bitmaps, P
6071 listSkipSubj .add (itSkipSubs );
6172
6273 SharedWrapper sharedWrapper = new SharedWrapper (0 , bitmaps .get ("SH_S" ), bitmaps .get ("SH_O" ), dictionary .getShared ().getSortedEntries ());
63- long numNewSubj = 0 ;
64- while (sharedWrapper .hasNext ()) {
65- sharedWrapper .next ();
66- numNewSubj ++;
67- }
74+ long numNewSubj = sharedWrapper .count ();
6875 sharedWrapper = new SharedWrapper (0 , bitmaps .get ("SH_S" ), bitmaps .get ("SH_O" ), dictionary .getShared ().getSortedEntries ());
6976 listSkipSubj .add (sharedWrapper );
7077
@@ -84,11 +91,7 @@ public void diff(Dictionary dictionary, Map<String, ModifiableBitmap> bitmaps, P
8491
8592 // flag = 1 for objects
8693 sharedWrapper = new SharedWrapper (1 , bitmaps .get ("SH_S" ), bitmaps .get ("SH_O" ), dictionary .getShared ().getSortedEntries ());
87- long numNewObj = 0 ;
88- while (sharedWrapper .hasNext ()) {
89- numNewObj ++;
90- sharedWrapper .next ();
91- }
94+ long numNewObj = sharedWrapper .count ();
9295 sharedWrapper = new SharedWrapper (1 , bitmaps .get ("SH_S" ), bitmaps .get ("SH_O" ), dictionary .getShared ().getSortedEntries ());
9396 listSkipObjs .add (sharedWrapper );
9497
@@ -215,6 +218,15 @@ public boolean hasNext() {
215218 public CatElement next () {
216219 return next ;
217220 }
221+
222+ public int count () {
223+ int i = 0 ;
224+ while (hasNext ()) {
225+ // next();
226+ i ++;
227+ }
228+ return i ;
229+ }
218230 }
219231
220232 @ Override
0 commit comments