Merge pull request 'specific type for result subjects' (#20) from subject_type into master

Reviewed-on: #20
This commit is contained in:
Claudio Atzori 2022-09-09 14:43:53 +02:00
commit f807e189af
5 changed files with 29 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId>
<packaging>jar</packaging>
<version>2.14.1-SNAPSHOT</version>
<version>3.14.1-SNAPSHOT</version>
<licenses>
<license>

View File

@ -38,6 +38,11 @@ public class ModelConstants {
public static final String ACCESS_RIGHT_EMBARGO = "EMBARGO";
public static final String ACCESS_RIGHT_CLOSED = "CLOSED";
public static final String DNET_SUBJECT_KEYWORD = "keyword";
public static final String DNET_SUBJECT_FOS_CLASSID = "FOS";
public static final String DNET_SUBJECT_FOS_CLASSNAME = "Fields of Science and Technology classification";
public static final String DNET_SUBJECT_TYPOLOGIES = "dnet:subject_classification_typologies";
public static final String DNET_RESULT_TYPOLOGIES = "dnet:result_typologies";

View File

@ -60,7 +60,7 @@ public class Result extends OafEntity implements Serializable {
/**
* The Subject.
*/
private List<StructuredProperty> subject;
private List<Subject> subject;
/**
* The Title.
@ -258,7 +258,7 @@ public class Result extends OafEntity implements Serializable {
*
* @return the subject
*/
public List<StructuredProperty> getSubject() {
public List<Subject> getSubject() {
return subject;
}
@ -267,7 +267,7 @@ public class Result extends OafEntity implements Serializable {
*
* @param subject the subject
*/
public void setSubject(List<StructuredProperty> subject) {
public void setSubject(List<Subject> subject) {
this.subject = subject;
}

View File

@ -0,0 +1,6 @@
package eu.dnetlib.dhp.schema.oaf;
import java.io.Serializable;
public class Subject extends StructuredProperty implements Serializable {
}

View File

@ -443,8 +443,8 @@ class MergeTest {
Publication a = publication();
Publication b = publication();
a.setSubject(Arrays.asList(setSP("a", "open", "classe"), setSP("b", "open", "classe")));
b.setSubject(Arrays.asList(setSP("A", "open", "classe"), setSP("c", "open", "classe")));
a.setSubject(Arrays.asList(setSub("a", "open", "classe"), setSub("b", "open", "classe")));
b.setSubject(Arrays.asList(setSub("A", "open", "classe"), setSub("c", "open", "classe")));
a.mergeFrom(b);
@ -599,6 +599,18 @@ class MergeTest {
return k;
}
private Subject setSub(final String value, final String schema, final String classname) {
Subject s = new Subject();
s.setValue(value);
Qualifier q = new Qualifier();
q.setClassname(classname);
q.setClassid(classname);
q.setSchemename(schema);
q.setSchemeid(schema);
s.setQualifier(q);
return s;
}
/**
* Sets sp.
*