@@ -73,7 +73,8 @@ public class PropertyComparisonProcessor extends ComparisonProcessor<PropertyCom
73
73
public boolean allowLangTagSkip ;
74
74
Aspect theAspect ; // TODO rename to `aspect` after renaming the aspect parameter variable into `aspectIri`
75
75
Set <Resource > datasets ;
76
- Set <ResourcePair > datasetPairs ;
76
+ Set <ResourcePair > datasetPairsWithoutRepetition ;
77
+ Set <ResourcePair > datasetPairsWithRepetition ;
77
78
Set <ResourceTupel > datasetTupels ;
78
79
Map <Resource , Model > outputMetaModelByDataset ;
79
80
/**
@@ -123,7 +124,7 @@ public final void run() {
123
124
}
124
125
}
125
126
126
- for (ResourcePair datasetPair : datasetPairs ) {
127
+ for (ResourcePair datasetPair : datasetPairsWithRepetition ) {
127
128
for (String variable : variables ) {
128
129
if (theAspect .getPattern (datasetPair .first ).getResultVars ().contains (variable )
129
130
&& theAspect .getPattern (datasetPair .second ).getResultVars ().contains (variable )) {
@@ -147,7 +148,8 @@ private void setAspect(Resource aspect) {
147
148
148
149
private void setAspectDatasets () {
149
150
datasets = theAspect .getDatasets ();
150
- datasetPairs = ResourcePair .getPairsOf (datasets );
151
+ datasetPairsWithoutRepetition = ResourcePair .getPairsWithoutRepetitionOf (datasets );
152
+ datasetPairsWithRepetition = ResourcePair .getPairsWithRepetitionOf (datasets );
151
153
datasetTupels = ResourceTupel .getTupelsOf (datasets );
152
154
outputMetaModelByDataset = getOutputMetaModels (datasets );
153
155
}
@@ -164,7 +166,6 @@ private void initializeCount() {
164
166
count = new HashMap <>();
165
167
for (String variable : variables ) {
166
168
PerDatasetCount countOfVariable = new PerDatasetCount (AV .count , OM .one );
167
- countOfVariable .reset (datasets , 0L );
168
169
count .put (variable , countOfVariable );
169
170
}
170
171
}
@@ -173,7 +174,6 @@ private void initializeDeduplicatedCount() {
173
174
deduplicatedCount = new HashMap <>();
174
175
for (String variable : variables ) {
175
176
PerDatasetCount deduplicatedCountOfVariable = new PerDatasetCount (AV .deduplicatedCount , OM .one );
176
- deduplicatedCountOfVariable .reset (datasets , 0L );
177
177
deduplicatedCount .put (variable , deduplicatedCountOfVariable );
178
178
}
179
179
}
@@ -182,7 +182,6 @@ private void initializeAbsoluteCoverage() {
182
182
absoluteCoverage = new HashMap <>();
183
183
for (String variable : variables ) {
184
184
PerDatasetPairCount absoluteCoverageOfVariable = new PerDatasetPairCount (AV .absoluteCoverage , OM .one );
185
- absoluteCoverageOfVariable .reset (datasetPairs , 0L );
186
185
absoluteCoverage .put (variable , absoluteCoverageOfVariable );
187
186
}
188
187
}
@@ -281,14 +280,14 @@ private void countAndDeduplicateValuesOfUncoveredResource() {
281
280
void measureCountAndDeduplicatedCount (Resource dataset , String variable , Collection <RDFNode > valuesOfVariable ) {
282
281
long valuesCountWithDuplicates = valuesOfVariable .size ();
283
282
long valuesCountWithoutDuplicates = deduplicate (valuesOfVariable ).size ();
284
- count .get (variable ).incrementBy (dataset , valuesCountWithDuplicates );
285
- deduplicatedCount .get (variable ).incrementBy (dataset , valuesCountWithoutDuplicates );
283
+ count .get (variable ).incrementByOrSet (dataset , valuesCountWithDuplicates );
284
+ deduplicatedCount .get (variable ).incrementByOrSet (dataset , valuesCountWithoutDuplicates );
286
285
}
287
286
288
287
private void calculateCompleteness () {
289
288
for (String variable : variables ) {
290
289
// TODO add value exclusion filter description to measurement description
291
- completeness .put (variable , calculateCompleteness (datasetPairs , absoluteCoverage .get (variable ), deduplicatedCount .get (variable )));
290
+ completeness .put (variable , calculateCompleteness (datasetPairsWithoutRepetition , absoluteCoverage .get (variable ), deduplicatedCount .get (variable )));
292
291
}
293
292
}
294
293
@@ -389,9 +388,13 @@ public void calculateDeviationsAndOmissions(String variable, ResourcePair datase
389
388
mapResources (variable , resourcesByMappedValues , valuesByVariableByResource1 );
390
389
mapResources (variable , resourcesByMappedValues , valuesByVariableByResource2 );
391
390
391
+
392
392
// update measurements
393
- int pairwiseOverlap = getPairwiseOverlap (valuesByVariableByResource1 .keySet (), valuesByVariableByResource2 .keySet (), resourcesByMappedValues );
394
- absoluteCoverage .get (variable ).incrementBy (datasetPair , pairwiseOverlap );
393
+ if (!datasetPair .first .equals (datasetPair .second )) {// do not measure for first == second
394
+ // TODO test, that no absolute coverage exist for dataset compared with itself
395
+ int pairwiseOverlap = getPairwiseOverlap (valuesByVariableByResource1 .keySet (), valuesByVariableByResource2 .keySet (), resourcesByMappedValues );
396
+ absoluteCoverage .get (variable ).incrementByOrSet (datasetPair , pairwiseOverlap );
397
+ }
395
398
396
399
// deviation: a pair of resources with each having a value not present in the
397
400
// other resource
0 commit comments