code formatting

This commit is contained in:
Claudio Atzori 2020-06-16 16:54:44 +02:00
parent 1bc1d15eaf
commit 306669209f
7 changed files with 96 additions and 83 deletions

View File

@ -1,9 +1,10 @@
package eu.dnetlib.dhp.schema.oaf; package eu.dnetlib.dhp.schema.oaf;
import com.google.common.base.Objects;
import java.util.List; 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. * 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; private String id;
/** /**
* List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, * List of units associated with this measure. KeyValue provides a pair to store the laber (key) and the value, plus
* plus common provenance information. * common provenance information.
*/ */
private List<KeyValue> unit; private List<KeyValue> unit;
@ -42,8 +43,10 @@ public class Measure {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o)
if (o == null || getClass() != o.getClass()) return false; return true;
if (o == null || getClass() != o.getClass())
return false;
Measure measure = (Measure) o; Measure measure = (Measure) o;
return Objects.equal(id, measure.id) && return Objects.equal(id, measure.id) &&
Objects.equal(unit, measure.unit); Objects.equal(unit, measure.unit);

View File

@ -35,5 +35,4 @@ public class Programme implements Serializable {
return Objects.equals(code, programme.code); return Objects.equals(code, programme.code);
} }
} }

View File

@ -8,10 +8,10 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; 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 * Relation models any edge between two nodes in the OpenAIRE graph. It has a source id and a target id pointing to
* pointing to graph node identifiers and it is further characterised by the semantic of the link through the fields * graph node identifiers and it is further characterised by the semantic of the link through the fields relType,
* relType, subRelType and relClass. Provenance information is modeled according to the dataInfo element and collectedFrom, * subRelType and relClass. Provenance information is modeled according to the dataInfo element and collectedFrom, while
* while individual relationship types can provide extra information via the properties field. * individual relationship types can provide extra information via the properties field.
*/ */
public class Relation extends Oaf { public class Relation extends Oaf {
@ -26,7 +26,8 @@ public class Relation extends Oaf {
private String subRelType; 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; private String relClass;
@ -51,7 +52,8 @@ public class Relation extends Oaf {
private String validationDate; 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<>(); private List<KeyValue> properties = new ArrayList<>();

View File

@ -1,14 +1,16 @@
package eu.dnetlib.dhp.schema.oaf; 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.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; 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 { public class MeasureTest {
@ -20,12 +22,18 @@ public class MeasureTest {
Measure popularity = new Measure(); Measure popularity = new Measure();
popularity.setId("popularity"); popularity.setId("popularity");
popularity.setUnit(Lists.newArrayList( popularity
.setUnit(
Lists
.newArrayList(
unit("score", "0.5"))); unit("score", "0.5")));
Measure influence = new Measure(); Measure influence = new Measure();
influence.setId("influence"); influence.setId("influence");
influence.setUnit(Lists.newArrayList( influence
.setUnit(
Lists
.newArrayList(
unit("score", "0.3"))); unit("score", "0.3")));
List<Measure> m = Lists.newArrayList(popularity, influence); List<Measure> m = Lists.newArrayList(popularity, influence);
@ -33,7 +41,8 @@ public class MeasureTest {
String s = OBJECT_MAPPER.writeValueAsString(m); String s = OBJECT_MAPPER.writeValueAsString(m);
System.out.println(s); 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); Assertions.assertNotNull(mm);
} }

View File

@ -1,3 +1,4 @@
package eu.dnetlib.dhp.actionmanager.project; package eu.dnetlib.dhp.actionmanager.project;
import java.io.Serializable; import java.io.Serializable;

View File

@ -90,6 +90,5 @@ public class SparkUpdateProjectTest {
Assertions.assertEquals(14, tmp.count()); Assertions.assertEquals(14, tmp.count());
} }
} }