matching periodo name (if any) overwrites native period name
This commit is contained in:
parent
2d01f321d1
commit
84993ffaba
|
@ -102,6 +102,14 @@ public class BulkUpload {
|
|||
}
|
||||
}
|
||||
|
||||
if (ace.getTemporal()!=null) {
|
||||
ace.getTemporal().stream()
|
||||
.filter(t->t.getMatchingPeriodOName()!=null)
|
||||
.forEach(t->{
|
||||
t.setPeriodName(t.getMatchingPeriodOName());
|
||||
});
|
||||
}
|
||||
|
||||
if (!isCollection) {
|
||||
String uniqueIsPartOf = ace.getUniqueIsPartOf();
|
||||
if (uniqueIsPartOf != null) {
|
||||
|
|
|
@ -10,6 +10,7 @@ public class AriadneTemporal {
|
|||
private String periodName;
|
||||
private String until;
|
||||
private String uri;
|
||||
private transient String matchingPeriodOName;
|
||||
|
||||
public static AriadneTemporal fromRDFJson(JsonElement json) {
|
||||
AriadneTemporal at = new AriadneTemporal();
|
||||
|
@ -72,4 +73,12 @@ public class AriadneTemporal {
|
|||
public static AriadneTemporal fromJson(String json){
|
||||
return new Gson().fromJson(json, AriadneTemporal.class);
|
||||
}
|
||||
|
||||
public String getMatchingPeriodOName() {
|
||||
return matchingPeriodOName;
|
||||
}
|
||||
|
||||
public void setMatchingPeriodOName(String matchingPeriodOName) {
|
||||
this.matchingPeriodOName = matchingPeriodOName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ server.port=8281
|
|||
|
||||
graphdb.serverUrl=http://graphdb-test.ariadne.d4science.org:7200
|
||||
graphdb.writer.user=writer
|
||||
graphdb.writer.pwd=*****
|
||||
graphdb.writer.pwd=pwd
|
||||
graphdb.repository=ariadneplus-ts01
|
||||
graphdb.baseURI=https://ariadne-infrastructure.eu/
|
||||
|
||||
|
@ -26,11 +26,16 @@ class.map.specifications={\
|
|||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/periodName": {\
|
||||
"https://www.ariadne-infrastructure.eu/property/nativePeriodName": {\
|
||||
"class_field": "PeriodName",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/periodOName": {\
|
||||
"class_field": "MatchingPeriodOName",\
|
||||
"substring": "no",\
|
||||
"element_type": "java.lang.String"\
|
||||
},\
|
||||
"https://www.ariadne-infrastructure.eu/property/until": {\
|
||||
"class_field": "Until",\
|
||||
"substring": "no",\
|
||||
|
|
|
@ -42,11 +42,13 @@ CONSTRUCT {
|
|||
?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon .
|
||||
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
|
||||
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
|
||||
%record aoprop:uri ?temporal .
|
||||
?temporal aoprop:periodOName ?temporalPeriodName .
|
||||
?temporal aoprop:from ?temporalFrom .
|
||||
?temporal aoprop:until ?temporalUntil .
|
||||
?temporal aoprop:uri ?temporal .
|
||||
%record aoprop:uri ?temporalNative .
|
||||
?temporalNative aoprop:periodName ?temporalNativePeriodName .
|
||||
?temporalNative aoprop:from ?temporalFrom .
|
||||
?temporalNative aoprop:until ?temporalUntil .
|
||||
?temporalNative aoprop:uri ?temporalPeriodO .
|
||||
?temporalNative aoprop:nativePeriodName ?temporalNativePeriodName .
|
||||
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||
%record aoprop:resourceType ?resourceType .
|
||||
|
|
|
@ -43,12 +43,12 @@ CONSTRUCT {
|
|||
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
|
||||
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
|
||||
%record aoprop:uri ?temporal .
|
||||
?temporal aoprop:periodName ?temporalPeriodName .
|
||||
?temporal aoprop:periodOName ?temporalPeriodName .
|
||||
?temporal aoprop:from ?temporalFrom .
|
||||
?temporal aoprop:until ?temporalUntil .
|
||||
?temporal aoprop:uri ?temporal .
|
||||
%record aoprop:uri ?temporalNative .
|
||||
?temporalNative aoprop:periodName ?temporalNativePeriodName .
|
||||
?temporalNative aoprop:nativePeriodName ?temporalNativePeriodName .
|
||||
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||
%record aoprop:resourceType ?resourceType .
|
||||
|
|
|
@ -8,6 +8,11 @@ import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
|||
import eu.dnetlib.ariadneplus.reader.RunSPARQLQueryService;
|
||||
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.rdf4j.model.Resource;
|
||||
import org.eclipse.rdf4j.repository.Repository;
|
||||
import org.eclipse.rdf4j.repository.RepositoryConnection;
|
||||
import org.eclipse.rdf4j.repository.RepositoryResult;
|
||||
import org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
@ -27,15 +32,35 @@ public class GraphDbReaderAndESIndexTest {
|
|||
private RunSPARQLQueryService runSPQRLQuery;
|
||||
|
||||
@Test
|
||||
public void ads1093RecordTest() throws Exception {
|
||||
boolean testRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/1B23A61E-E4DE-3647-8006-0284C729AF85";
|
||||
String datasource = "ads";
|
||||
String collectionId = "1093";
|
||||
readAndIndexTest(testRecord, recordId, datasource, collectionId);
|
||||
@Ignore
|
||||
public void uploadAMCRFieldworkTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/AMCR/E61E0F4E-268F-39E4-8EDB-A431AFC505AA";
|
||||
String datasource = "amcr";
|
||||
String collectionId = "oai";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
private void readAndIndexTest(boolean testRecord, String recordId, String datasource, String collectionId) throws Exception {
|
||||
@Test
|
||||
public void uploadAMCRDocumentTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/AMCR/FC59581D-DC3A-31DA-922A-98DE764F3D76";
|
||||
String datasource = "amcr";
|
||||
String collectionId = "oai";
|
||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void uploadADSRecordTest() throws Exception {
|
||||
boolean isRecord = true;
|
||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/34E3811A-0BAD-3832-B3A0-3139E8A0285C";
|
||||
String datasource = "ads";
|
||||
String collectionId = "271";
|
||||
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();
|
||||
appProps.load(resource.getInputStream());
|
||||
|
@ -62,7 +87,7 @@ public class GraphDbReaderAndESIndexTest {
|
|||
bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname"));
|
||||
runSPQRLQuery.setBulkUpload(bulkUpload);
|
||||
final ClassPathResource queryTemplateResource;
|
||||
if (testRecord) {
|
||||
if (isRecord) {
|
||||
queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||
}
|
||||
else {
|
||||
|
@ -70,7 +95,7 @@ public class GraphDbReaderAndESIndexTest {
|
|||
}
|
||||
List<String> recordIds = Arrays.asList(recordId);
|
||||
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||
if (testRecord) {
|
||||
if (isRecord) {
|
||||
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, false);
|
||||
}
|
||||
else {
|
||||
|
@ -103,4 +128,25 @@ public class GraphDbReaderAndESIndexTest {
|
|||
System.out.println(queryTemplate);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void httpsRequestTest() throws Exception {
|
||||
// RemoteRepositoryManager manager = new RemoteRepositoryManager("http://graphdb-test.ariadne.d4science.org:7200");
|
||||
RemoteRepositoryManager manager = new RemoteRepositoryManager("https://graphdb-test.ariadne.d4science.org");
|
||||
manager.init();
|
||||
manager.setUsernameAndPassword("writer", "******");
|
||||
Repository repository = manager.getRepository("ariadneplus-ts01");
|
||||
RepositoryConnection connection = repository.getConnection();
|
||||
RepositoryResult<Resource> contexts = connection.getContextIDs();
|
||||
if (contexts!=null) {
|
||||
System.out.println("##### Primo context "+contexts.next().stringValue());
|
||||
}
|
||||
else {
|
||||
System.out.println("No contexts ");
|
||||
}
|
||||
connection.close();
|
||||
repository.shutDown();
|
||||
manager.shutDown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue