forked from D-Net/dnet-hadoop
code formatting
This commit is contained in:
parent
1bc1d15eaf
commit
306669209f
|
@ -1,9 +1,10 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represent a measure, must be further described by a system available resource providing name and descriptions.
|
||||
*/
|
||||
|
@ -15,8 +16,8 @@ public class Measure {
|
|||
private String id;
|
||||
|
||||
/**
|
||||
* List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value,
|
||||
* plus common provenance information.
|
||||
* List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, plus
|
||||
* common provenance information.
|
||||
*/
|
||||
private List<KeyValue> unit;
|
||||
|
||||
|
@ -37,13 +38,15 @@ public class Measure {
|
|||
}
|
||||
|
||||
public void mergeFrom(Measure m) {
|
||||
//TODO
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Measure measure = (Measure) o;
|
||||
return Objects.equal(id, measure.id) &&
|
||||
Objects.equal(unit, measure.unit);
|
||||
|
|
|
@ -35,5 +35,4 @@ public class Programme implements Serializable {
|
|||
return Objects.equals(code, programme.code);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ import java.util.stream.Collectors;
|
|||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id
|
||||
* pointing to graph node identifiers and it is further characterised by the semantic of the link through the fields
|
||||
* relType, subRelType and relClass. Provenance information is modeled according to the dataInfo element and collectedFrom,
|
||||
* while individual relationship types can provide extra information via the properties field.
|
||||
* Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id pointing to
|
||||
* graph node identifiers and it is further characterised by the semantic of the link through the fields relType,
|
||||
* subRelType and relClass. Provenance information is modeled according to the dataInfo element and collectedFrom, while
|
||||
* individual relationship types can provide extra information via the properties field.
|
||||
*/
|
||||
public class Relation extends Oaf {
|
||||
|
||||
|
@ -26,7 +26,8 @@ public class Relation extends Oaf {
|
|||
private String subRelType;
|
||||
|
||||
/**
|
||||
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges, 'isMergedIn'.
|
||||
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges,
|
||||
* 'isMergedIn'.
|
||||
*/
|
||||
private String relClass;
|
||||
|
||||
|
@ -51,7 +52,8 @@ public class Relation extends Oaf {
|
|||
private String validationDate;
|
||||
|
||||
/**
|
||||
* List of relation specific properties. Values include 'similarityLevel', indicating the similarity score between a pair of publications.
|
||||
* List of relation specific properties. Values include 'similarityLevel', indicating the similarity score between a
|
||||
* pair of publications.
|
||||
*/
|
||||
private List<KeyValue> properties = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ public class Result extends OafEntity implements Serializable {
|
|||
|
||||
Result r = (Result) e;
|
||||
|
||||
//TODO consider merging also Measures
|
||||
// TODO consider merging also Measures
|
||||
|
||||
instance = mergeLists(instance, r.getInstance());
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.oaf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class MeasureTest {
|
||||
|
||||
|
@ -20,12 +22,18 @@ public class MeasureTest {
|
|||
|
||||
Measure popularity = new Measure();
|
||||
popularity.setId("popularity");
|
||||
popularity.setUnit(Lists.newArrayList(
|
||||
popularity
|
||||
.setUnit(
|
||||
Lists
|
||||
.newArrayList(
|
||||
unit("score", "0.5")));
|
||||
|
||||
Measure influence = new Measure();
|
||||
influence.setId("influence");
|
||||
influence.setUnit(Lists.newArrayList(
|
||||
influence
|
||||
.setUnit(
|
||||
Lists
|
||||
.newArrayList(
|
||||
unit("score", "0.3")));
|
||||
|
||||
List<Measure> m = Lists.newArrayList(popularity, influence);
|
||||
|
@ -33,7 +41,8 @@ public class MeasureTest {
|
|||
String s = OBJECT_MAPPER.writeValueAsString(m);
|
||||
System.out.println(s);
|
||||
|
||||
List<Measure> mm = OBJECT_MAPPER.readValue(s, new TypeReference<List<Measure>>() { });
|
||||
List<Measure> mm = OBJECT_MAPPER.readValue(s, new TypeReference<List<Measure>>() {
|
||||
});
|
||||
|
||||
Assertions.assertNotNull(mm);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package eu.dnetlib.dhp.actionmanager.project;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -90,6 +90,5 @@ public class SparkUpdateProjectTest {
|
|||
|
||||
Assertions.assertEquals(14, tmp.count());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue