handling for title as elastic search object with text and language fields, same handling for description

This commit is contained in:
Enrico Ottonello 2021-10-07 11:55:57 +02:00
parent 0693645c68
commit 0f7e7de918
5 changed files with 62 additions and 37 deletions

View File

@ -12,7 +12,7 @@ public class AriadnePlusEntry {
private List<AriadneSubject> ariadneSubject;
private List<AgentInfo> contributor;
private List<AgentInfo> creator;
private Description description;
private List<TextLang> description;
private String extent;
private String identifier;
private List<String> isPartOf;
@ -30,7 +30,7 @@ public class AriadnePlusEntry {
private List<AgentInfo> responsible;
private List<Spatial> spatial;
private List<Temporal> temporal;
private String title;
private List<TextLang> title;
private List<NativePeriod> nativePeriod;
private String wasCreated;
private List<DigitalImage> digitalImage;
@ -87,14 +87,6 @@ public class AriadnePlusEntry {
this.publisher = publisher;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getExtent() {
return extent;
}
@ -210,10 +202,6 @@ public class AriadnePlusEntry {
this.temporal = temporal;
}
public void setDescription(Description description) {
this.description = description;
}
public void setHas_type(AriadneResource has_type) {
this.has_type = has_type;
}
@ -238,10 +226,6 @@ public class AriadnePlusEntry {
return new Gson().fromJson(json, AriadnePlusEntry.class);
}
public Description getDescription() {
return description;
}
public AriadneResource getHas_type() {
return has_type;
}
@ -302,13 +286,23 @@ public class AriadnePlusEntry {
this.digitalImage = digitalImage;
}
public List<TextLang> getDescription() {
return description;
}
public void setDescription(List<TextLang> description) {
this.description = description;
}
public List<TextLang> getTitle() {
return title;
}
public void setTitle(List<TextLang> title) {
this.title = title;
}
public String toJson(){
return new Gson().toJson(this);
}
public void setDescription(String description) {
Description descr = new Description();
descr.setText(description);
this.description = descr;
}
}

View File

@ -2,7 +2,7 @@ package eu.dnetlib.ariadneplus.elasticsearch.model;
import com.google.gson.Gson;
public class Description {
public class TextLang {
private String text;
private String language;
@ -22,10 +22,10 @@ public class Description {
this.language = language;
}
public Description() {
public TextLang() {
}
public static Description fromJson(String json){
return new Gson().fromJson(json, Description.class);
public static TextLang fromJson(String json){
return new Gson().fromJson(json, TextLang.class);
}
}

View File

@ -10,7 +10,7 @@ graphdb.repository=ariadneplus-ts01
graphdb.baseURI=https://ariadne-infrastructure.eu/
elasticsearch.hostname=elastic-test.ariadne.d4science.org
elasticsearch.indexname=ariadneplus
elasticsearch.indexname=ariadneplus_test
catalog.entry.path=$[*][?(@['https://www.ariadne-infrastructure.eu/property/rdfType'][0]['value']=='Record')]
catalog.entry.collection.path=$[*][?(@['https://www.ariadne-infrastructure.eu/property/rdfType'][0]['value']=='Collection')]
@ -18,6 +18,21 @@ general.classpath=eu.dnetlib.ariadneplus.elasticsearch.model.
type.path=https://www.ariadne-infrastructure.eu/property/rdfType
exclude.predicates=["https://www.ariadne-infrastructure.eu/property/resourceType", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "https://www.ariadne-infrastructure.eu/property/rdfType"]
class.map.specifications={\
"TextLang": {\
"class_type": "prototype",\
"mappings": {\
"https://www.ariadne-infrastructure.eu/property/text": {\
"class_field": "Text",\
"substring": "no",\
"element_type": "java.lang.String"\
},\
"https://www.ariadne-infrastructure.eu/property/lang": {\
"class_field": "Language",\
"substring": "yes",\
"element_type": "java.lang.String"\
}\
}\
},\
"DigitalImage": {\
"class_type": "prototype",\
"mappings": {\
@ -356,20 +371,20 @@ class.map.specifications={\
"substring": "no",\
"element_type": "java.lang.String"\
},\
"https://www.ariadne-infrastructure.eu/property/title": {\
"https://www.ariadne-infrastructure.eu/property/titleInfo": {\
"class_field": "Title",\
"substring": "no",\
"element_type": "java.lang.String"\
"external_reference": "TextLang"\
},\
"https://www.ariadne-infrastructure.eu/property/accessRights": {\
"class_field": "AccessRights",\
"substring": "no",\
"element_type": "java.lang.String"\
},\
"https://www.ariadne-infrastructure.eu/property/description": {\
"https://www.ariadne-infrastructure.eu/property/descriptionInfo": {\
"class_field": "Description",\
"substring": "no",\
"element_type": "java.lang.String"\
"external_reference": "TextLang"\
},\
"https://www.ariadne-infrastructure.eu/property/creator": {\
"class_field": "Creator",\

View File

@ -91,8 +91,12 @@ CONSTRUCT {
?derivedSubject aoprop:id ?derivedSubject .
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
?derivedSubject aoprop:lang ?aatSubjectsLang .
%record aoprop:title ?title .
%record aoprop:description ?description .
%record aoprop:titleInfo ?titleInfo .
?titleInfo aoprop:text ?title .
?titleInfo aoprop:lang ?titleLang .
%record aoprop:descriptionInfo ?descriptionInfo .
?descriptionInfo aoprop:text ?description .
?descriptionInfo aoprop:lang ?descriptionLang .
%record aoprop:language ?language .
}
where {
@ -120,6 +124,10 @@ where {
optional {
%record aocat:has_landing_page / rdfs:label ?landingPage .
}
BIND (IRI(concat( "https://ariadne-infrastructure.eu/TextLang/",SHA1(STR(?description)))) as ?descriptionInfo)
BIND (LANG(?description) as ?descriptionLang)
BIND (IRI(concat( "https://ariadne-infrastructure.eu/TextLang/",SHA1(STR(?title)))) as ?titleInfo)
BIND (LANG(?title) as ?titleLang)
}
optional {

View File

@ -93,8 +93,12 @@ CONSTRUCT {
?derivedSubject aoprop:id ?derivedSubject .
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
?derivedSubject aoprop:lang ?aatSubjectsLang .
%record aoprop:title ?title .
%record aoprop:description ?description .
%record aoprop:titleInfo ?titleInfo .
?titleInfo aoprop:text ?title .
?titleInfo aoprop:lang ?titleLang .
%record aoprop:descriptionInfo ?descriptionInfo .
?descriptionInfo aoprop:text ?description .
?descriptionInfo aoprop:lang ?descriptionLang .
%record aoprop:language ?language .
%record aoprop:image ?primaryVisualComponent .
?primaryVisualComponent aoprop:primaryVisualComponent ?primaryVisualComponent .
@ -134,6 +138,10 @@ where {
?record aocat:has_spatial_precision / aocat:has_unit / skos:prefLabel ?spatialPrecisionUnit .
?record aocat:has_spatial_precision / aocat:has_value ?spatialPrecisionValue .
}
BIND (IRI(concat( "https://ariadne-infrastructure.eu/TextLang/",SHA1(STR(?description)))) as ?descriptionInfo)
BIND (LANG(?description) as ?descriptionLang)
BIND (IRI(concat( "https://ariadne-infrastructure.eu/TextLang/",SHA1(STR(?title)))) as ?titleInfo)
BIND (LANG(?title) as ?titleLang)
}
optional {