added fields has_type and is_about
This commit is contained in:
parent
4882e38d64
commit
6c8c9fcba3
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.ariadneplus.elasticsearch;
|
||||
|
||||
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadnePlusEntry;
|
||||
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneResource;
|
||||
import eu.dnetlib.ariadneplus.elasticsearch.model.Spatial;
|
||||
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -64,6 +65,11 @@ public class BulkUpload {
|
|||
try {
|
||||
Object next = manager.next();
|
||||
AriadnePlusEntry ace = ((AriadnePlusEntry) next);
|
||||
AriadneResource uri = new AriadneResource();
|
||||
uri.setUri(ace.getTypeURI());
|
||||
uri.setLabel(ace.getTypeLabel());
|
||||
ace.setHas_type(uri);
|
||||
|
||||
if (isCollection) {
|
||||
ace.setResourceType("collection");
|
||||
if (ace.getSpatial()!=null) {
|
||||
|
|
|
@ -24,9 +24,9 @@ public class AriadnePlusEntry {
|
|||
private String originalId;
|
||||
private List<AgentInfo> owner;
|
||||
private List<AgentInfo> publisher;
|
||||
private AriadneURI is_about;
|
||||
private List<AriadneResource> is_about;
|
||||
private String resourceType;
|
||||
private AriadneURI has_type;
|
||||
private AriadneResource has_type;
|
||||
private List<AgentInfo> responsible;
|
||||
private List<Spatial> spatial;
|
||||
private List<Temporal> temporal;
|
||||
|
@ -36,6 +36,8 @@ public class AriadnePlusEntry {
|
|||
private DigitalImage digitalImage;
|
||||
|
||||
private transient String uniqueIsPartOf;
|
||||
private transient String typeURI;
|
||||
private transient String typeLabel;
|
||||
|
||||
public List<AgentInfo> getContributor() {
|
||||
return contributor;
|
||||
|
@ -212,11 +214,7 @@ public class AriadnePlusEntry {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void setIs_about(AriadneURI is_about) {
|
||||
this.is_about = is_about;
|
||||
}
|
||||
|
||||
public void setHas_type(AriadneURI has_type) {
|
||||
public void setHas_type(AriadneResource has_type) {
|
||||
this.has_type = has_type;
|
||||
}
|
||||
|
||||
|
@ -244,11 +242,7 @@ public class AriadnePlusEntry {
|
|||
return description;
|
||||
}
|
||||
|
||||
public AriadneURI getIs_about() {
|
||||
return is_about;
|
||||
}
|
||||
|
||||
public AriadneURI getHas_type() {
|
||||
public AriadneResource getHas_type() {
|
||||
return has_type;
|
||||
}
|
||||
|
||||
|
@ -284,6 +278,30 @@ public class AriadnePlusEntry {
|
|||
this.nativePeriod = nativePeriod;
|
||||
}
|
||||
|
||||
public String getTypeURI() {
|
||||
return typeURI;
|
||||
}
|
||||
|
||||
public void setTypeURI(String typeURI) {
|
||||
this.typeURI = typeURI;
|
||||
}
|
||||
|
||||
public String getTypeLabel() {
|
||||
return typeLabel;
|
||||
}
|
||||
|
||||
public void setTypeLabel(String typeLabel) {
|
||||
this.typeLabel = typeLabel;
|
||||
}
|
||||
|
||||
public List<AriadneResource> getIs_about() {
|
||||
return is_about;
|
||||
}
|
||||
|
||||
public void setIs_about(List<AriadneResource> is_about) {
|
||||
this.is_about = is_about;
|
||||
}
|
||||
|
||||
public String toJson(){
|
||||
return new Gson().toJson(this);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.dnetlib.ariadneplus.elasticsearch.model;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class AriadneURI {
|
||||
public class AriadneResource {
|
||||
private String label;
|
||||
private String uri;
|
||||
|
||||
|
@ -22,10 +22,10 @@ public class AriadneURI {
|
|||
this.uri = uri;
|
||||
}
|
||||
|
||||
public AriadneURI() {
|
||||
public AriadneResource() {
|
||||
}
|
||||
|
||||
public static AriadneURI fromJson(String json){
|
||||
return new Gson().fromJson(json, AriadneURI.class);
|
||||
public static AriadneResource fromJson(String json){
|
||||
return new Gson().fromJson(json, AriadneResource.class);
|
||||
}
|
||||
}
|
|
@ -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={\
|
||||
"AriadneResource": {\
|
||||
"class_type": "prototype",\
|
||||
"mappings": {\
|
||||
"https://www.ariadne-infrastructure.eu/property/aboutURILabel": {\
|
||||
"class_field": "Label",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/aboutURI": {\
|
||||
"class_field": "Uri",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
}\
|
||||
}\
|
||||
},\
|
||||
"AriadneGeoPoint": {\
|
||||
"class_type": "prototype",\
|
||||
"mappings": {\
|
||||
|
@ -226,6 +241,16 @@ class.map.specifications={\
|
|||
"AriadnePlusEntry": {\
|
||||
"class_type": "unique",\
|
||||
"mappings": {\
|
||||
"https://www.ariadne-infrastructure.eu/property/typeURI": {\
|
||||
"class_field": "TypeURI",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/typeLabel": {\
|
||||
"class_field": "TypeLabel",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/accessPolicy": {\
|
||||
"class_field": "AccessPolicy",\
|
||||
"substring": "no",\
|
||||
|
@ -365,7 +390,13 @@ class.map.specifications={\
|
|||
"class_field": "UniqueIsPartOf",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/about": {\
|
||||
"class_field": "Is_about",\
|
||||
"substring": "no",\
|
||||
"external_reference": "AriadneResource"\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,11 @@ CONSTRUCT {
|
|||
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||
%record aoprop:resourceType ?resourceType .
|
||||
%record aoprop:typeURI ?typeURI .
|
||||
%record aoprop:typeLabel ?typeLabel .
|
||||
%record aoprop:about ?aboutURI .
|
||||
?aboutURI aoprop:aboutURI ?aboutURI .
|
||||
?aboutURI aoprop:aboutURILabel ?aboutLabel .
|
||||
%record aoprop:nativeSubject ?nativeSubject .
|
||||
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
||||
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
||||
|
@ -96,6 +101,12 @@ where {
|
|||
?creator aocat:has_name ?creatorName .
|
||||
%record aocat:has_title ?title .
|
||||
%record aocat:has_type / skos:prefLabel ?resourceType .
|
||||
%record aocat:has_type ?typeURI .
|
||||
?typeURI skos:prefLabel ?typeLabel .
|
||||
optional {
|
||||
%record aocat:is_about ?aboutURI .
|
||||
?aboutURI rdfs:label ?aboutLabel .
|
||||
}
|
||||
optional {
|
||||
%record aocat:has_native_subject ?nativeSubject .
|
||||
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
|
||||
|
|
|
@ -75,6 +75,11 @@ CONSTRUCT {
|
|||
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||
%record aoprop:resourceType ?resourceType .
|
||||
%record aoprop:typeURI ?typeURI .
|
||||
%record aoprop:typeLabel ?typeLabel .
|
||||
%record aoprop:about ?aboutURI .
|
||||
?aboutURI aoprop:aboutURI ?aboutURI .
|
||||
?aboutURI aoprop:aboutURILabel ?aboutLabel .
|
||||
%record aoprop:nativeSubject ?nativeSubject .
|
||||
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
||||
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
||||
|
@ -97,7 +102,13 @@ where {
|
|||
%record aocat:has_creator ?creator .
|
||||
?creator aocat:has_name ?creatorName .
|
||||
%record aocat:has_title ?title .
|
||||
%record aocat:has_type / skos:prefLabel ?resourceType .
|
||||
%record aocat:has_type / skos:prefLabel ?resourceType .
|
||||
%record aocat:has_type ?typeURI .
|
||||
?typeURI skos:prefLabel ?typeLabel .
|
||||
optional {
|
||||
%record aocat:is_about ?aboutURI .
|
||||
?aboutURI rdfs:label ?aboutLabel .
|
||||
}
|
||||
optional {
|
||||
?creator aocat:has_email ?creatorEmail .
|
||||
}
|
||||
|
|
|
@ -241,6 +241,16 @@ public class GraphDbReaderAndESIndexTest {
|
|||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Ignore
|
||||
public void uploadADSIsAboutTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/DCDF395A-2CC8-3FC2-B9A5-5A924090DF10";
|
||||
String datasource = "ads";
|
||||
String collectionId = "3";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception {
|
||||
final ClassPathResource resource = new ClassPathResource("application.properties");
|
||||
Properties appProps = new Properties();
|
||||
|
|
Loading…
Reference in New Issue