-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
178 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
abecto-core/src/main/java/de/uni_jena/cs/fusion/abecto/measure/DeduplicatedCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*- | ||
* Copyright © 2019-2022 Heinz Nixdorf Chair for Distributed Information Systems, | ||
* Friedrich Schiller University Jena (http://www.fusion.uni-jena.de/) | ||
* Copyright © 2023-2024 Jan Martin Keil ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
-*/ | ||
|
||
package de.uni_jena.cs.fusion.abecto.measure; | ||
|
||
import de.uni_jena.cs.fusion.abecto.vocabulary.AV; | ||
import de.uni_jena.cs.fusion.abecto.vocabulary.OM; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class DeduplicatedCount extends PerDatasetLongMeasure { | ||
|
||
public DeduplicatedCount() { | ||
super(AV.deduplicatedCount, OM.one); | ||
} | ||
|
||
public static DeduplicatedCount calculate(Count count, DuplicateCount duplicateCount) { | ||
DeduplicatedCount deduplicatedCount = new DeduplicatedCount(); | ||
deduplicatedCount.setDifferenceOf(count, duplicateCount); | ||
return deduplicatedCount; | ||
} | ||
|
||
public static Map<String, DeduplicatedCount> createMapByVariable(Iterable<String> variables) { | ||
Map<String, DeduplicatedCount> mapOfCounts = new HashMap<>(); | ||
for (String variable : variables) { | ||
DeduplicatedCount countOfVariable = new DeduplicatedCount(); | ||
countOfVariable.setVariable(variable); | ||
mapOfCounts.put(variable, countOfVariable); | ||
} | ||
return mapOfCounts; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
abecto-core/src/main/java/de/uni_jena/cs/fusion/abecto/measure/DuplicateCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*- | ||
* Copyright © 2019-2022 Heinz Nixdorf Chair for Distributed Information Systems, | ||
* Friedrich Schiller University Jena (http://www.fusion.uni-jena.de/) | ||
* Copyright © 2023-2024 Jan Martin Keil ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
-*/ | ||
|
||
package de.uni_jena.cs.fusion.abecto.measure; | ||
|
||
import de.uni_jena.cs.fusion.abecto.vocabulary.OM; | ||
|
||
public class DuplicateCount extends PerDatasetLongMeasure { | ||
|
||
public DuplicateCount() { | ||
super(null, OM.one); // TODO define measure IRI | ||
} | ||
|
||
public static DuplicateCount calculate(Count count, DeduplicatedCount deduplicatedCount) { | ||
DuplicateCount duplicateCount = new DuplicateCount(); | ||
duplicateCount.setDifferenceOf(count, deduplicatedCount); | ||
return duplicateCount; | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
abecto-core/src/main/java/de/uni_jena/cs/fusion/abecto/measure/LongMeasure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*- | ||
* Copyright © 2019-2022 Heinz Nixdorf Chair for Distributed Information Systems, | ||
* Friedrich Schiller University Jena (http://www.fusion.uni-jena.de/) | ||
* Copyright © 2023-2024 Jan Martin Keil ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
-*/ | ||
|
||
package de.uni_jena.cs.fusion.abecto.measure; | ||
|
||
import org.apache.jena.rdf.model.Resource; | ||
|
||
public abstract class LongMeasure<K> extends Measure<K, Long> { | ||
|
||
public LongMeasure(Resource quantity, Resource unit) { | ||
super(quantity, unit); | ||
} | ||
|
||
public void setZero(K key) { | ||
values.put(key, 0L); | ||
} | ||
|
||
public void incrementByOrSetOne(K key) { | ||
incrementByOrSet(key, 1L); | ||
} | ||
|
||
public void incrementByOrSet(K key, long increment) { | ||
values.merge(key, increment, Long::sum); | ||
} | ||
|
||
public void setDifferenceOf(LongMeasure<K> minuend, LongMeasure<K> subtrahend) { | ||
for (K key : minuend.keySet()) { | ||
if (subtrahend.contains(key)) { | ||
set(key, minuend.get(key) - subtrahend.get(key)); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.