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

View File

@ -10,7 +10,7 @@ graphdb.repository=ariadneplus-ts01
graphdb.baseURI=https://ariadne-infrastructure.eu/ graphdb.baseURI=https://ariadne-infrastructure.eu/
elasticsearch.hostname=elastic-test.ariadne.d4science.org 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.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')] 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 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"] 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={\ 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": {\ "DigitalImage": {\
"class_type": "prototype",\ "class_type": "prototype",\
"mappings": {\ "mappings": {\
@ -356,20 +371,20 @@ class.map.specifications={\
"substring": "no",\ "substring": "no",\
"element_type": "java.lang.String"\ "element_type": "java.lang.String"\
},\ },\
"https://www.ariadne-infrastructure.eu/property/title": {\ "https://www.ariadne-infrastructure.eu/property/titleInfo": {\
"class_field": "Title",\ "class_field": "Title",\
"substring": "no",\ "substring": "no",\
"element_type": "java.lang.String"\ "external_reference": "TextLang"\
},\ },\
"https://www.ariadne-infrastructure.eu/property/accessRights": {\ "https://www.ariadne-infrastructure.eu/property/accessRights": {\
"class_field": "AccessRights",\ "class_field": "AccessRights",\
"substring": "no",\ "substring": "no",\
"element_type": "java.lang.String"\ "element_type": "java.lang.String"\
},\ },\
"https://www.ariadne-infrastructure.eu/property/description": {\ "https://www.ariadne-infrastructure.eu/property/descriptionInfo": {\
"class_field": "Description",\ "class_field": "Description",\
"substring": "no",\ "substring": "no",\
"element_type": "java.lang.String"\ "external_reference": "TextLang"\
},\ },\
"https://www.ariadne-infrastructure.eu/property/creator": {\ "https://www.ariadne-infrastructure.eu/property/creator": {\
"class_field": "Creator",\ "class_field": "Creator",\

View File

@ -91,8 +91,12 @@ CONSTRUCT {
?derivedSubject aoprop:id ?derivedSubject . ?derivedSubject aoprop:id ?derivedSubject .
?derivedSubject aoprop:label ?derivedSubjectPrefLabel . ?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
?derivedSubject aoprop:lang ?aatSubjectsLang . ?derivedSubject aoprop:lang ?aatSubjectsLang .
%record aoprop:title ?title . %record aoprop:titleInfo ?titleInfo .
%record aoprop:description ?description . ?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:language ?language .
} }
where { where {
@ -120,6 +124,10 @@ where {
optional { optional {
%record aocat:has_landing_page / rdfs:label ?landingPage . %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 { optional {

View File

@ -93,8 +93,12 @@ CONSTRUCT {
?derivedSubject aoprop:id ?derivedSubject . ?derivedSubject aoprop:id ?derivedSubject .
?derivedSubject aoprop:label ?derivedSubjectPrefLabel . ?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
?derivedSubject aoprop:lang ?aatSubjectsLang . ?derivedSubject aoprop:lang ?aatSubjectsLang .
%record aoprop:title ?title . %record aoprop:titleInfo ?titleInfo .
%record aoprop:description ?description . ?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:language ?language .
%record aoprop:image ?primaryVisualComponent . %record aoprop:image ?primaryVisualComponent .
?primaryVisualComponent aoprop:primaryVisualComponent ?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_unit / skos:prefLabel ?spatialPrecisionUnit .
?record aocat:has_spatial_precision / aocat:has_value ?spatialPrecisionValue . ?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 { optional {