Merge branch 'master' of https://code-repo.d4science.org/D-Net/AriadnePlus
This commit is contained in:
commit
74d0f440e3
|
@ -1,10 +1,10 @@
|
||||||
package eu.dnetlib.ariadneplus.elasticsearch;
|
package eu.dnetlib.ariadneplus.elasticsearch;
|
||||||
|
|
||||||
import java.io.IOException;
|
import eu.dnetlib.ariadneplus.elasticsearch.model.AgentInfo;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneCatalogEntry;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
||||||
import javax.annotation.PostConstruct;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.elasticsearch.action.bulk.BulkRequest;
|
import org.elasticsearch.action.bulk.BulkRequest;
|
||||||
import org.elasticsearch.action.bulk.BulkResponse;
|
import org.elasticsearch.action.bulk.BulkResponse;
|
||||||
|
@ -16,34 +16,59 @@ import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import eu.dnetlib.ariadneplus.elasticsearch.model.AriadneCatalogEntry;
|
import javax.annotation.PostConstruct;
|
||||||
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class BulkUpload {
|
public class BulkUpload {
|
||||||
|
|
||||||
@Value("${elasticsearch.url:localhost:9200}")
|
private static final Log log = LogFactory.getLog(BulkUpload.class);
|
||||||
private String elasticsearchUrl;
|
|
||||||
|
@Value("${elasticsearch.hostname}")
|
||||||
|
private String elasticSearchHostName;
|
||||||
|
|
||||||
|
@Value("${elasticsearch.indexname}")
|
||||||
|
private String elasticSearchIndexName;
|
||||||
|
|
||||||
private RestHighLevelClient client;
|
private RestHighLevelClient client;
|
||||||
|
|
||||||
@PostConstruct
|
public void init(String elasticSearchHostName, String elasticSearchIndexName) throws IOException {
|
||||||
private void init() throws IOException {
|
this.elasticSearchIndexName = elasticSearchIndexName;
|
||||||
client = new RestHighLevelClient(
|
client = new RestHighLevelClient(
|
||||||
RestClient.builder(
|
RestClient.builder(
|
||||||
new HttpHost("localhost",9200,"http")));
|
new HttpHost(elasticSearchHostName,9200,"http")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() throws IOException {
|
||||||
|
client = new RestHighLevelClient(
|
||||||
|
RestClient.builder(
|
||||||
|
new HttpHost(elasticSearchHostName,9200,"http")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void index(ResourceManager manager) {
|
public void index(ResourceManager manager) {
|
||||||
BulkRequest request = new BulkRequest();
|
BulkRequest request = new BulkRequest();
|
||||||
while (manager.hasNext()){
|
while (manager.hasNext()){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AriadneCatalogEntry ace = ((AriadneCatalogEntry) manager.next());
|
Object next = manager.next();
|
||||||
request.add(new IndexRequest("prova_via_code").id(ace.getOriginalId())
|
AriadneCatalogEntry ace = ((AriadneCatalogEntry) next);
|
||||||
|
AgentInfo testPublisher = new AgentInfo();
|
||||||
|
testPublisher.setName("TEST");
|
||||||
|
ace.getPublisher().add(testPublisher);
|
||||||
|
String[] splits = ace.getIdentifier().split("/");
|
||||||
|
request.add(new IndexRequest(elasticSearchIndexName).id(splits[splits.length-1])
|
||||||
.source(ace.toJson(),XContentType.JSON));
|
.source(ace.toJson(),XContentType.JSON));
|
||||||
System.out.println("indexing to ES record "+ace.getOriginalId());
|
log.debug("Indexing to ES: "+ace.toJson());
|
||||||
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
|
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
|
||||||
|
log.info("Indexing to ES completed with status: "+bulkResponse.status());
|
||||||
|
if (bulkResponse.hasFailures()) {
|
||||||
|
log.error("FailureMessage: "+bulkResponse.buildFailureMessage());
|
||||||
|
}
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
|
|
@ -55,16 +55,16 @@ public class AgentInfo {
|
||||||
AgentInfo pi = new AgentInfo();
|
AgentInfo pi = new AgentInfo();
|
||||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
||||||
switch (entry.getKey()){
|
switch (entry.getKey()){
|
||||||
case "http://www.myprefix/name" :
|
case "https://www.ariadne-infrastructure.eu/property/name" :
|
||||||
pi.setName(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setName(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/type":
|
case "https://www.ariadne-infrastructure.eu/property/type":
|
||||||
pi.setType(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setType(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/email":
|
case "https://www.ariadne-infrastructure.eu/property/email":
|
||||||
pi.setEmail(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setEmail(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/phone":
|
case "https://www.ariadne-infrastructure.eu/property/phone":
|
||||||
pi.setPhone(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setPhone(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package eu.dnetlib.ariadneplus.elasticsearch.model;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ArchaeologicalResourceType {
|
||||||
|
private long id = 100000;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public ArchaeologicalResourceType() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static ArchaeologicalResourceType fromRDFJson(JsonElement json) {
|
||||||
|
// ArchaeologicalResourceType art = new ArchaeologicalResourceType();
|
||||||
|
// for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
||||||
|
// switch (entry.getKey()){
|
||||||
|
// case "https://www.ariadne-infrastructure.eu/property/id" :
|
||||||
|
// art.setId(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
|
// break;
|
||||||
|
// case "https://www.ariadne-infrastructure.eu/property/name":
|
||||||
|
// String tmp = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString();
|
||||||
|
// art.setName(tmp);
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return art;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArchaeologicalResourceType fromJson(String json){
|
||||||
|
return new Gson().fromJson(json, ArchaeologicalResourceType.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,52 +0,0 @@
|
||||||
package eu.dnetlib.ariadneplus.elasticsearch.model;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ArcheologicalResourceType {
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public ArcheologicalResourceType() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArcheologicalResourceType fromRDFJson(JsonElement json) {
|
|
||||||
ArcheologicalResourceType art = new ArcheologicalResourceType();
|
|
||||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
|
||||||
switch (entry.getKey()){
|
|
||||||
case "http://www.myprefix/id" :
|
|
||||||
art.setId(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/name":
|
|
||||||
String tmp = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString();
|
|
||||||
art.setName(tmp);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return art;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArcheologicalResourceType fromJson(String json){
|
|
||||||
return new Gson().fromJson(json, ArcheologicalResourceType.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +1,15 @@
|
||||||
package eu.dnetlib.ariadneplus.elasticsearch.model;
|
package eu.dnetlib.ariadneplus.elasticsearch.model;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import java.util.List;
|
import eu.dnetlib.ariadneplus.reader.utils.ESUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AriadneCatalogEntry {
|
public class AriadneCatalogEntry {
|
||||||
private List<AatSubject> aatSubjects;
|
private List<AatSubject> aatSubjects;
|
||||||
private String accessPolicy;
|
private String accessPolicy;
|
||||||
private String accessRights;
|
private String accessRights;
|
||||||
private ArcheologicalResourceType archeologicalResourceType;
|
private ArchaeologicalResourceType archaeologicalResourceType;
|
||||||
private String contactPoint;
|
private String contactPoint;
|
||||||
private List<AgentInfo> contributor;
|
private List<AgentInfo> contributor;
|
||||||
private List<AgentInfo> creator;
|
private List<AgentInfo> creator;
|
||||||
|
@ -21,7 +22,7 @@ public class AriadneCatalogEntry {
|
||||||
private List<ItemMetadataStructure> hasItemMetadataStructure;
|
private List<ItemMetadataStructure> hasItemMetadataStructure;
|
||||||
private List<MetadataRecord> hasMetadataRecord;
|
private List<MetadataRecord> hasMetadataRecord;
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String partOf;
|
private String isPartOf;
|
||||||
private String issued;
|
private String issued;
|
||||||
private List<String> keyword;
|
private List<String> keyword;
|
||||||
private String landingPage;
|
private String landingPage;
|
||||||
|
@ -40,6 +41,8 @@ public class AriadneCatalogEntry {
|
||||||
private String rights;
|
private String rights;
|
||||||
private List<AgentInfo> scientificResponsible;
|
private List<AgentInfo> scientificResponsible;
|
||||||
private List<Spatial> spatial;
|
private List<Spatial> spatial;
|
||||||
|
// private List<SpatialRegion> spatialRegion;
|
||||||
|
// private List<SpatialRegionPoint> spatialRegionPoint;
|
||||||
private List<AgentInfo> technicalResponsible;
|
private List<AgentInfo> technicalResponsible;
|
||||||
private List<AriadneTemporal> temporal;
|
private List<AriadneTemporal> temporal;
|
||||||
|
|
||||||
|
@ -77,12 +80,12 @@ public class AriadneCatalogEntry {
|
||||||
this.accessRights = accessRights;
|
this.accessRights = accessRights;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArcheologicalResourceType getArcheologicalResourceType() {
|
public ArchaeologicalResourceType getArchaeologicalResourceType() {
|
||||||
return archeologicalResourceType;
|
return archaeologicalResourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArcheologicalResourceType(ArcheologicalResourceType archeologicalResourceType) {
|
public void setArchaeologicalResourceType(ArchaeologicalResourceType archaeologicalResourceType) {
|
||||||
this.archeologicalResourceType = archeologicalResourceType;
|
this.archaeologicalResourceType = archaeologicalResourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContactPoint() {
|
public String getContactPoint() {
|
||||||
|
@ -173,12 +176,12 @@ public class AriadneCatalogEntry {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPartOf() {
|
public String getIsPartOf() {
|
||||||
return partOf;
|
return isPartOf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPartOf(String partOf) {
|
public void setIsPartOf(String isPartOf) {
|
||||||
this.partOf = partOf;
|
this.isPartOf = isPartOf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIssued() {
|
public String getIssued() {
|
||||||
|
@ -186,7 +189,7 @@ public class AriadneCatalogEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIssued(String issued) {
|
public void setIssued(String issued) {
|
||||||
this.issued = issued;
|
this.issued = ESUtils.getESFormatDate(issued);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getKeyword() {
|
public List<String> getKeyword() {
|
||||||
|
@ -226,7 +229,7 @@ public class AriadneCatalogEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModified(String modified) {
|
public void setModified(String modified) {
|
||||||
this.modified = modified;
|
this.modified = ESUtils.getESFormatDate(modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<NativeSubject> getNativeSubject() {
|
public List<NativeSubject> getNativeSubject() {
|
||||||
|
@ -322,7 +325,12 @@ public class AriadneCatalogEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(List<Spatial> spatial) {
|
public void setSpatial(List<Spatial> spatial) {
|
||||||
this.spatial = spatial;
|
if (this.spatial==null) {
|
||||||
|
this.spatial = spatial;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.spatial.addAll(spatial);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AgentInfo> getTechnicalResponsible() {
|
public List<AgentInfo> getTechnicalResponsible() {
|
||||||
|
@ -350,104 +358,4 @@ public class AriadneCatalogEntry {
|
||||||
public String toJson(){
|
public String toJson(){
|
||||||
return new Gson().toJson(this);
|
return new Gson().toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static AriadneCatalogEntry fromRDFJson(JsonElement json, String identifier, Map<String, JsonElement> map){
|
|
||||||
// AriadneCatalogEntry acim = new AriadneCatalogEntry();
|
|
||||||
// acim.setIdentifier(identifier.substring(identifier.lastIndexOf("/") + 1));
|
|
||||||
// JsonObject content = json.getAsJsonObject();
|
|
||||||
// for (Map.Entry<String, JsonElement> stringJsonElementEntry : content.entrySet()) {
|
|
||||||
// switch (stringJsonElementEntry.getKey()){
|
|
||||||
// case "http://www.myprefix/accessPolicy":
|
|
||||||
// acim.setAccessPolicy(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/accessRights":
|
|
||||||
// acim.setAccessRights(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/contributor":
|
|
||||||
// JsonArray contributor_array = stringJsonElementEntry.getValue().getAsJsonArray();
|
|
||||||
// List<AgentInfo> contributor_list = new ArrayList();
|
|
||||||
// for (int i = 0; i < contributor_array.size() ; i++ ){
|
|
||||||
// String map_key = contributor_array.get(i).getAsJsonObject().get("value").getAsString();
|
|
||||||
// contributor_list.add(AgentInfo.fromRDFJson(map.get(map_key)));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// acim.setContributor(contributor_list);
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/description":
|
|
||||||
// acim.setDescription(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/isPartOf":
|
|
||||||
// acim.setPartOf(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/issued":
|
|
||||||
// acim.setIssued(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/landingPage":
|
|
||||||
// acim.setLandingPage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/language":
|
|
||||||
// acim.setLanguage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/modified":
|
|
||||||
// acim.setModified(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/nativeSubject":
|
|
||||||
// JsonArray nativeSubject_array = stringJsonElementEntry.getValue().getAsJsonArray();
|
|
||||||
// List<NativeSubject> nativeSubject_list = new ArrayList();
|
|
||||||
// for (int i = 0; i < nativeSubject_array.size() ; i++ ){
|
|
||||||
// String map_key = nativeSubject_array.get(i).getAsJsonObject().get("value").getAsString();
|
|
||||||
// nativeSubject_list.add(NativeSubject.fromRDFJson(map.get(map_key)));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// acim.setNativeSubject(nativeSubject_list);
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/originalId":
|
|
||||||
// acim.setOriginalId(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/resourceType":
|
|
||||||
// acim.setResourceType(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/spatial":
|
|
||||||
// JsonArray spatial_array = stringJsonElementEntry.getValue().getAsJsonArray();
|
|
||||||
// List<Spatial> spatial_list = new ArrayList();
|
|
||||||
// for (int i = 0; i < spatial_array.size() ; i++ ){
|
|
||||||
// String map_key = spatial_array.get(i).getAsJsonObject().get("value").getAsString();
|
|
||||||
// spatial_list.add(Spatial.fromRDFJson(map.get(map_key), map));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// acim.setSpatial(spatial_list);
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/temporal":
|
|
||||||
// JsonArray temporal_array = stringJsonElementEntry.getValue().getAsJsonArray();
|
|
||||||
// List<AriadneTemporal> temporal_list = new ArrayList<>();
|
|
||||||
// for(int i=0; i < temporal_array.size(); i++){
|
|
||||||
// String map_key = temporal_array.get(i).getAsJsonObject().get("value").getAsString();
|
|
||||||
// temporal_list.add(AriadneTemporal.fromRDFJson(map.get(map_key)));
|
|
||||||
// }
|
|
||||||
// acim.setTemporal(temporal_list);
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/title":
|
|
||||||
// acim.setTitle(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/publisher":
|
|
||||||
// JsonArray publisher_array = stringJsonElementEntry.getValue().getAsJsonArray();
|
|
||||||
// List<AgentInfo> publisher_list = new ArrayList();
|
|
||||||
// for (int i = 0; i < publisher_array.size() ; i++ ){
|
|
||||||
// String map_key = publisher_array.get(i).getAsJsonObject().get("value").getAsString();
|
|
||||||
// publisher_list.add(AgentInfo.fromRDFJson(map.get(map_key)));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// acim.setPublisher(publisher_list);
|
|
||||||
// break;
|
|
||||||
// case "http://www.myprefix/archeologicalResourceType":
|
|
||||||
// acim.setArcheologicalResourceType(ArcheologicalResourceType.fromRDFJson(map.get(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString())));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// System.out.println(acim.toJson());
|
|
||||||
// return acim;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
//https://ariadne-infrastructure.eu/aocat
|
|
|
@ -36,10 +36,10 @@ public class AriadneGeoPoint {
|
||||||
AriadneGeoPoint agp = new AriadneGeoPoint();
|
AriadneGeoPoint agp = new AriadneGeoPoint();
|
||||||
for (Map.Entry<String, JsonElement> stringJsonElementEntry : json.getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> stringJsonElementEntry : json.getAsJsonObject().entrySet()) {
|
||||||
switch (stringJsonElementEntry.getKey()){
|
switch (stringJsonElementEntry.getKey()){
|
||||||
case "http://www.myprefix/lat":
|
case "https://www.ariadne-infrastructure.eu/property/lat":
|
||||||
agp.setLat(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
agp.setLat(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/lon":
|
case "https://www.ariadne-infrastructure.eu/property/lon":
|
||||||
agp.setLon(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
agp.setLon(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,16 @@ public class AriadneTemporal {
|
||||||
AriadneTemporal at = new AriadneTemporal();
|
AriadneTemporal at = new AriadneTemporal();
|
||||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
||||||
switch (entry.getKey()){
|
switch (entry.getKey()){
|
||||||
case "http://www.myprefix/from" :
|
case "https://www.ariadne-infrastructure.eu/property/from" :
|
||||||
at.setFrom(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
at.setFrom(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/periodName":
|
case "https://www.ariadne-infrastructure.eu/property/periodName":
|
||||||
at.setPeriodName(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
at.setPeriodName(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/until":
|
case "https://www.ariadne-infrastructure.eu/property/until":
|
||||||
at.setUntil(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
at.setUntil(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/uri":
|
case "https://www.ariadne-infrastructure.eu/property/uri":
|
||||||
at.setUri(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
at.setUri(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@ public class NativeSubject {
|
||||||
NativeSubject pi = new NativeSubject();
|
NativeSubject pi = new NativeSubject();
|
||||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
||||||
switch (entry.getKey()){
|
switch (entry.getKey()){
|
||||||
case "http://www.myprefix/prefLabel" :
|
case "https://www.ariadne-infrastructure.eu/property/prefLabel" :
|
||||||
pi.setPrefLabel(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setPrefLabel(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
case "http://www.myprefix/rdfAbout":
|
case "https://www.ariadne-infrastructure.eu/property/rdfAbout":
|
||||||
pi.setRdfAbout(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
pi.setRdfAbout(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -16,44 +16,8 @@ public class Spatial {
|
||||||
private String country;
|
private String country;
|
||||||
private AriadneGeoPoint location;
|
private AriadneGeoPoint location;
|
||||||
private String placeName;
|
private String placeName;
|
||||||
|
private String lat;
|
||||||
public static Spatial fromRDFJson(JsonElement json, Map<String,JsonElement> map) {
|
private String lon;
|
||||||
Spatial pi = new Spatial();
|
|
||||||
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
|
||||||
switch (entry.getKey()){
|
|
||||||
case "http://www.myprefix/address" :
|
|
||||||
pi.setAddress(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/boundingBoxMaxLat":
|
|
||||||
pi.setBoundingBoxMaxLat(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/boundingBoxMaxLon":
|
|
||||||
pi.setBoundingBoxMaxLon(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/boundingBoxMinLat":
|
|
||||||
pi.setBoundingBoxMinLat(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/boundingBoxMinLon":
|
|
||||||
pi.setBoundingBoxMinLon(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/country":
|
|
||||||
pi.setCountry(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/coordinateSystem":
|
|
||||||
pi.setCoordinateSystem(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/location":
|
|
||||||
String map_key = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString();
|
|
||||||
pi.setLocation(AriadneGeoPoint.fromRDFJson(map.get(map_key)));
|
|
||||||
break;
|
|
||||||
case "http://www.myprefix/placeName":
|
|
||||||
pi.setPlaceName(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
|
@ -127,6 +91,20 @@ public class Spatial {
|
||||||
this.placeName = placeName;
|
this.placeName = placeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLat(String lat) {
|
||||||
|
if (this.getLocation()==null) {
|
||||||
|
this.setLocation(new AriadneGeoPoint());
|
||||||
|
}
|
||||||
|
this.getLocation().setLat(lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLon(String lon) {
|
||||||
|
if (this.getLocation()==null) {
|
||||||
|
this.setLocation(new AriadneGeoPoint());
|
||||||
|
}
|
||||||
|
this.getLocation().setLon(lon);
|
||||||
|
}
|
||||||
|
|
||||||
public Spatial() {
|
public Spatial() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,16 @@ package eu.dnetlib.ariadneplus.graphdb;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.RunSPARQLQueryService;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -23,12 +31,16 @@ import org.eclipse.rdf4j.rio.RDFFormat;
|
||||||
import eu.dnetlib.ariadneplus.publisher.AriadnePlusPublisherException;
|
import eu.dnetlib.ariadneplus.publisher.AriadnePlusPublisherException;
|
||||||
import eu.dnetlib.ariadneplus.rdf.RecordParserHelper;
|
import eu.dnetlib.ariadneplus.rdf.RecordParserHelper;
|
||||||
import net.sf.saxon.s9api.SaxonApiException;
|
import net.sf.saxon.s9api.SaxonApiException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author enrico.ottonello
|
* @author enrico.ottonello
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
public class GraphDBClient {
|
public class GraphDBClient {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(GraphDBClient.class);
|
private static final Log log = LogFactory.getLog(GraphDBClient.class);
|
||||||
|
@ -36,6 +48,15 @@ public class GraphDBClient {
|
||||||
public static final String PROVENANCE_NS = "http://www.d-net.research-infrastructures.eu/provenance/";
|
public static final String PROVENANCE_NS = "http://www.d-net.research-infrastructures.eu/provenance/";
|
||||||
public static final int NUM_RECORDS_THRESHOLD = 10;
|
public static final int NUM_RECORDS_THRESHOLD = 10;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RunSPARQLQueryService runSPQRLQuery;
|
||||||
|
@Autowired
|
||||||
|
private ParseRDFJSON parseRDFJSON;
|
||||||
|
@Autowired
|
||||||
|
private ResourceManager resourceManager;
|
||||||
|
@Autowired
|
||||||
|
private BulkUpload bulkUpload;
|
||||||
|
|
||||||
private RecordParserHelper recordParserHelper;
|
private RecordParserHelper recordParserHelper;
|
||||||
private String graphDBServerUrl;
|
private String graphDBServerUrl;
|
||||||
private String graphDBBaseURI;
|
private String graphDBBaseURI;
|
||||||
|
@ -43,7 +64,7 @@ public class GraphDBClient {
|
||||||
private String writerPwd;
|
private String writerPwd;
|
||||||
private String repository;
|
private String repository;
|
||||||
|
|
||||||
protected GraphDBClient(final RecordParserHelper recordParserHelper,
|
protected void setup(final RecordParserHelper recordParserHelper,
|
||||||
final String graphDBServerUrl, final String graphDBBaseURI, final String writerUser, final String writerPwd, final String repository) {
|
final String graphDBServerUrl, final String graphDBBaseURI, final String writerUser, final String writerPwd, final String repository) {
|
||||||
this.recordParserHelper = recordParserHelper;
|
this.recordParserHelper = recordParserHelper;
|
||||||
this.graphDBServerUrl = graphDBServerUrl;
|
this.graphDBServerUrl = graphDBServerUrl;
|
||||||
|
@ -318,4 +339,37 @@ public class GraphDBClient {
|
||||||
throw new AriadnePlusPublisherException(e);
|
throw new AriadnePlusPublisherException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RunSPARQLQueryService getRunSPQRLQuery() {
|
||||||
|
return runSPQRLQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunSPQRLQuery(RunSPARQLQueryService runSPQRLQuery) {
|
||||||
|
this.runSPQRLQuery = runSPQRLQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String indexOnES(String datasource, String collectionId) throws AriadnePlusPublisherException {
|
||||||
|
try {
|
||||||
|
runSPQRLQuery.setupConnection( getWriterUser(), getWriterPwd(), this.graphDBServerUrl, getRepository());
|
||||||
|
runSPQRLQuery.setParser(parseRDFJSON);
|
||||||
|
runSPQRLQuery.setResourceManager(resourceManager);
|
||||||
|
runSPQRLQuery.setBulkUpload(bulkUpload);
|
||||||
|
// String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/02E4F4B5-24B7-3AD7-B460-CFA8B1F0BD1F";
|
||||||
|
// List<String> recordIds = Arrays.asList(recordId);
|
||||||
|
List<String> recordIds = runSPQRLQuery.selectRecordIds(datasource, collectionId);
|
||||||
|
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||||
|
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
boolean isCollection = false;
|
||||||
|
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId, isCollection);
|
||||||
|
List<String> collectionResourceId = runSPQRLQuery.selectCollectionId(datasource, collectionId);
|
||||||
|
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
|
||||||
|
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
isCollection = true;
|
||||||
|
runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceId, datasource, collectionId, isCollection);
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.error(e);
|
||||||
|
throw new AriadnePlusPublisherException(e);
|
||||||
|
}
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,12 @@ public class GraphDBClientFactory {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RecordParserHelper recordParserHelper;
|
private RecordParserHelper recordParserHelper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GraphDBClient graphDBClient;
|
||||||
|
|
||||||
public GraphDBClient getGraphDBClient() {
|
public GraphDBClient getGraphDBClient() {
|
||||||
log.debug("Creating GraphDBClient for "+graphDBServerUrl);
|
graphDBClient.setup(recordParserHelper, graphDBServerUrl, graphDBBaseURI, writerUser, writerPwd, repository);
|
||||||
return new GraphDBClient(recordParserHelper, graphDBServerUrl, graphDBBaseURI, writerUser, writerPwd, repository);
|
return graphDBClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordParserHelper getRecordParserHelper() {
|
public RecordParserHelper getRecordParserHelper() {
|
||||||
|
|
|
@ -69,4 +69,8 @@ public class AriadnePlusPublisherController {
|
||||||
return getAriadnePlusPublisherHelper().feedFromURL(dataUrl, context, getTarget(DEFAULT_TARGET_ENDPOINT));
|
return getAriadnePlusPublisherHelper().feedFromURL(dataUrl, context, getTarget(DEFAULT_TARGET_ENDPOINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/indexOnES", method = RequestMethod.POST)
|
||||||
|
public String indexOnES(@RequestParam final String datasource, @RequestParam final String collectionId) throws AriadnePlusPublisherException {
|
||||||
|
return getAriadnePlusPublisherHelper().indexOnES(datasource, collectionId, getTarget(DEFAULT_TARGET_ENDPOINT));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -88,6 +88,17 @@ public class AriadnePlusPublisherHelper {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String indexOnES(final String datasource, final String collectionId, final AriadnePlusTargets target) throws AriadnePlusPublisherException {
|
||||||
|
String res;
|
||||||
|
switch(target){
|
||||||
|
case GRAPHDB:
|
||||||
|
res = indexOnES(datasource, collectionId);
|
||||||
|
break;
|
||||||
|
default: throw new AriadnePlusPublisherException("Target "+target+" not supported yet");
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
private void publishGraphDB(final String record) throws AriadnePlusPublisherException {
|
private void publishGraphDB(final String record) throws AriadnePlusPublisherException {
|
||||||
log.debug("Publishing on graphdb");
|
log.debug("Publishing on graphdb");
|
||||||
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
|
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
|
||||||
|
@ -124,4 +135,10 @@ public class AriadnePlusPublisherHelper {
|
||||||
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
|
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
|
||||||
return graphDBClient.feedFromURL(dataUrl, context);
|
return graphDBClient.feedFromURL(dataUrl, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String indexOnES(final String datasource, final String collectionId) throws AriadnePlusPublisherException {
|
||||||
|
log.info("indexOnES "+datasource + " " + collectionId);
|
||||||
|
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
|
||||||
|
return graphDBClient.indexOnES(datasource, collectionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,37 +10,55 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.utils.ClassSpec;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.utils.Mappings;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.utils.PropertiesMap;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.utils.ClassSpec;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.utils.Mappings;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.utils.PropertiesMap;
|
|
||||||
import net.minidev.json.JSONArray;
|
import net.minidev.json.JSONArray;
|
||||||
import net.minidev.json.JSONObject;
|
import net.minidev.json.JSONObject;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ResourceManager {
|
public class ResourceManager {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(ResourceManager.class);
|
||||||
|
|
||||||
@Value("${type.path:undefined}")
|
@Value("${type.path:undefined}")
|
||||||
private String type_path;
|
private String type_path;
|
||||||
@Value("${general.classpath:undefined}")
|
@Value("${general.classpath:undefined}")
|
||||||
private String general_classpath;
|
private String general_classpath;
|
||||||
@Value("${exclude.predicates:[]}")
|
@Value("${exclude.predicates:[]}")
|
||||||
private String exclude_predicates;
|
private String exclude_predicates;
|
||||||
|
@Value("${class.map.specifications:undefined}")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
private List<String> not_parsable;
|
private List<String> not_parsable;
|
||||||
|
|
||||||
private ParseRDFJSON parser;
|
private ParseRDFJSON parser;
|
||||||
|
|
||||||
|
private PropertiesMap propertiesMap;
|
||||||
|
|
||||||
|
public void setup(String type_path, String general_classpath, String exclude_predicates, String spec) {
|
||||||
|
this.type_path = type_path;
|
||||||
|
this.general_classpath = general_classpath;
|
||||||
|
this.exclude_predicates = exclude_predicates;
|
||||||
|
this.spec = spec;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init(){
|
public void init(){
|
||||||
Type listType = new TypeToken<ArrayList<String>>(){}.getType();
|
Type listType = new TypeToken<ArrayList<String>>(){}.getType();
|
||||||
not_parsable = new Gson().fromJson(exclude_predicates, listType);
|
not_parsable = new Gson().fromJson(exclude_predicates, listType);
|
||||||
|
propertiesMap = new PropertiesMap();
|
||||||
|
propertiesMap.fill(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,11 +87,17 @@ public class ResourceManager {
|
||||||
if(entry instanceof LinkedHashMap){
|
if(entry instanceof LinkedHashMap){
|
||||||
LinkedHashMap tmp = (LinkedHashMap)((JSONArray)((LinkedHashMap)entry).get(type_path)).get(0);
|
LinkedHashMap tmp = (LinkedHashMap)((JSONArray)((LinkedHashMap)entry).get(type_path)).get(0);
|
||||||
class_name = (String)tmp.get("value");
|
class_name = (String)tmp.get("value");
|
||||||
|
if (class_name.equals("provided record") || class_name.equals("Dataset Collection")) {
|
||||||
|
class_name = "AriadneCatalogEntry";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (entry == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Class<?> c = Class.forName(general_classpath + class_name);
|
Class<?> c = Class.forName(general_classpath + class_name);
|
||||||
Object class_instance = c.newInstance();
|
Object class_instance = c.newInstance();
|
||||||
ClassSpec class_spec = PropertiesMap.get(class_name);
|
ClassSpec class_spec = propertiesMap.get(class_name);
|
||||||
Set<?> keySet;
|
Set<?> keySet;
|
||||||
|
|
||||||
if(entry instanceof LinkedHashMap)
|
if(entry instanceof LinkedHashMap)
|
||||||
|
@ -101,7 +125,7 @@ public class ResourceManager {
|
||||||
setField.invoke(class_instance, getFieldValue(values.get(0)));
|
setField.invoke(class_instance, getFieldValue(values.get(0)));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(PropertiesMap.get(map.getExternal_reference()).getClass_type().equals("prototype")){
|
if(propertiesMap.get(map.getExternal_reference()).getClass_type().equals("prototype")){
|
||||||
List<Object> value_list = new ArrayList<>();
|
List<Object> value_list = new ArrayList<>();
|
||||||
for(Object value: values){
|
for(Object value: values){
|
||||||
value_list.add(manage(ParseRDFJSON.get(getFieldValue(value)), map.getExternal_reference()));
|
value_list.add(manage(ParseRDFJSON.get(getFieldValue(value)), map.getExternal_reference()));
|
||||||
|
@ -122,6 +146,35 @@ public class ResourceManager {
|
||||||
return class_instance;
|
return class_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getType_path() {
|
||||||
|
return type_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType_path(String type_path) {
|
||||||
|
this.type_path = type_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeneral_classpath() {
|
||||||
|
return general_classpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeneral_classpath(String general_classpath) {
|
||||||
|
this.general_classpath = general_classpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExclude_predicates() {
|
||||||
|
return exclude_predicates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExclude_predicates(String exclude_predicates) {
|
||||||
|
this.exclude_predicates = exclude_predicates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpec() {
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpec(String spec) {
|
||||||
|
this.spec = spec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,28 @@
|
||||||
package eu.dnetlib.ariadneplus.reader;
|
package eu.dnetlib.ariadneplus.reader;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
||||||
|
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
||||||
import org.eclipse.rdf4j.model.IRI;
|
import org.apache.commons.logging.Log;
|
||||||
import org.eclipse.rdf4j.model.Literal;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.eclipse.rdf4j.model.Model;
|
import org.eclipse.rdf4j.model.Model;
|
||||||
import org.eclipse.rdf4j.model.Resource;
|
import org.eclipse.rdf4j.query.*;
|
||||||
import org.eclipse.rdf4j.model.ValueFactory;
|
|
||||||
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
|
|
||||||
import org.eclipse.rdf4j.query.GraphQuery;
|
|
||||||
import org.eclipse.rdf4j.query.GraphQueryResult;
|
|
||||||
import org.eclipse.rdf4j.query.QueryLanguage;
|
|
||||||
import org.eclipse.rdf4j.query.QueryResults;
|
|
||||||
import org.eclipse.rdf4j.repository.Repository;
|
import org.eclipse.rdf4j.repository.Repository;
|
||||||
import org.eclipse.rdf4j.repository.RepositoryConnection;
|
import org.eclipse.rdf4j.repository.RepositoryConnection;
|
||||||
import org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;
|
import org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;
|
||||||
import org.eclipse.rdf4j.rio.RDFFormat;
|
import org.eclipse.rdf4j.rio.RDFFormat;
|
||||||
import org.eclipse.rdf4j.rio.RDFWriter;
|
import org.eclipse.rdf4j.rio.RDFWriter;
|
||||||
import org.eclipse.rdf4j.rio.Rio;
|
import org.eclipse.rdf4j.rio.Rio;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
import java.io.StringWriter;
|
||||||
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RunSPARQLQueryService {
|
public class RunSPARQLQueryService {
|
||||||
|
|
||||||
@Value("${sparql.query3:undefined}")
|
private static final Log log = LogFactory.getLog(RunSPARQLQueryService.class);
|
||||||
private String query3;
|
|
||||||
|
|
||||||
@Value("${repository.url:undefined}")
|
|
||||||
private String repository_url;
|
|
||||||
|
|
||||||
private RepositoryConnection connection;
|
private RepositoryConnection connection;
|
||||||
private RemoteRepositoryManager manager;
|
private RemoteRepositoryManager manager;
|
||||||
|
@ -41,12 +32,23 @@ public class RunSPARQLQueryService {
|
||||||
private ResourceManager resourceManager;
|
private ResourceManager resourceManager;
|
||||||
private BulkUpload bulkUpload;
|
private BulkUpload bulkUpload;
|
||||||
|
|
||||||
private void openConnection(){
|
private static String username = null;
|
||||||
manager = new RemoteRepositoryManager(repository_url);
|
private static String pwd = null;
|
||||||
|
private static String graphDBUrl = null;
|
||||||
|
private static String graphDBRepository = null;
|
||||||
|
|
||||||
|
public void setupConnection(String username, String pwd, String graphDbUrl, String graphDbRepository) {
|
||||||
|
setUsername(username);
|
||||||
|
setPwd(pwd);
|
||||||
|
setGraphDBUrl(graphDbUrl);
|
||||||
|
setGraphDBRepository(graphDbRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openConnection(){
|
||||||
|
manager = new RemoteRepositoryManager(getGraphDBUrl());
|
||||||
manager.init();
|
manager.init();
|
||||||
manager.setUsernameAndPassword("writer", "Writer01");
|
manager.setUsernameAndPassword(getUsername(), getPwd());
|
||||||
// repository = manager.getRepository("test01");
|
repository = manager.getRepository(getGraphDBRepository());
|
||||||
repository = manager.getRepository("ariadneplus-ts01");
|
|
||||||
connection = repository.getConnection();
|
connection = repository.getConnection();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,86 +59,156 @@ public class RunSPARQLQueryService {
|
||||||
manager.shutDown();
|
manager.shutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeQueryGraph(){
|
public String executeMultipleQueryGraph(String queryTemplate, List<String> recordIds, String datasource, String collectionId, boolean isCollection){
|
||||||
if (query3.equals("undefined"))
|
if (queryTemplate==null)
|
||||||
return null;
|
return null;
|
||||||
openConnection();
|
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
||||||
|
recordIds.forEach(recordId -> {
|
||||||
|
executeQueryGraph(selectQueryTemplate, recordId, isCollection);
|
||||||
|
});
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String executeQueryGraph(String selectQueryTemplate, String recordId, boolean isCollection){
|
||||||
|
log.debug("Retrieving "+recordId+" - isCollection:"+isCollection );
|
||||||
|
String query = selectQueryTemplate.replaceAll("%record", "<"+recordId+">");
|
||||||
|
openConnection();
|
||||||
StringWriter recordWriter = null;
|
StringWriter recordWriter = null;
|
||||||
Model model = null;
|
Model resultsModel = null;
|
||||||
String jsonRecord = null;
|
String jsonRecord = null;
|
||||||
try {
|
try {
|
||||||
GraphQuery graphQuery = connection.prepareGraphQuery(QueryLanguage.SPARQL, query3);
|
log.debug("Started at: "+Calendar.getInstance().getTime().toString());
|
||||||
|
GraphQuery graphQuery = connection.prepareGraphQuery(QueryLanguage.SPARQL, query);
|
||||||
GraphQueryResult graphQueryResult = graphQuery.evaluate();
|
GraphQueryResult graphQueryResult = graphQuery.evaluate();
|
||||||
System.out.println("as model ...");
|
resultsModel = QueryResults.asModel(graphQueryResult);
|
||||||
model = QueryResults.asModel(graphQueryResult);
|
|
||||||
graphQueryResult.close();
|
graphQueryResult.close();
|
||||||
int resourceCount = 0;
|
log.debug("Finished at: "+Calendar.getInstance().getTime().toString());
|
||||||
System.out.println("counting resources ... " );
|
log.debug("Statements retrieved: " + resultsModel.size());
|
||||||
ValueFactory factory = SimpleValueFactory.getInstance();
|
if (resultsModel.size()==0) {
|
||||||
IRI iri = factory.createIRI("http://www.myprefix/resourcetype");
|
return "noresult";
|
||||||
Literal value = factory.createLiteral("AriadneCatalogEntry");
|
}
|
||||||
for (Resource record: model.filter(null, iri, value).subjects()) {
|
recordWriter = new StringWriter();
|
||||||
System.out.println();
|
RDFWriter rdfRecordWriter = Rio.createWriter(RDFFormat.RDFJSON, recordWriter);
|
||||||
Model recordModel = null;
|
Rio.write(resultsModel, rdfRecordWriter);
|
||||||
// RDFWriter rdfRecordWriter = null;
|
if (isCollection) {
|
||||||
resourceCount+=1;
|
parser.setCollection(true);
|
||||||
// if (resourceCount==12) {
|
}
|
||||||
// break;
|
parser.parse(recordWriter.toString());
|
||||||
// }
|
resourceManager.manage(parser);
|
||||||
recordModel = model.filter(record, null, null);
|
bulkUpload.index(resourceManager);
|
||||||
if (recordModel!=null && !recordModel.isEmpty()) {
|
} catch(Exception e){
|
||||||
recordWriter = new StringWriter();
|
|
||||||
RDFWriter rdfRecordWriter = Rio.createWriter(RDFFormat.RDFJSON, recordWriter);
|
|
||||||
Rio.write(recordModel, rdfRecordWriter);
|
|
||||||
// System.out.println("record json: "+ recordWriter.toString());
|
|
||||||
parser.parse(recordWriter.toString());
|
|
||||||
resourceManager.manage(parser);
|
|
||||||
bulkUpload.index(resourceManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println();
|
|
||||||
System.out.println("count resources: "+ resourceCount);
|
|
||||||
System.out.println("count statements: " + model.size());
|
|
||||||
System.out.println("index to Elastic Search completed");
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}finally{
|
} finally{
|
||||||
closeConnection();
|
closeConnection();
|
||||||
if (model!=null) {
|
if (resultsModel!=null) {
|
||||||
model.clear();
|
resultsModel.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return jsonRecord;
|
return jsonRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ParseRDFJSON getParser() {
|
public ParseRDFJSON getParser() {
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setParser(ParseRDFJSON parser) {
|
public void setParser(ParseRDFJSON parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResourceManager getResourceManager() {
|
public ResourceManager getResourceManager() {
|
||||||
return resourceManager;
|
return resourceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setResourceManager(ResourceManager resourceManager) {
|
public void setResourceManager(ResourceManager resourceManager) {
|
||||||
this.resourceManager = resourceManager;
|
this.resourceManager = resourceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BulkUpload getBulkUpload() {
|
public BulkUpload getBulkUpload() {
|
||||||
return bulkUpload;
|
return bulkUpload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setBulkUpload(BulkUpload bulkUpload) {
|
public void setBulkUpload(BulkUpload bulkUpload) {
|
||||||
this.bulkUpload = bulkUpload;
|
this.bulkUpload = bulkUpload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPwd() {
|
||||||
|
return pwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGraphDBUrl() {
|
||||||
|
return graphDBUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGraphDBRepository() {
|
||||||
|
return graphDBRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setUsername(String username) {
|
||||||
|
RunSPARQLQueryService.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setPwd(String pwd) {
|
||||||
|
RunSPARQLQueryService.pwd = pwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGraphDBUrl(String graphDBUrl) {
|
||||||
|
RunSPARQLQueryService.graphDBUrl = graphDBUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGraphDBRepository(String graphDBRepository) {
|
||||||
|
RunSPARQLQueryService.graphDBRepository = graphDBRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> selectRecordIds(String datasource, String collectionId){
|
||||||
|
log.debug("Retrieving record Ids from GraphDB ...");
|
||||||
|
String queryTemplate = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
|
||||||
|
"select * \n" +
|
||||||
|
"from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>\n" +
|
||||||
|
"where { \n" +
|
||||||
|
"\t?recordId rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Individual_Data_Resource> .\n" +
|
||||||
|
"} \n";
|
||||||
|
String query = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
||||||
|
return executeSelect(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> selectCollectionId(String datasource, String collectionId){
|
||||||
|
log.debug("Retrieving collection Id from GraphDB ...");
|
||||||
|
String queryTemplate = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
|
||||||
|
"select * \n" +
|
||||||
|
"from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>\n" +
|
||||||
|
"where { \n" +
|
||||||
|
"\t?recordId rdf:type <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/AO_Collection> .\n" +
|
||||||
|
"} \n";
|
||||||
|
String query = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
||||||
|
return executeSelect(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> executeSelect(String query){
|
||||||
|
openConnection();
|
||||||
|
String jsonRecord = null;
|
||||||
|
List<String> results = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
log.debug("Started at: "+Calendar.getInstance().getTime().toString());
|
||||||
|
TupleQuery selectQuery = connection.prepareTupleQuery(QueryLanguage.SPARQL, query);
|
||||||
|
TupleQueryResult selectQueryResult = selectQuery.evaluate();
|
||||||
|
int counter = 0;
|
||||||
|
while (selectQueryResult.hasNext()) {
|
||||||
|
BindingSet recordSet = selectQueryResult.next();
|
||||||
|
org.eclipse.rdf4j.model.Value recordIdValue = recordSet.getValue("recordId");
|
||||||
|
results.add(recordIdValue.stringValue());
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
log.debug("Total records retrieved: "+counter);
|
||||||
|
log.debug("Finished at: "+Calendar.getInstance().getTime().toString());
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally{
|
||||||
|
closeConnection();
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@ package eu.dnetlib.ariadneplus.reader.json;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
import eu.dnetlib.ariadneplus.reader.RunSPARQLQueryService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -18,10 +21,17 @@ import net.minidev.json.parser.ParseException;
|
||||||
@Service
|
@Service
|
||||||
public class ParseRDFJSON {
|
public class ParseRDFJSON {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(ParseRDFJSON.class);
|
||||||
|
|
||||||
static JSONObject map ;
|
static JSONObject map ;
|
||||||
|
|
||||||
@Value("${catalog.entry.path:undefined}")
|
@Value("${catalog.entry.path}")
|
||||||
private String query;
|
private String catalogEntryJsonPath;
|
||||||
|
|
||||||
|
@Value("${catalog.entry.collection.path}")
|
||||||
|
private String catalogEntryCollectionJsonPath;
|
||||||
|
|
||||||
|
private boolean isCollection = false;
|
||||||
|
|
||||||
private String json;
|
private String json;
|
||||||
|
|
||||||
|
@ -45,8 +55,10 @@ public class ParseRDFJSON {
|
||||||
setJson(json);
|
setJson(json);
|
||||||
fillMap();
|
fillMap();
|
||||||
DocumentContext jsonContext = JsonPath.parse(json);
|
DocumentContext jsonContext = JsonPath.parse(json);
|
||||||
JSONArray entries = jsonContext.read(query);
|
log.debug(getCatalogEntryJsonPath());
|
||||||
|
JSONArray entries = jsonContext.read(getCatalogEntryJsonPath());
|
||||||
int size = entries.size();
|
int size = entries.size();
|
||||||
|
log.debug("num elements in json: "+size);
|
||||||
it = entries.iterator();
|
it = entries.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,5 +74,22 @@ public class ParseRDFJSON {
|
||||||
return (JSONObject) map.get(key);
|
return (JSONObject) map.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCatalogEntryJsonPath() {
|
||||||
|
if (isCollection) {
|
||||||
|
return catalogEntryCollectionJsonPath;
|
||||||
|
}
|
||||||
|
return catalogEntryJsonPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCatalogEntryJsonPath(String catalogEntryJsonPath) {
|
||||||
|
this.catalogEntryJsonPath = catalogEntryJsonPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCollection() {
|
||||||
|
return isCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollection(boolean collection) {
|
||||||
|
isCollection = collection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package eu.dnetlib.ariadneplus.reader.utils;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class ESUtils {
|
||||||
|
private static DateTimeFormatter originalRecordDateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy");
|
||||||
|
private static DateTimeFormatter elasticSearchDateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
public static String getESFormatDate(String originalDate) {
|
||||||
|
LocalDate parsedDate = LocalDate.parse(originalDate, originalRecordDateFormatter);
|
||||||
|
return parsedDate.format(elasticSearchDateFormatter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,14 @@
|
||||||
package eu.dnetlib.ariadneplus.reader.utils;
|
package eu.dnetlib.ariadneplus.reader.utils;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class PropertiesMap {
|
public class PropertiesMap {
|
||||||
|
@ -20,10 +18,16 @@ public class PropertiesMap {
|
||||||
|
|
||||||
private static Map<String, ClassSpec> map;
|
private static Map<String, ClassSpec> map;
|
||||||
|
|
||||||
public static ClassSpec get(String key){
|
public ClassSpec get(String key){
|
||||||
return map.get(key);
|
return map.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fill(String spec){
|
||||||
|
Type mapType = new TypeToken<HashMap<String,ClassSpec>>(){}.getType();
|
||||||
|
map = new Gson().fromJson(spec,mapType);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void fill(){
|
public void fill(){
|
||||||
Type mapType = new TypeToken<HashMap<String,ClassSpec>>(){}.getType();
|
Type mapType = new TypeToken<HashMap<String,ClassSpec>>(){}.getType();
|
||||||
|
|
|
@ -3,149 +3,40 @@
|
||||||
server.servlet.context-path=/ariadneplus-graphdb
|
server.servlet.context-path=/ariadneplus-graphdb
|
||||||
server.port=8281
|
server.port=8281
|
||||||
|
|
||||||
graphdb.serverUrl=http://localhost:7200/
|
graphdb.serverUrl=http://graphdb-test.ariadne.d4science.org:7200
|
||||||
graphdb.writer.user=writer
|
graphdb.writer.user=writer
|
||||||
graphdb.writer.pwd=writer01
|
graphdb.writer.pwd=*****
|
||||||
graphdb.repository=ariadneprova
|
graphdb.repository=ariadneplus-ts01
|
||||||
graphdb.sparqlUrl = http://localhost:7200/sparql
|
|
||||||
|
|
||||||
graphdb.baseURI=https://ariadne-infrastructure.eu/
|
graphdb.baseURI=https://ariadne-infrastructure.eu/
|
||||||
|
|
||||||
#repository.url=http://localhost:7200
|
elasticsearch.hostname=elastic-test.ariadne.d4science.org
|
||||||
repository.url=http://graphdb-test.ariadne.d4science.org:7200
|
elasticsearch.indexname=catalog_test
|
||||||
|
|
||||||
sparql.query2=PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/> PREFIX mine: <http://www.myprefix/> CONSTRUCT { ?archeologicalResourceType a mine:archeologicalResourceType . ?record mine:archeologicalResourceType ?archeologicalResourceType . ?archeologicalResourceType mine:name ?archeologicalResourceTypeName . } WHERE { GRAPH <api_________::ariadne_plus::ads::sample_partition_1> { ?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName . } }
|
catalog.entry.path=$[*][?(@['https://www.ariadne-infrastructure.eu/property/resourceType'][0]['value']=='provided record')]
|
||||||
|
catalog.entry.collection.path=$[*][?(@['https://www.ariadne-infrastructure.eu/property/resourceType'][0]['value']=='Dataset Collection')]
|
||||||
sparql.query=PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/> \
|
general.classpath=eu.dnetlib.ariadneplus.elasticsearch.model.
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
|
type.path=https://www.ariadne-infrastructure.eu/property/resourceType
|
||||||
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> \
|
exclude.predicates=["https://www.ariadne-infrastructure.eu/property/resourceType", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
||||||
PREFIX mine: <http://www.myprefix/> \
|
|
||||||
CONSTRUCT { \
|
|
||||||
?record mine:resourcetype "AriadneCatalogEntry" . \
|
|
||||||
?record mine:identifier ?record .\
|
|
||||||
?record mine:publisher ?x . \
|
|
||||||
?x a mine:AgentInfo . \
|
|
||||||
?x mine:name ?publisherName . \
|
|
||||||
?x mine:type ?publisherType . \
|
|
||||||
?archeologicalResourceType a mine:archeologicalResourceType . \
|
|
||||||
?record mine:archeologicalResourceType ?archeologicalResourceType . \
|
|
||||||
?archeologicalResourceType mine:name ?archeologicalResourceTypeName . \
|
|
||||||
?record mine:issued ?issued . \
|
|
||||||
?record mine:resourceType ?resourceType . \
|
|
||||||
?record mine:modified ?modified . \
|
|
||||||
?record mine:nativeSubject ?ns . \
|
|
||||||
?ns a mine:NativeSubject . \
|
|
||||||
?ns mine:prefLabel ?nativeSbj . \
|
|
||||||
?spatial a mine:Spatial . \
|
|
||||||
?record mine:spatial ?spatial . \
|
|
||||||
?spatial mine:placeName ?spatialPlaceName . \
|
|
||||||
?spatial mine:location ?blocation . \
|
|
||||||
?blocation a mine:AriadneGeoPoint . \
|
|
||||||
?blocation mine:lat ?spatialLocationLat . \
|
|
||||||
?blocation mine:lon ?spatialLocationLon . \
|
|
||||||
?record mine:accessPolicy ?accessPolicy . \
|
|
||||||
?record mine:landingPage ?landingPage . \
|
|
||||||
?record mine:title ?title . \
|
|
||||||
?record mine:accessRights ?accessRights . \
|
|
||||||
?record mine:description ?description . \
|
|
||||||
?record mine:contributor ?contributor . \
|
|
||||||
?contributor a mine:AgentInfo . \
|
|
||||||
?contributor mine:name ?contributorName . \
|
|
||||||
?contributor mine:type ?contributorType . \
|
|
||||||
?record mine:originalId ?originalId . \
|
|
||||||
?record mine:temporal ?t .\
|
|
||||||
?t a mine:AriadneTemporal . \
|
|
||||||
?t mine:periodName ?temporalPeriodName . \
|
|
||||||
?record mine:language ?language . \
|
|
||||||
} \
|
|
||||||
WHERE { \
|
|
||||||
GRAPH <api_________::ariadne_plus::ads::sample_partition_1> { \
|
|
||||||
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName . \
|
|
||||||
?x rdfs:label ?publisherName . \
|
|
||||||
?record aocat:has_native_subject ?ns . \
|
|
||||||
?ns skos:prefLabel ?nativeSbj . \
|
|
||||||
?type skos:prefLabel ?resourceType . \
|
|
||||||
?record aocat:has_spatial_coverage ?spatial . \
|
|
||||||
?spatial aocat:has_place_name ?spatialPlaceName . \
|
|
||||||
?spatial aocat:has_latitude ?spatialLocationLat . \
|
|
||||||
?spatial aocat:has_longitude ?spatialLocationLon . \
|
|
||||||
?record aocat:has_access_policy ?accessPolicy . \
|
|
||||||
?record aocat:has_landing_page ?z . \
|
|
||||||
?z rdfs:label ?landingPage . \
|
|
||||||
?record aocat:has_title ?title . \
|
|
||||||
?record aocat:has_access_policy ?accessRights . \
|
|
||||||
?record aocat:has_description ?description . \
|
|
||||||
?record aocat:has_creator ?contributor . \
|
|
||||||
?contributor rdfs:label ?contributorName . \
|
|
||||||
?record aocat:has_original_id ?originalId . \
|
|
||||||
?record aocat:has_temporal_coverage ?t . \
|
|
||||||
?t aocat:has_period ?p . \
|
|
||||||
?p skos:prefLabel ?temporalPeriodName . \
|
|
||||||
?l skos:prefLabel ?language . \
|
|
||||||
BIND("organization" as ?contributorType) . \
|
|
||||||
BIND("organization" as ?publisherType) . \
|
|
||||||
BIND(uri(concat('http://www.myprefix/location/', md5(concat(str(?spatialLocationLat), str(?spatialLocationLon))))) as ?blocation) \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sparql.query3=PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>\
|
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\
|
|
||||||
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\
|
|
||||||
PREFIX mine: <http://www.myprefix/>\
|
|
||||||
PREFIX onto: <http://www.ontotext.com/>\
|
|
||||||
CONSTRUCT {\
|
|
||||||
?record mine:resourcetype "AriadneCatalogEntry" .\
|
|
||||||
?record mine:identifier ?record .\
|
|
||||||
?record mine:publisher ?x .\
|
|
||||||
?x mine:type ?publisherType .\
|
|
||||||
?record mine:issued ?issued .\
|
|
||||||
?record mine:modified ?modified .\
|
|
||||||
?record mine:accessPolicy ?accessPolicy .\
|
|
||||||
?record mine:landingPage ?landingPage .\
|
|
||||||
?record mine:title ?title .\
|
|
||||||
?record mine:accessRights ?accessRights .\
|
|
||||||
?record mine:description ?description .\
|
|
||||||
?record mine:contributor ?contributor .\
|
|
||||||
?record mine:originalId ?originalId .\
|
|
||||||
}\
|
|
||||||
WHERE {\
|
|
||||||
?record aocat:has_access_policy ?accessPolicy .\
|
|
||||||
?record aocat:has_landing_page ?z .\
|
|
||||||
?z rdfs:label ?landingPage .\
|
|
||||||
?record aocat:has_title ?title .\
|
|
||||||
?record aocat:has_access_policy ?accessRights .\
|
|
||||||
?record aocat:has_description ?description .\
|
|
||||||
?record aocat:has_original_id ?originalId .\
|
|
||||||
BIND("organization" as ?contributorType) .\
|
|
||||||
BIND("organization" as ?publisherType) .\
|
|
||||||
}\
|
|
||||||
limit 20
|
|
||||||
|
|
||||||
catalog.entry.path=$[*][?(@['http://www.myprefix/resourcetype'][0]['value']=='AriadneCatalogEntry')]
|
|
||||||
general.classpath=ariadneplus.elasticsearch.model.
|
|
||||||
type.path=http://www.myprefix/resourcetype
|
|
||||||
exclude.predicates=["http://www.myprefix/resourcetype", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
|
||||||
class.map.specifications={\
|
class.map.specifications={\
|
||||||
"AriadneTemporal": {\
|
"AriadneTemporal": {\
|
||||||
"class_type": "prototype",\
|
"class_type": "prototype",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/from": {\
|
"https://www.ariadne-infrastructure.eu/property/from": {\
|
||||||
"class_field": "From",\
|
"class_field": "From",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/periodName": {\
|
"https://www.ariadne-infrastructure.eu/property/periodName": {\
|
||||||
"class_field": "PeriodName",\
|
"class_field": "PeriodName",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/until": {\
|
"https://www.ariadne-infrastructure.eu/property/until": {\
|
||||||
"class_field": "Until",\
|
"class_field": "Until",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/uri": {\
|
"https://www.ariadne-infrastructure.eu/property/uri": {\
|
||||||
"class_field": "Uri",\
|
"class_field": "Uri",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
|
@ -155,12 +46,12 @@ class.map.specifications={\
|
||||||
"AriadneGeoPoint": {\
|
"AriadneGeoPoint": {\
|
||||||
"class_type": "unique",\
|
"class_type": "unique",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/lat": {\
|
"https://www.ariadne-infrastructure.eu/property/lat": {\
|
||||||
"class_field": "Lat",\
|
"class_field": "Lat",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/lon": {\
|
"https://www.ariadne-infrastructure.eu/property/lon": {\
|
||||||
"class_field": "Lon",\
|
"class_field": "Lon",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
|
@ -169,41 +60,51 @@ class.map.specifications={\
|
||||||
},\
|
},\
|
||||||
"Spatial": {\
|
"Spatial": {\
|
||||||
"class_type": "prototype",\
|
"class_type": "prototype",\
|
||||||
"mappings":{"http://www.myprefix/address": {\
|
"mappings":{"https://www.ariadne-infrastructure.eu/property/address": {\
|
||||||
"class_field": "Address",\
|
"class_field": "Address",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/coordinateSystem": {\
|
"https://www.ariadne-infrastructure.eu/property/coordinateSystem": {\
|
||||||
"class_field": "CoordinateSystem",\
|
"class_field": "CoordinateSystem",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/country": {\
|
"https://www.ariadne-infrastructure.eu/property/country": {\
|
||||||
"class_field": "Country",\
|
"class_field": "Country",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/location": {\
|
"https://www.ariadne-infrastructure.eu/property/location": {\
|
||||||
"class_field": "Location",\
|
"class_field": "Location",\
|
||||||
"external_reference": "AriadneGeoPoint",\
|
"external_reference": "AriadneGeoPoint",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/placeName": {\
|
"https://www.ariadne-infrastructure.eu/property/lat": {\
|
||||||
|
"class_field": "Lat",\
|
||||||
|
"substring": "no",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/lon": {\
|
||||||
|
"class_field": "Lon",\
|
||||||
|
"substring": "no",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/placeName": {\
|
||||||
"class_field": "PlaceName",\
|
"class_field": "PlaceName",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
}}\
|
}}\
|
||||||
},\
|
},\
|
||||||
"ArcheologicalResourceType": {\
|
"ArchaeologicalResourceType": {\
|
||||||
"class_type": "unique",\
|
"class_type": "unique",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/id": {\
|
"https://www.ariadne-infrastructure.eu/property/id": {\
|
||||||
"class_field": "Id",\
|
"class_field": "Id",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/name": {\
|
"https://www.ariadne-infrastructure.eu/property/name": {\
|
||||||
"class_field": "Name",\
|
"class_field": "Name",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
|
@ -213,22 +114,22 @@ class.map.specifications={\
|
||||||
"AgentInfo": {\
|
"AgentInfo": {\
|
||||||
"class_type": "prototype",\
|
"class_type": "prototype",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/name": {\
|
"https://www.ariadne-infrastructure.eu/property/name": {\
|
||||||
"class_field": "Name",\
|
"class_field": "Name",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/type": {\
|
"https://www.ariadne-infrastructure.eu/property/type": {\
|
||||||
"class_field": "Type",\
|
"class_field": "Type",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/email": {\
|
"https://www.ariadne-infrastructure.eu/property/email": {\
|
||||||
"class_field": "Email",\
|
"class_field": "Email",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/phone": {\
|
"https://www.ariadne-infrastructure.eu/property/phone": {\
|
||||||
"class_field": "Phone",\
|
"class_field": "Phone",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
|
@ -238,108 +139,178 @@ class.map.specifications={\
|
||||||
"NativeSubject": {\
|
"NativeSubject": {\
|
||||||
"class_type": "prototype",\
|
"class_type": "prototype",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/prefLabel": {\
|
"https://www.ariadne-infrastructure.eu/property/prefLabel": {\
|
||||||
"class_field": "PrefLabel",\
|
"class_field": "PrefLabel",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/rdfAbout": {\
|
"https://www.ariadne-infrastructure.eu/property/rdfAbout": {\
|
||||||
"class_field": "RdfAbout",\
|
"class_field": "RdfAbout",\
|
||||||
"substring": "yes",\
|
"substring": "yes",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
},\
|
},\
|
||||||
|
"DerivedSubject": {\
|
||||||
|
"class_type": "prototype",\
|
||||||
|
"mappings": {\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/prefLabel": {\
|
||||||
|
"class_field": "PrefLabel",\
|
||||||
|
"substring": "no",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/source": {\
|
||||||
|
"class_field": "Source",\
|
||||||
|
"substring": "yes",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
},\
|
||||||
|
"AatSubject": {\
|
||||||
|
"class_type": "prototype",\
|
||||||
|
"mappings": {\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/id": {\
|
||||||
|
"class_field": "Id",\
|
||||||
|
"substring": "no",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/label": {\
|
||||||
|
"class_field": "Label",\
|
||||||
|
"substring": "yes",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/lang": {\
|
||||||
|
"class_field": "Lang",\
|
||||||
|
"substring": "yes",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
},\
|
||||||
"AriadneCatalogEntry": {\
|
"AriadneCatalogEntry": {\
|
||||||
"class_type": "unique",\
|
"class_type": "unique",\
|
||||||
"mappings": {\
|
"mappings": {\
|
||||||
"http://www.myprefix/accessPolicy": {\
|
"https://www.ariadne-infrastructure.eu/property/accessPolicy": {\
|
||||||
"class_field": "AccessPolicy",\
|
"class_field": "AccessPolicy",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/identifier": {\
|
"https://www.ariadne-infrastructure.eu/property/identifier": {\
|
||||||
"class_field": "Identifier",\
|
"class_field": "Identifier",\
|
||||||
"substring": "yes",\
|
"substring": "yes",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/publisher": {\
|
"https://www.ariadne-infrastructure.eu/property/publisher": {\
|
||||||
"class_field": "Publisher",\
|
"class_field": "Publisher",\
|
||||||
"external_reference": "AgentInfo",\
|
"external_reference": "AgentInfo",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/archeologicalResourceType": {\
|
"https://www.ariadne-infrastructure.eu/property/archeologicalResourceType": {\
|
||||||
"class_field": "ArcheologicalResourceType",\
|
"class_field": "ArchaeologicalResourceType",\
|
||||||
"external_reference": "ArcheologicalResourceType",\
|
"external_reference": "ArchaeologicalResourceType",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/issued": {\
|
"https://www.ariadne-infrastructure.eu/property/issued": {\
|
||||||
"class_field": "Issued",\
|
"class_field": "Issued",\
|
||||||
"element_type": "java.lang.String",\
|
"element_type": "java.lang.String",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/resourceType": {\
|
"https://www.ariadne-infrastructure.eu/property/resourceType": {\
|
||||||
"class_field": "ResourceType",\
|
"class_field": "ResourceType",\
|
||||||
"element_type": "java.lang.String",\
|
"element_type": "java.lang.String",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/modified": {\
|
"https://www.ariadne-infrastructure.eu/property/modified": {\
|
||||||
"class_field": "Modified",\
|
"class_field": "Modified",\
|
||||||
"element_type": "java.lang.String",\
|
"element_type": "java.lang.String",\
|
||||||
"substring": "no"\
|
"substring": "no"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/nativeSubject": {\
|
"https://www.ariadne-infrastructure.eu/property/nativeSubject": {\
|
||||||
"class_field": "NativeSubject",\
|
"class_field": "NativeSubject",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"external_reference": "NativeSubject"\
|
"external_reference": "NativeSubject"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/spatial": {\
|
"https://www.ariadne-infrastructure.eu/property/derivedSubject": {\
|
||||||
|
"class_field": "DerivedSubject",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "DerivedSubject"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/aatSubjects": {\
|
||||||
|
"class_field": "AatSubjects",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "AatSubject"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/spatialRegion": {\
|
||||||
"class_field": "Spatial",\
|
"class_field": "Spatial",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"external_reference": "Spatial"\
|
"external_reference": "Spatial"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/landingPage": {\
|
"https://www.ariadne-infrastructure.eu/property/spatialRegionPoint": {\
|
||||||
|
"class_field": "Spatial",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "Spatial"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/landingPage": {\
|
||||||
"class_field": "LandingPage",\
|
"class_field": "LandingPage",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/title": {\
|
"https://www.ariadne-infrastructure.eu/property/placeName": {\
|
||||||
|
"class_field": "PlaceName",\
|
||||||
|
"substring": "no",\
|
||||||
|
"element_type": "java.lang.String"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/title": {\
|
||||||
"class_field": "Title",\
|
"class_field": "Title",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/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"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/description": {\
|
"https://www.ariadne-infrastructure.eu/property/description": {\
|
||||||
"class_field": "Description",\
|
"class_field": "Description",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/contributor": {\
|
"https://www.ariadne-infrastructure.eu/property/creator": {\
|
||||||
|
"class_field": "Creator",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "AgentInfo"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/contributor": {\
|
||||||
"class_field": "Contributor",\
|
"class_field": "Contributor",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"external_reference": "AgentInfo"\
|
"external_reference": "AgentInfo"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/originalId": {\
|
"https://www.ariadne-infrastructure.eu/property/legalResponsible": {\
|
||||||
|
"class_field": "LegalResponsible",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "AgentInfo"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/owner": {\
|
||||||
|
"class_field": "Owner",\
|
||||||
|
"substring": "no",\
|
||||||
|
"external_reference": "AgentInfo"\
|
||||||
|
},\
|
||||||
|
"https://www.ariadne-infrastructure.eu/property/originalId": {\
|
||||||
"class_field": "OriginalId",\
|
"class_field": "OriginalId",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/temporal": {\
|
"https://www.ariadne-infrastructure.eu/property/uri": {\
|
||||||
"class_field": "Temporal",\
|
"class_field": "Temporal",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"external_reference": "AriadneTemporal"\
|
"external_reference": "AriadneTemporal"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/language": {\
|
"https://www.ariadne-infrastructure.eu/property/language": {\
|
||||||
"class_field": "Language",\
|
"class_field": "Language",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
},\
|
},\
|
||||||
"http://www.myprefix/partOf": {\
|
"https://www.ariadne-infrastructure.eu/property/partOf": {\
|
||||||
"class_field": "PartOf",\
|
"class_field": "IsPartOf",\
|
||||||
"substring": "no",\
|
"substring": "no",\
|
||||||
"element_type": "java.lang.String"\
|
"element_type": "java.lang.String"\
|
||||||
}\
|
}\
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
|
||||||
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||||
|
PREFIX time: <http://www.w3.org/2006/time#>
|
||||||
|
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
|
||||||
|
INSERT {
|
||||||
|
GRAPH <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::271> {
|
||||||
|
?record aocat:was_issued ?issued .
|
||||||
|
?record aocat:was_modified ?modified .
|
||||||
|
?record aocat:has_contributor ?contributor .
|
||||||
|
?record aocat:has_responsible ?legalResponsible .
|
||||||
|
?record aocat:has_owner ?owner .
|
||||||
|
?record aocat:has_publisher ?publisher .
|
||||||
|
?record aocat:has_access_rights ?accessRights .
|
||||||
|
?record aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHERE {
|
||||||
|
?record aocat:is_part_of ?collection .
|
||||||
|
?collection aocat:was_issued ?issued .
|
||||||
|
?collection aocat:was_modified ?modified .
|
||||||
|
?collection aocat:has_contributor ?contributor .
|
||||||
|
?contributor aocat:has_name ?contributorName .
|
||||||
|
?collection aocat:has_responsible ?legalResponsible .
|
||||||
|
?legalResponsible aocat:has_name ?legalResponsibleName .
|
||||||
|
?collection aocat:has_owner ?owner .
|
||||||
|
?owner aocat:has_name ?ownerName .
|
||||||
|
?collection aocat:has_publisher ?publisher .
|
||||||
|
?publisher aocat:has_name ?publisherName .
|
||||||
|
?collection aocat:has_access_rights ?accessRights .
|
||||||
|
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
||||||
|
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
|
||||||
|
optional {
|
||||||
|
?contributor aocat:has_email ?contributorEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?legalResponsible aocat:has_email ?legalResponsibleEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?owner aocat:has_email ?ownerEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?publisher aocat:has_email ?publisherEmail .
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
|
||||||
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||||
|
PREFIX time: <http://www.w3.org/2006/time#>
|
||||||
|
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
|
||||||
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
||||||
|
INSERT {
|
||||||
|
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::ads::aatplus> {
|
||||||
|
?record aocat:has_derived_subject ?aat .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::aat>
|
||||||
|
USING <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::271>
|
||||||
|
WHERE {
|
||||||
|
{
|
||||||
|
?record aocat:has_native_subject ?native_subject .
|
||||||
|
?native_subject skos:exactMatch ?aat .
|
||||||
|
}
|
||||||
|
union
|
||||||
|
{
|
||||||
|
?record aocat:has_native_subject ?native_subject .
|
||||||
|
?native_subject skos:broadMatch ?aat .
|
||||||
|
}
|
||||||
|
union
|
||||||
|
{
|
||||||
|
?record aocat:has_native_subject ?native_subject .
|
||||||
|
?native_subject skos:closeMatch ?aat .
|
||||||
|
}
|
||||||
|
union
|
||||||
|
{
|
||||||
|
?record aocat:has_native_subject ?native_subject .
|
||||||
|
?native_subject skos:narrowMatch ?aat .
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
|
||||||
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||||
|
PREFIX time: <http://www.w3.org/2006/time#>
|
||||||
|
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
|
||||||
|
INSERT {
|
||||||
|
GRAPH <https://ariadne-infrastructure.eu/ariadneplus::ads::periodoplus> {
|
||||||
|
?temporal aocat:has_period ?periodO .
|
||||||
|
?temporal aocat:from ?temporalFrom .
|
||||||
|
?temporal aocat:until ?temporalUntil .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHERE {
|
||||||
|
?temporal aocat:has_native_period ?native_period .
|
||||||
|
?native_period skos:prefLabel ?native_label .
|
||||||
|
optional {
|
||||||
|
?periodO skos:altLabel ?native_label .
|
||||||
|
?periodO skos:inScheme <http://n2t.net/ark:/99152/p0kh9ds> .
|
||||||
|
?periodO time:intervalStartedBy ?intervalStartedBy .
|
||||||
|
?intervalStartedBy skos:prefLabel ?temporalFrom .
|
||||||
|
?periodO time:intervalFinishedBy ?intervalFinishedBy .
|
||||||
|
?intervalFinishedBy skos:prefLabel ?temporalUntil .
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
|
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||||
|
PREFIX aoprop: <https://www.ariadne-infrastructure.eu/property/>
|
||||||
|
PREFIX onto: <http://www.ontotext.com/>
|
||||||
|
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
|
||||||
|
PREFIX time: <http://www.w3.org/2006/time#>
|
||||||
|
|
||||||
|
CONSTRUCT {
|
||||||
|
%record aoprop:identifier %record .
|
||||||
|
%record aoprop:originalId ?originalId .
|
||||||
|
%record aoprop:issued ?issued .
|
||||||
|
%record aoprop:modified ?modified .
|
||||||
|
%record aoprop:partOf ?partOf .
|
||||||
|
%record aoprop:creator ?creator .
|
||||||
|
?creator aoprop:name ?creatorName .
|
||||||
|
?creator aoprop:email ?creatorEmail .
|
||||||
|
%record aoprop:contributor ?contributor .
|
||||||
|
?contributor aoprop:name ?contributorName .
|
||||||
|
?contributor aoprop:email ?contributorEmail .
|
||||||
|
%record aoprop:legalResponsible ?legalResponsible .
|
||||||
|
?legalResponsible aoprop:name ?legalResponsibleName .
|
||||||
|
?legalResponsible aoprop:email ?legalResponsibleEmail .
|
||||||
|
%record aoprop:owner ?owner .
|
||||||
|
?owner aoprop:name ?ownerName .
|
||||||
|
?owner aoprop:email ?ownerEmail .
|
||||||
|
%record aoprop:publisher ?publisher .
|
||||||
|
?publisher aoprop:name ?publisherName .
|
||||||
|
?publisher aoprop:email ?publisherEmail .
|
||||||
|
%record aoprop:accessPolicy ?accessPolicy .
|
||||||
|
%record aoprop:accessRights ?accessRights .
|
||||||
|
%record aoprop:landingPage ?landingPage .
|
||||||
|
%record aoprop:spatialRegion ?spatialRegion .
|
||||||
|
?spatialRegion aoprop:placeName ?spatialPlaceName .
|
||||||
|
?spatialRegion aoprop:spatialCoordinateSystem ?spatialCoordinateSystem .
|
||||||
|
%record aoprop:spatialRegionPoint ?spatialRegionPoint .
|
||||||
|
?spatialRegionPoint aoprop:lat ?spatialLocationLat .
|
||||||
|
?spatialRegionPoint aoprop:lon ?spatialLocationLon .
|
||||||
|
%record aoprop:spatialRegionBox ?spatialRegionBox .
|
||||||
|
?spatialRegionBox aoprop:boxMaxLat ?spatialLocationBBMaxLat .
|
||||||
|
?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon .
|
||||||
|
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
|
||||||
|
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
|
||||||
|
%record aoprop:uri ?temporal .
|
||||||
|
?temporal aoprop:periodName ?temporalPeriodName .
|
||||||
|
?temporal aoprop:from ?temporalFrom .
|
||||||
|
?temporal aoprop:until ?temporalUntil .
|
||||||
|
%record aoprop:uri ?temporalNative .
|
||||||
|
?temporalNative aoprop:periodName ?temporalNativePeriodName .
|
||||||
|
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||||
|
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||||
|
%record aoprop:resourceType ?resourceType .
|
||||||
|
%record aoprop:nativeSubject ?nativeSubject .
|
||||||
|
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
||||||
|
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
||||||
|
%record aoprop:derivedSubject ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:prefLabel ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:source "Getty AAT" .
|
||||||
|
%record aoprop:aatSubjects ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:id ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:lang ?aatSubjectsLang .
|
||||||
|
%record aoprop:title ?title .
|
||||||
|
%record aoprop:description ?description .
|
||||||
|
%record aoprop:language ?language .
|
||||||
|
}
|
||||||
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::aat>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::aatplus>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodo>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodoplus>
|
||||||
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>
|
||||||
|
where {
|
||||||
|
%record aocat:has_language / skos:prefLabel ?language .
|
||||||
|
%record aocat:has_original_id ?originalId .
|
||||||
|
%record aocat:has_creator ?creator .
|
||||||
|
?creator aocat:has_name ?creatorName .
|
||||||
|
%record aocat:has_title ?title .
|
||||||
|
%record aocat:has_type / skos:prefLabel ?resourceType .
|
||||||
|
optional {
|
||||||
|
?creator aocat:has_email ?creatorEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_description ?description .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_access_policy / rdfs:label ?accessPolicy .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_landing_page / rdfs:label ?landingPage .
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
select *
|
||||||
|
where {
|
||||||
|
%record aocat:was_issued ?issued .
|
||||||
|
%record aocat:was_modified ?modified .
|
||||||
|
%record aocat:has_contributor ?contributor .
|
||||||
|
?contributor aocat:has_name ?contributorName .
|
||||||
|
%record aocat:has_responsible ?legalResponsible .
|
||||||
|
?legalResponsible aocat:has_name ?legalResponsibleName .
|
||||||
|
%record aocat:has_owner ?owner .
|
||||||
|
?owner aocat:has_name ?ownerName .
|
||||||
|
%record aocat:has_publisher ?publisher .
|
||||||
|
?publisher aocat:has_name ?publisherName .
|
||||||
|
%record aocat:has_access_rights ?accessRights .
|
||||||
|
%record aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
||||||
|
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
|
||||||
|
optional {
|
||||||
|
?contributor aocat:has_email ?contributorEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?legalResponsible aocat:has_email ?legalResponsibleEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?owner aocat:has_email ?ownerEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?publisher aocat:has_email ?publisherEmail .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BIND (lang(?derivedSubjectPrefLabel) as ?aatSubjectsLang)
|
||||||
|
}
|
|
@ -45,21 +45,30 @@ CONSTRUCT {
|
||||||
?temporal aoprop:periodName ?temporalPeriodName .
|
?temporal aoprop:periodName ?temporalPeriodName .
|
||||||
?temporal aoprop:from ?temporalFrom .
|
?temporal aoprop:from ?temporalFrom .
|
||||||
?temporal aoprop:until ?temporalUntil .
|
?temporal aoprop:until ?temporalUntil .
|
||||||
|
?record aoprop:uri ?temporalNative .
|
||||||
|
?temporalNative aoprop:periodName ?temporalNativePeriodName .
|
||||||
?record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
?record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||||
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||||
?record aoprop:resourceType ?resourceType .
|
?record aoprop:resourceType ?resourceType .
|
||||||
?record aoprop:nativeSubject ?nativeSubject .
|
?record aoprop:nativeSubject ?nativeSubject .
|
||||||
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
||||||
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
||||||
?nativeSubject aoprop:aatSubjectsId ?aatSubjectsId .
|
?record aoprop:derivedSubject ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:prefLabel ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:source "Getty AAT" .
|
||||||
|
?record aoprop:aatSubjects ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:id ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:lang ?aatSubjectsLang .
|
||||||
?record aoprop:title ?title .
|
?record aoprop:title ?title .
|
||||||
?record aoprop:description ?description .
|
?record aoprop:description ?description .
|
||||||
?record aoprop:language ?language .
|
?record aoprop:language ?language .
|
||||||
}
|
}
|
||||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::aat>
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::aat>
|
||||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::periodo>
|
from <https://ariadne-infrastructure.eu/ariadneplus::ads::aatplus>
|
||||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::periodO-En-UK>
|
from <https://ariadne-infrastructure.eu/ariadneplus::ads::periodo>
|
||||||
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::420_event>
|
from <https://ariadne-infrastructure.eu/ariadneplus::ads::periodoplus>
|
||||||
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::ads::271>
|
||||||
where {
|
where {
|
||||||
?record aocat:has_language / skos:prefLabel ?language .
|
?record aocat:has_language / skos:prefLabel ?language .
|
||||||
?record aocat:has_original_id ?originalId .
|
?record aocat:has_original_id ?originalId .
|
||||||
|
@ -68,19 +77,15 @@ where {
|
||||||
?creator aocat:has_name ?creatorName .
|
?creator aocat:has_name ?creatorName .
|
||||||
?record aocat:has_title ?title .
|
?record aocat:has_title ?title .
|
||||||
?record aocat:has_type / skos:prefLabel ?resourceType .
|
?record aocat:has_type / skos:prefLabel ?resourceType .
|
||||||
|
?record aocat:has_native_subject ?nativeSubject .
|
||||||
|
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
|
||||||
|
optional {
|
||||||
|
?record aocat:has_derived_subject ?derivedSubject .
|
||||||
|
?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel .
|
||||||
|
}
|
||||||
optional {
|
optional {
|
||||||
?creator aocat:has_email ?creatorEmail .
|
?creator aocat:has_email ?creatorEmail .
|
||||||
}
|
}
|
||||||
optional {
|
|
||||||
?record aocat:has_native_subject ?nativeSubject .
|
|
||||||
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
|
|
||||||
optional {
|
|
||||||
?nativeSubject skos:exactMatch ?aatSubjectsId .
|
|
||||||
}
|
|
||||||
optional {
|
|
||||||
?nativeSubject skos:closeMatch ?aatSubjectsId .
|
|
||||||
}
|
|
||||||
}
|
|
||||||
optional {
|
optional {
|
||||||
?record aocat:has_description ?description .
|
?record aocat:has_description ?description .
|
||||||
}
|
}
|
||||||
|
@ -90,38 +95,35 @@ where {
|
||||||
optional {
|
optional {
|
||||||
?record aocat:has_landing_page / rdfs:label ?landingPage .
|
?record aocat:has_landing_page / rdfs:label ?landingPage .
|
||||||
}
|
}
|
||||||
optional {
|
optional {
|
||||||
?record aocat:has_temporal_coverage ?temporal .
|
?record aocat:has_temporal_coverage ?temporalNative .
|
||||||
?temporal aocat:has_period / rdfs:label ?temporalPeriodName .
|
?temporalNative aocat:has_native_period / skos:prefLabel ?temporalNativePeriodName .
|
||||||
}
|
}
|
||||||
optional {
|
optional {
|
||||||
?record aocat:has_temporal_coverage ?temporal .
|
?record aocat:has_temporal_coverage ?temporal .
|
||||||
?temporal aocat:has_native_period ?nativePeriod .
|
?temporal aocat:has_period / skos:prefLabel ?temporalPeriodName .
|
||||||
?nativePeriod skos:prefLabel ?temporalPeriodName .
|
|
||||||
optional {
|
optional {
|
||||||
?nativePeriod skos:exactMatch ?periodORef .
|
?temporal aocat:from ?temporalFrom .
|
||||||
?periodORef time:intervalStartedBy ?intervalStartedBy .
|
?temporal aocat:until ?temporalUntil .
|
||||||
?intervalStartedBy skos:prefLabel ?temporalFrom .
|
}
|
||||||
?periodORef time:intervalFinishedBy ?intervalFinishedBy .
|
|
||||||
?intervalFinishedBy skos:prefLabel ?temporalUntil .
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
select *
|
select *
|
||||||
where {
|
where {
|
||||||
?record aocat:is_part_of ?collection .
|
?record aocat:is_part_of ?collection .
|
||||||
?collection aocat:was_issued ?issued .
|
?record aocat:was_issued ?issued .
|
||||||
?collection aocat:was_modified ?modified .
|
?record aocat:was_modified ?modified .
|
||||||
?collection aocat:has_contributor ?contributor .
|
?record aocat:has_contributor ?contributor .
|
||||||
?contributor aocat:has_name ?contributorName .
|
?contributor aocat:has_name ?contributorName .
|
||||||
?collection aocat:has_responsible ?legalResponsible .
|
?record aocat:has_responsible ?legalResponsible .
|
||||||
?legalResponsible aocat:has_name ?legalResponsibleName .
|
?legalResponsible aocat:has_name ?legalResponsibleName .
|
||||||
?collection aocat:has_owner ?owner .
|
?record aocat:has_owner ?owner .
|
||||||
?owner aocat:has_name ?ownerName .
|
?owner aocat:has_name ?ownerName .
|
||||||
?collection aocat:has_publisher ?publisher .
|
?record aocat:has_publisher ?publisher .
|
||||||
?publisher aocat:has_name ?publisherName .
|
?publisher aocat:has_name ?publisherName .
|
||||||
?collection aocat:has_access_rights ?accessRights .
|
?record aocat:has_access_rights ?accessRights .
|
||||||
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
?record aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
||||||
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
|
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
|
||||||
optional {
|
optional {
|
||||||
?contributor aocat:has_email ?contributorEmail .
|
?contributor aocat:has_email ?contributorEmail .
|
||||||
|
@ -137,6 +139,7 @@ where {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
select *
|
select *
|
||||||
where {
|
where {
|
||||||
|
@ -159,5 +162,5 @@ where {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIND (lang(?derivedSubjectPrefLabel) as ?aatSubjectsLang)
|
||||||
}
|
}
|
|
@ -0,0 +1,166 @@
|
||||||
|
PREFIX aocat: <https://www.ariadne-infrastructure.eu/resource/ao/cat/1.1/>
|
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||||
|
PREFIX aoprop: <https://www.ariadne-infrastructure.eu/property/>
|
||||||
|
PREFIX onto: <http://www.ontotext.com/>
|
||||||
|
PREFIX ariadneplus: <https://ariadne-infrastructure.eu/aocat/>
|
||||||
|
PREFIX time: <http://www.w3.org/2006/time#>
|
||||||
|
|
||||||
|
CONSTRUCT {
|
||||||
|
%record aoprop:identifier %record .
|
||||||
|
%record aoprop:originalId ?originalId .
|
||||||
|
%record aoprop:issued ?issued .
|
||||||
|
%record aoprop:modified ?modified .
|
||||||
|
%record aoprop:partOf ?partOf .
|
||||||
|
%record aoprop:creator ?creator .
|
||||||
|
?creator aoprop:name ?creatorName .
|
||||||
|
?creator aoprop:email ?creatorEmail .
|
||||||
|
%record aoprop:contributor ?contributor .
|
||||||
|
?contributor aoprop:name ?contributorName .
|
||||||
|
?contributor aoprop:email ?contributorEmail .
|
||||||
|
%record aoprop:legalResponsible ?legalResponsible .
|
||||||
|
?legalResponsible aoprop:name ?legalResponsibleName .
|
||||||
|
?legalResponsible aoprop:email ?legalResponsibleEmail .
|
||||||
|
%record aoprop:owner ?owner .
|
||||||
|
?owner aoprop:name ?ownerName .
|
||||||
|
?owner aoprop:email ?ownerEmail .
|
||||||
|
%record aoprop:publisher ?publisher .
|
||||||
|
?publisher aoprop:name ?publisherName .
|
||||||
|
?publisher aoprop:email ?publisherEmail .
|
||||||
|
%record aoprop:accessPolicy ?accessPolicy .
|
||||||
|
%record aoprop:accessRights ?accessRights .
|
||||||
|
%record aoprop:landingPage ?landingPage .
|
||||||
|
%record aoprop:spatialRegion ?spatialRegion .
|
||||||
|
?spatialRegion aoprop:placeName ?spatialPlaceName .
|
||||||
|
?spatialRegion aoprop:spatialCoordinateSystem ?spatialCoordinateSystem .
|
||||||
|
%record aoprop:spatialRegionPoint ?spatialRegionPoint .
|
||||||
|
?spatialRegionPoint aoprop:lat ?spatialLocationLat .
|
||||||
|
?spatialRegionPoint aoprop:lon ?spatialLocationLon .
|
||||||
|
%record aoprop:spatialRegionBox ?spatialRegionBox .
|
||||||
|
?spatialRegionBox aoprop:boxMaxLat ?spatialLocationBBMaxLat .
|
||||||
|
?spatialRegionBox aoprop:boxMaxLon ?spatialLocationBBMaxLon .
|
||||||
|
?spatialRegionBox aoprop:boxMinLat ?spatialLocationBBMinLat .
|
||||||
|
?spatialRegionBox aoprop:boxMinLon ?spatialLocationBBMinLon .
|
||||||
|
%record aoprop:uri ?temporal .
|
||||||
|
?temporal aoprop:periodName ?temporalPeriodName .
|
||||||
|
?temporal aoprop:from ?temporalFrom .
|
||||||
|
?temporal aoprop:until ?temporalUntil .
|
||||||
|
%record aoprop:uri ?temporalNative .
|
||||||
|
?temporalNative aoprop:periodName ?temporalNativePeriodName .
|
||||||
|
%record aoprop:archeologicalResourceType ?archeologicalResourceType .
|
||||||
|
?archeologicalResourceType aoprop:name ?archeologicalResourceTypeName .
|
||||||
|
%record aoprop:resourceType ?resourceType .
|
||||||
|
%record aoprop:nativeSubject ?nativeSubject .
|
||||||
|
?nativeSubject aoprop:prefLabel ?nativeSubjectPrefLabel .
|
||||||
|
?nativeSubject aoprop:rdfAbout ?nativeSubject .
|
||||||
|
%record aoprop:derivedSubject ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:prefLabel ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:source "Getty AAT" .
|
||||||
|
%record aoprop:aatSubjects ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:id ?derivedSubject .
|
||||||
|
?derivedSubject aoprop:label ?derivedSubjectPrefLabel .
|
||||||
|
?derivedSubject aoprop:lang ?aatSubjectsLang .
|
||||||
|
%record aoprop:title ?title .
|
||||||
|
%record aoprop:description ?description .
|
||||||
|
%record aoprop:language ?language .
|
||||||
|
}
|
||||||
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::aat>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::aatplus>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodo>
|
||||||
|
from <https://ariadne-infrastructure.eu/ariadneplus::%datasource::periodoplus>
|
||||||
|
from <https://ariadne-infrastructure.eu/api_________::ariadne_plus::%datasource::%collectionId>
|
||||||
|
where {
|
||||||
|
%record aocat:has_language / skos:prefLabel ?language .
|
||||||
|
%record aocat:has_original_id ?originalId .
|
||||||
|
%record aocat:is_part_of ?partOf .
|
||||||
|
%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_native_subject ?nativeSubject .
|
||||||
|
?nativeSubject skos:prefLabel ?nativeSubjectPrefLabel .
|
||||||
|
optional {
|
||||||
|
%record aocat:has_derived_subject ?derivedSubject .
|
||||||
|
?derivedSubject skos:prefLabel ?derivedSubjectPrefLabel .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?creator aocat:has_email ?creatorEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_description ?description .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_access_policy / rdfs:label ?accessPolicy .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_landing_page / rdfs:label ?landingPage .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_temporal_coverage ?temporalNative .
|
||||||
|
?temporalNative aocat:has_native_period / skos:prefLabel ?temporalNativePeriodName .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_temporal_coverage ?temporal .
|
||||||
|
?temporal aocat:has_period / skos:prefLabel ?temporalPeriodName .
|
||||||
|
optional {
|
||||||
|
?temporal aocat:from ?temporalFrom .
|
||||||
|
?temporal aocat:until ?temporalUntil .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
select *
|
||||||
|
where {
|
||||||
|
%record aocat:is_part_of ?collection .
|
||||||
|
%record aocat:was_issued ?issued .
|
||||||
|
%record aocat:was_modified ?modified .
|
||||||
|
%record aocat:has_contributor ?contributor .
|
||||||
|
?contributor aocat:has_name ?contributorName .
|
||||||
|
%record aocat:has_responsible ?legalResponsible .
|
||||||
|
?legalResponsible aocat:has_name ?legalResponsibleName .
|
||||||
|
%record aocat:has_owner ?owner .
|
||||||
|
?owner aocat:has_name ?ownerName .
|
||||||
|
%record aocat:has_publisher ?publisher .
|
||||||
|
?publisher aocat:has_name ?publisherName .
|
||||||
|
%record aocat:has_access_rights ?accessRights .
|
||||||
|
%record aocat:has_ARIADNE_subject ?archeologicalResourceType .
|
||||||
|
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
|
||||||
|
optional {
|
||||||
|
?contributor aocat:has_email ?contributorEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?legalResponsible aocat:has_email ?legalResponsibleEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?owner aocat:has_email ?ownerEmail .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
?publisher aocat:has_email ?publisherEmail .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
select *
|
||||||
|
where {
|
||||||
|
%record aocat:has_spatial_coverage ?spatialRegion .
|
||||||
|
?spatialRegion aocat:has_place_name ?spatialPlaceName .
|
||||||
|
optional {
|
||||||
|
?spatialRegion aocat:has_coordinate_system ?spatialCoordinateSystem .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_spatial_coverage ?spatialRegionPoint .
|
||||||
|
?spatialRegionPoint aocat:has_latitude ?spatialLocationLat ;
|
||||||
|
aocat:has_longitude ?spatialLocationLon .
|
||||||
|
}
|
||||||
|
optional {
|
||||||
|
%record aocat:has_spatial_coverage ?spatialRegionBox .
|
||||||
|
?spatialRegionBox aocat:has_bounding_box_max_lat ?spatialLocationBBMaxLat ;
|
||||||
|
aocat:has_bounding_box_max_lon ?spatialLocationBBMaxLon ;
|
||||||
|
aocat:has_bounding_box_min_lat ?spatialLocationBBMinLat ;
|
||||||
|
aocat:has_bounding_box_min_lon ?spatialLocationBBMinLon ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BIND (lang(?derivedSubjectPrefLabel) as ?aatSubjectsLang)
|
||||||
|
}
|
|
@ -1,106 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55TypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP7i_is_software_object_hosted_by ?host .
|
|
||||||
<${subjectURL}> crmpe:PP32i_is_curated_by ?curatingService .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP17_has_snapshot ?snapshot1 .
|
|
||||||
<${subjectURL}> crmpe:PP17i_is_snapshot_of ?snapshot2 .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP21_has_software_part ?sw1 .
|
|
||||||
<${subjectURL}> crmpe:PP21i_is_software_part_of ?sw2 .
|
|
||||||
<${subjectURL}> crmpe:PP22_has_release ?sw3 .
|
|
||||||
<${subjectURL}> crmpe:PP22i_is_release_of ?sw4 .
|
|
||||||
|
|
||||||
<${subjectURL}> <usedby> ?adopter .
|
|
||||||
<${subjectURL}> <creationtime> ?creationtime .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crmdig:D14_Software .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55Type .
|
|
||||||
?e55Type rdfs:label ?e55TypeLabel .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
}
|
|
||||||
UNION{<${subjectURL}> crmpe:PP7i_is_software_object_hosted_by ?host . }
|
|
||||||
UNION{?host crmpe:PP7_hosts_software_object <${subjectURL}> . }
|
|
||||||
UNION{<${subjectURL}> crmpe:PP32i_is_curated_by ?curatingService .}
|
|
||||||
UNION{?curatingService crmpe:PP32_curates <${subjectURL}> .}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crmpe:PP32i_is_curated_by ?curatingService .
|
|
||||||
?curatingService crmpe:PP31_uses_curation_plan ?curationplan .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
?curatingService crmpe:PP32_curates <${subjectURL}> .
|
|
||||||
?curatingService crmpe:PP31_uses_curation_plan ?curationplan .
|
|
||||||
}
|
|
||||||
UNION{<${subjectURL}> crmpe:PP17_has_snapshot ?snapshot1 .}
|
|
||||||
UNION{ ?snapshot1 crmpe:PP17i_is_snapshot_of <${subjectURL}> .}
|
|
||||||
UNION{<${subjectURL}> crmpe:PP17i_is_snapshot_of ?snapshot2 .}
|
|
||||||
UNION{ ?snapshot2 crmpe:PP17_has_snapshot <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{<${subjectURL}> crmpe:PP21_has_software_part ?sw1 .}
|
|
||||||
UNION{?sw1 crmpe:PP21i_is_software_part_of <${subjectURL}>.}
|
|
||||||
|
|
||||||
UNION{ ?sw2 crmpe:PP21_has_software_part <${subjectURL}> .}
|
|
||||||
UNION{<${subjectURL}> crmpe:PP21i_is_software_part_of ?sw2 .}
|
|
||||||
|
|
||||||
UNION{<${subjectURL}> crmpe:PP22_has_release ?sw3 .}
|
|
||||||
UNION{?sw3 crmpe:PP22i_is_release_of <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{<${subjectURL}> crmpe:PP22i_is_release_of ?sw4 .}
|
|
||||||
UNION{?sw4 crmpe:PP22_has_release <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{
|
|
||||||
?adopter crm:P94i_was_created_by ?event .
|
|
||||||
?event crmdig:L23_used_software_or_firmware <${subjectURL}> .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmdig:L23i_was_software_or_firmware_used_by ?event .
|
|
||||||
?adopter crm:P94i_was_created_by ?event .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?event1 .
|
|
||||||
?event1 crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/creation> .
|
|
||||||
?event1 crm:P4_has_time-span ?timespan .
|
|
||||||
?timespan crm:P81_ongoing_throughout ?creationtime .
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LIMIT 1000
|
|
|
@ -1,51 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55TypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> <usedby> ?adopter .
|
|
||||||
<${subjectURL}> <creationtime> ?creationtime .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crm:E29_Design_or_Procedure .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55Type .
|
|
||||||
?e55Type rdfs:label ?e55TypeLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
?adopter crmpe:PP31_uses_curation_plan <${subjectURL}> .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?event1 .
|
|
||||||
?event1 crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/creation> .
|
|
||||||
?event1 crm:P4_has_time-span ?timespan .
|
|
||||||
?timespan crm:P81_ongoing_throughout ?creationtime .
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55TypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P107_has_current_or_former_member ?member1 .
|
|
||||||
<${subjectURL}> crm:P107i_is_current_or_former_member_of ?team .
|
|
||||||
<${subjectURL}> crmpe:PP2i_provides ?service .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP44i_is_maintaining_team_of ?maintained .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crm:E39_Actor .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{ <${subjectURL}> crm:P3_has_note ?description .}
|
|
||||||
UNION{ <${subjectURL}> rdfs:label ?label .}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55Type .
|
|
||||||
?e55Type rdfs:label ?e55TypeLabel .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P76_has_contact_point ?contactpoint .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .
|
|
||||||
}
|
|
||||||
UNION{ <${subjectURL}> crm:P107_has_current_or_former_member ?member1 .}
|
|
||||||
UNION{ ?member1 crm:P107_has_current_or_former_member <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crm:P107i_is_current_or_former_member_of ?team .}
|
|
||||||
UNION{ ?team crm:P107_has_current_or_former_member <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP2i_provides ?service .}
|
|
||||||
UNION{ ?service crmpe:PP2_provided_by <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP44i_is_maintaining_team_of ?maintained .}
|
|
||||||
UNION{ ?maintained crmpe:PP44_has_maintaining_team <${subjectURL}> .}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55TypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P46_is_composed_of ?Col_Part .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP4i_is_object_hosted_by ?host_serv .
|
|
||||||
<${subjectURL}> crmpe:PP32i_is_curated_by ?curator .
|
|
||||||
<${subjectURL}> <creator> ?creator .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P72_has_language ?languageLabel .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crm:E78_Collection .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55Type .
|
|
||||||
?e55Type rdfs:label ?e55TypeLabel .
|
|
||||||
}
|
|
||||||
UNION{ <${subjectURL}> crm:P46_is_composed_of ?Col_Part .}
|
|
||||||
UNION{ ?Col_Part crm:P46i_forms_part_of <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP4i_is_object_hosted_by ?host_serv .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP32i_is_curated_by ?curator .}
|
|
||||||
UNION{ ?host_serv crmpe:PP4_hosts_object <${subjectURL}> .}
|
|
||||||
UNION{ ?curator crmpe:PP32_curates <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?Creation_event .
|
|
||||||
?Creation_event crm:P14_carried_out_by ?creator .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P72_has_language ?language .
|
|
||||||
?language rdfs:label ?languageLabel .
|
|
||||||
}
|
|
||||||
|
|
||||||
} LIMIT 30000
|
|
|
@ -1,138 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55TypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP8i_is_dataset_hosted_by ?host .
|
|
||||||
<${subjectURL}> crmpe:PP32i_is_curated_by ?curator .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P106i_forms_part_of ?container .
|
|
||||||
<${subjectURL}> crm:P106_is_composed_of ?d3 .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP39_is_metadata_for ?anotherdataset .
|
|
||||||
<${subjectURL}> crmpe:PP39i_has_metadata ?metadata .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP17i_is_snapshot_of ?snapshotted .
|
|
||||||
<${subjectURL}> crmpe:PP17_has_snapshot ?snapshot .
|
|
||||||
|
|
||||||
<${subjectURL}> <encoding> ?encoding_label .
|
|
||||||
<${subjectURL}> <used_software> ?sw .
|
|
||||||
<${subjectURL}> <creator> ?creator .
|
|
||||||
<${subjectURL}> <creationtime> ?creationtime .
|
|
||||||
<${subjectURL}> <updatetime> ?updatetime .
|
|
||||||
<${subjectURL}> <custodytime> ?custodytime .
|
|
||||||
<${subjectURL}> <custodialhistorynote> ?custodialhistoryNote .
|
|
||||||
<${subjectURL}> <curationtime> ?curationtime .
|
|
||||||
<${subjectURL}> crm:P72_has_language ?languageLabel .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crmpe:PE18_Dataset .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P129_is_about ?about .
|
|
||||||
?about a ?aboutType .
|
|
||||||
?about rdfs:label ?aboutLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P2_has_type ?e55Type .
|
|
||||||
?e55Type rdfs:label ?e55TypeLabel .
|
|
||||||
}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP8i_is_dataset_hosted_by ?host . }
|
|
||||||
UNION{ ?host crmpe:PP8_hosts_dataset <${subjectURL}> . }
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP32i_is_curated_by ?curator .}
|
|
||||||
UNION{ ?curator crmpe:PP32_curates <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP32i_is_curated_by ?curator .}
|
|
||||||
UNION{ ?curator crmpe:PP32_curates <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP31_uses_curation_plan ?curationplan .}
|
|
||||||
UNION{ <${subjectURL}> crm:P106i_forms_part_of ?container .}
|
|
||||||
UNION{ ?container crm:P106_is_composed_of <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crm:P106_is_composed_of ?d3 .}
|
|
||||||
UNION{ ?d3 crm:P106i_forms_part_of <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP39_is_metadata_for ?anotherdataset .}
|
|
||||||
UNION{ ?anotherdataset crmpe:PP39i_has_metadata <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP39i_has_metadata ?metadata .}
|
|
||||||
UNION{ ?metadata crmpe:PP39_is_metadata_for <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP17_has_snapshot ?snapshot .}
|
|
||||||
UNION{ ?snapshot crmpe:PP17i_is_snapshot_of <${subjectURL}> .}
|
|
||||||
UNION{ <${subjectURL}> crmpe:PP17i_is_snapshot_of ?snapshotted .}
|
|
||||||
UNION{ ?snapshotted crmpe:PP17_has_snapshot <${subjectURL}> .}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?Creation_event .
|
|
||||||
?Creation_event crm:P33_used_specific_technique ?technique .
|
|
||||||
?technique crm:P2_has_type ?techniquetype .
|
|
||||||
?techniquetype rdfs:label ?encoding_label .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?Creation_event .
|
|
||||||
?Creation_event crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/creation> .
|
|
||||||
?Creation_event crmdig:L23_used_software_or_firmware ?sw .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?Creation_event .
|
|
||||||
?Creation_event crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/creation> .
|
|
||||||
?Creation_event crm:P14_carried_out_by ?creator .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?event1 .
|
|
||||||
?event1 crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/creation> .
|
|
||||||
?event1 crm:P4_has_time-span ?timespan .
|
|
||||||
?timespan crm:P81_ongoing_throughout ?creationtime .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?updateEvent .
|
|
||||||
?updateEvent crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/update> .
|
|
||||||
?updateEvent crm:P4_has_time-span ?timespanUpdate .
|
|
||||||
?timespanUpdate crm:P82_at_some_time_within ?updatetime .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?custodialhistory .
|
|
||||||
?custodialhistory crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/custodialhistory> .
|
|
||||||
?custodialhistory crm:P3_has_note ?custodialhistoryNote .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P94i_was_created_by ?custodialhistory .
|
|
||||||
?custodialhistory crm:P2_has_type <http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/eventtype/custodialhistory> .
|
|
||||||
?custodialhistory crm:P4_has_time-span ?timespanCustody .
|
|
||||||
?timespanCustody crm:P82_at_some_time_within ?custodytime .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> ?hasCurationActivity ?curationActivity .
|
|
||||||
?curationActivity a crm:E87_Curation_Activity .
|
|
||||||
?curationActivity crm:P4_has_time-span ?curationActivitytimespan .
|
|
||||||
?curationActivitytimespan crm:P82_at_some_time_within ?curationtime .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P72_has_language ?language .
|
|
||||||
?language rdfs:label ?languageLabel .
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
<${subjectURL}> crm:P2_has_type ?atypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider crm:P1_is_identified_by ?providerTitle .
|
|
||||||
?provider rdfs:label ?providerLabel .
|
|
||||||
?provider crm:P3_has_note ?providerDescr .
|
|
||||||
?provider crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP4_hosts_object ?object .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP28_has_designated_access_point ?accesspoint .
|
|
||||||
<${subjectURL}> crmpe:PP1i_is_currently_offered_by ?offerer .
|
|
||||||
<${subjectURL}> crmpe:PP45_has_competency ?competenceLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP31_uses_curation_plan ?curationplan .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP29_uses_access_protocol ?protocol .
|
|
||||||
?protocol rdfs:label ?protocolLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP32_curates ?object2 .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP15_delivers_on_request ?delivered .
|
|
||||||
<${subjectURL}> crmpe:PP14_runs_on_request ?ran .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP42_has_declarative_time ?declTime .
|
|
||||||
|
|
||||||
<${subjectURL}> <availability> ?availabilityLabel .
|
|
||||||
<${subjectURL}> <activitytype> ?activitytypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P16_used_specific_object ?Conditions_of_Use .
|
|
||||||
?Conditions_of_Use a crm:E30_Right .
|
|
||||||
?Conditions_of_Use crm:P3_has_note ?Conditions_of_Use_Note .
|
|
||||||
?Conditions_of_Use crm:P2_has_type ?Conditions_of_Use_Type .
|
|
||||||
?Conditions_of_Use_Type rdfs:label ?Conditions_of_Use_Type_label .
|
|
||||||
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crmpe:PE1_Service .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
FILTER NOT EXISTS { ?titleRes a crm:E51_Contact_Point }
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P2_has_type ?atype .
|
|
||||||
?atype rdfs:label ?atypeLabel .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P2_has_type ?availability .
|
|
||||||
?availability rdfs:label ?availabilityLabel .
|
|
||||||
FILTER(STRSTARTS(STR(?availability), "http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/availabilitytype"))
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crm:P2_has_type ?activitytype .
|
|
||||||
?activitytype rdfs:label ?activitytypeLabel .
|
|
||||||
FILTER(STRSTARTS(STR(?activitytype), "http://ariadneplus.d4science.org/handle/AriadnePlus/REG/Concept/activitytype"))
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider crm:P1_is_identified_by ?providerTitleRes .
|
|
||||||
?providerTitleRes rdfs:label ?providerTitle .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider crm:P3_has_note ?providerDescr .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider rdfs:label ?providerLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP2_provided_by ?provider .
|
|
||||||
?provider crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP28_has_designated_access_point ?accesspoint .}
|
|
||||||
UNION { ?accesspoint crmpe:PP28i_is_designated_access_point_of <${subjectURL}> .}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP1i_is_currently_offered_by ?offerer .}
|
|
||||||
UNION { ?offerer crmpe:PP1_currently_offers <${subjectURL}> .}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP45_has_competency ?competence .
|
|
||||||
?competence rdfs:label ?competenceLabel .}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP4_hosts_object ?object .}
|
|
||||||
UNION { ?object crmpe:PP4i_is_object_hosted_by <${subjectURL}> .}
|
|
||||||
|
|
||||||
UNION {<${subjectURL}> crmpe:PP31_uses_curation_plan ?curationplan .}
|
|
||||||
UNION { ?curationplan crmpe:PP31i_is_curation_plan_used_by <${subjectURL}> .}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP29_uses_access_protocol ?protocol .
|
|
||||||
?protocol rdfs:label ?protocolLabel .}
|
|
||||||
UNION {
|
|
||||||
?protocol crmpe:PP29i_is_access_protocol_used_by <${subjectURL}> .
|
|
||||||
?protocol rdfs:label ?protocolLabel .}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP32_curates ?object2 .}
|
|
||||||
UNION { ?object2 crmpe:PP32i_is_curated_by <${subjectURL}> .}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP15_delivers_on_request ?delivered .}
|
|
||||||
UNION { ?delivered crmpe:PP15i_is_delivered_by <${subjectURL}>.}
|
|
||||||
UNION { <${subjectURL}> crmpe:PP14_runs_on_request ?ran .}
|
|
||||||
UNION { ?ran crmpe:PP14i_is_run_by <${subjectURL}>.}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crmpe:PP42_has_declarative_time ?declTime .}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P16_used_specific_object ?Conditions_of_Use .
|
|
||||||
?Conditions_of_Use a crm:E30_Right .
|
|
||||||
?Conditions_of_Use crm:P3_has_note ?Conditions_of_Use_Note .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P16_used_specific_object ?Conditions_of_Use .
|
|
||||||
?Conditions_of_Use a crm:E30_Right .
|
|
||||||
?Conditions_of_Use crm:P2_has_type ?Conditions_of_Use_Type .
|
|
||||||
?Conditions_of_Use_Type rdfs:label ?Conditions_of_Use_Type_label .
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
DEFINE input:inference 'ariadneplus_rules'
|
|
||||||
|
|
||||||
CONSTRUCT {
|
|
||||||
<${subjectURL}> rdfs:label ?label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P102_has_title ?title .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P3_has_note ?description .
|
|
||||||
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP1_currently_offers ?offeredservice .
|
|
||||||
|
|
||||||
<${subjectURL}> crmpe:PP44_has_maintaining_team ?team .
|
|
||||||
?team crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .
|
|
||||||
|
|
||||||
<${subjectURL}> crm:P4_has_time-span ?time_span .
|
|
||||||
?time_span crm:P82a_begin_of_the_begin ?time_actual .
|
|
||||||
}
|
|
||||||
WHERE {
|
|
||||||
<${subjectURL}> a crmpe:PE35_Project .
|
|
||||||
<${subjectURL}> a ?type .
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?IDRes .
|
|
||||||
?IDRes a crm:E42_Identifier .
|
|
||||||
?IDRes rdfs:label ?ID_label .
|
|
||||||
}
|
|
||||||
UNION
|
|
||||||
{
|
|
||||||
<${subjectURL}> crm:P1_is_identified_by ?titleRes .
|
|
||||||
?titleRes a crm:E41_Appellation .
|
|
||||||
?titleRes rdfs:label ?title .
|
|
||||||
}
|
|
||||||
UNION{ <${subjectURL}> crm:P3_has_note ?description .}
|
|
||||||
UNION{ <${subjectURL}> rdfs:label ?label .}
|
|
||||||
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crmpe:PP1_currently_offers ?offeredservice .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crmpe:PP44_has_maintaining_team ?team .
|
|
||||||
}
|
|
||||||
UNION{
|
|
||||||
<${subjectURL}> crmpe:PP44_has_maintaining_team ?team .
|
|
||||||
?team crm:P76_has_contact_point ?contactpoint .
|
|
||||||
?contactpoint crm:P2_has_type ?contactpointType .
|
|
||||||
?contactpoint rdfs:label ?contactpointLabel .
|
|
||||||
?contactpointType rdfs:label ?contactpointTypeLabel .
|
|
||||||
}
|
|
||||||
UNION {
|
|
||||||
<${subjectURL}> crm:P4_has_time-span ?time_span .
|
|
||||||
?time_span crm:P82a_begin_of_the_begin ?time_actual .
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
To check available rules: SELECT * from DB.DBA.SYS_RDF_SCHEMA;
|
|
||||||
|
|
||||||
#### ARIADNEPLUS RULES ####
|
|
||||||
|
|
||||||
### ORIGINAL WITH OFFICIALLY PUBLISHED SCHEMAS
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
sparql load <http://www.cidoc-crm.org/sites/default/files2/cidoc_crm_v6.2-draft-2015August.rdfs> into <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://www.cidoc-crm.org/cidoc-crm/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/>;
|
|
||||||
sparql load <http://www.ics.forth.gr/isl/CRMext/CRMdig_v3.2.2.rdfs> into <http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/>;
|
|
||||||
sparql load <http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs> into <http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/') ;
|
|
||||||
|
|
||||||
|
|
||||||
### USING SCHEMAS AVAILABLE FROM THE WORKSPACE
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
sparql load <http://data.d4science.org/RUhKNlY3Q3RqaWRlcS9seFFpKy9SWFRQMTZ2UmF0U3FHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://www.cidoc-crm.org/cidoc-crm/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/>;
|
|
||||||
sparql load <http://www.ics.forth.gr/isl/CRMext/CRMdig_v3.2.2.rdfs> into <http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/>;
|
|
||||||
sparql load <http://data.d4science.org/dytWdlJiamw1cVZvQXZGSWUvc283L280RDNwSVRVZjZHbWJQNStIS0N6Yz0> into <http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/>;
|
|
||||||
rdfs_rule_set ('ariadneplus_rules', 'http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/') ;
|
|
||||||
|
|
||||||
#### EXTENDED RULES ####
|
|
||||||
|
|
||||||
# CRMext4SKOSandLabel_v1.4___23-03-2016180729___3031___20-09-2016163145___12893.rdfs
|
|
||||||
sparql load <http://data.d4science.org/TVJTdXh0dFBUR2RlcS9seFFpKy9SZnVXcHlzYU5sT0dHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
# CRMpc_v1.1.1.rdfs
|
|
||||||
sparql load <http://data.d4science.org/MmJQM1J5czhzODllcS9seFFpKy9SUVR0aW0yZ0NFT1dHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/>;
|
|
||||||
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.cidoc-crm.org/cidoc-crm/') ;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/') ;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <https://vocabs.dariah.eu/bbt/>;
|
|
||||||
sparql load <http://data.d4science.org/RUhKNlY3Q3RqaWRlcS9seFFpKy9SWmUyOEgvYytSZnJHbWJQNStIS0N6Yz0> into <https://vocabs.dariah.eu/bbt/>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'https://vocabs.dariah.eu/bbt/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.cidoc-crm.org/cidoc-crm/CRMarchaeo/>;
|
|
||||||
sparql load <http://data.d4science.org/dkc2d000OGhDZVZlcS9seFFpKy9SVlVJZkl5YlNWeTRHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/CRMarchaeo/>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.cidoc-crm.org/cidoc-crm/CRMarchaeo/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.cidoc-crm.org/cidoc-crm/CRMgeo/>;
|
|
||||||
sparql load <http://data.d4science.org/TVJTdXh0dFBUR2RlcS9seFFpKy9SWEpWSW5xRnZvT2lHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/CRMgeo/>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.cidoc-crm.org/cidoc-crm/CRMgeo/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.cidoc-crm.org/cidoc-crm/CRMsci/>;
|
|
||||||
sparql load <http://data.d4science.org/TElzU0lmS3JVN3RlcS9seFFpKy9SY1EzcCt4VEw1NkdHbWJQNStIS0N6Yz0> into <http://www.cidoc-crm.org/cidoc-crm/CRMsci/>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.cidoc-crm.org/cidoc-crm/CRMsci/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://iflastandards.info/ns/fr/frbr/frbroo/>;
|
|
||||||
sparql load <http://data.d4science.org/TElzU0lmS3JVN3RlcS9seFFpKy9SUUpxYzlFZVFxaXlHbWJQNStIS0N6Yz0> into <http://iflastandards.info/ns/fr/frbr/frbroo/>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://iflastandards.info/ns/fr/frbr/frbroo/') ;
|
|
||||||
|
|
||||||
SPARQL CLEAR GRAPH <http://www.w3.org/2004/02/skos/core#>;
|
|
||||||
sparql load <http://data.d4science.org/OVVnSXpCMjdJTlplcS9seFFpKy9SYlFaZkJnNGgvUVpHbWJQNStIS0N6Yz0> into <http://www.w3.org/2004/02/skos/core#>;
|
|
||||||
rdfs_rule_set ('extended_rules', 'http://www.w3.org/2004/02/skos/core#') ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package eu.dnetlib.ariadneplus;
|
||||||
|
|
||||||
|
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
||||||
|
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.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author enrico.ottonello
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GraphDbReaderAndESIndexTest {
|
||||||
|
|
||||||
|
private RunSPARQLQueryService runSPQRLQuery;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
// @Ignore
|
||||||
|
public void readAndIndexTest() throws Exception {
|
||||||
|
final ClassPathResource resource = new ClassPathResource("application.properties");
|
||||||
|
Properties appProps = new Properties();
|
||||||
|
appProps.load(resource.getInputStream());
|
||||||
|
|
||||||
|
runSPQRLQuery = new RunSPARQLQueryService();
|
||||||
|
runSPQRLQuery.setupConnection(
|
||||||
|
appProps.getProperty("graphdb.writer.user"),
|
||||||
|
appProps.getProperty("graphdb.writer.pwd"),
|
||||||
|
appProps.getProperty("graphdb.serverUrl"),
|
||||||
|
appProps.getProperty("graphdb.repository"));
|
||||||
|
ParseRDFJSON parseRDFJSON = new ParseRDFJSON();
|
||||||
|
parseRDFJSON.setCatalogEntryJsonPath(appProps.getProperty("catalog.entry.path"));
|
||||||
|
runSPQRLQuery.setParser(parseRDFJSON);
|
||||||
|
ResourceManager resourceManager = new ResourceManager();
|
||||||
|
resourceManager.setup(
|
||||||
|
appProps.getProperty("type.path"),
|
||||||
|
appProps.getProperty("general.classpath"),
|
||||||
|
appProps.getProperty("exclude.predicates"),
|
||||||
|
appProps.getProperty("class.map.specifications")
|
||||||
|
);
|
||||||
|
runSPQRLQuery.setResourceManager(resourceManager);
|
||||||
|
BulkUpload bulkUpload = new BulkUpload();
|
||||||
|
bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname"));
|
||||||
|
runSPQRLQuery.setBulkUpload(bulkUpload);
|
||||||
|
String recordId = "<https://ariadne-infrastructure.eu/aocat/Resource/C6D951BA-069B-3E39-B93C-9BAE2C48B280>";
|
||||||
|
String datasource = "ads";
|
||||||
|
String collectionId = "271";
|
||||||
|
List<String> recordIds = Arrays.asList(recordId);
|
||||||
|
final ClassPathResource queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||||
|
String queryTemplate = IOUtils.toString(queryTemplateResource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
runSPQRLQuery.executeMultipleQueryGraph(queryTemplate, recordIds, datasource, collectionId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void selectRecordsTest() throws Exception {
|
||||||
|
final ClassPathResource resource = new ClassPathResource("application.properties");
|
||||||
|
Properties appProps = new Properties();
|
||||||
|
appProps.load(resource.getInputStream());
|
||||||
|
String datasource = "ads";
|
||||||
|
String collectionId = "271";
|
||||||
|
runSPQRLQuery = new RunSPARQLQueryService();
|
||||||
|
runSPQRLQuery.setupConnection(
|
||||||
|
appProps.getProperty("graphdb.writer.user"),
|
||||||
|
appProps.getProperty("graphdb.writer.pwd"),
|
||||||
|
appProps.getProperty("repository.url"),
|
||||||
|
appProps.getProperty("graphdb.repository"));
|
||||||
|
runSPQRLQuery.selectRecordIds(datasource, collectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void loadQueryTest() throws Exception {
|
||||||
|
final ClassPathResource resource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||||
|
String queryTemplate = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
System.out.println(queryTemplate);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,40 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package eu.dnetlib.ariadneplus;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.JUnit4;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.RunSPARQLQueryService;
|
|
||||||
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author enrico.ottonello
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@RunWith(JUnit4.class)
|
|
||||||
public class GraphDbReaderTest {
|
|
||||||
@Autowired
|
|
||||||
private RunSPARQLQueryService runSPQRLQuery;
|
|
||||||
@Autowired
|
|
||||||
private ParseRDFJSON parser;
|
|
||||||
@Autowired
|
|
||||||
private ResourceManager resourceManager;
|
|
||||||
@Autowired
|
|
||||||
private BulkUpload bulkUpload;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void readTest() throws Exception {
|
|
||||||
|
|
||||||
runSPQRLQuery.setParser(parser);
|
|
||||||
runSPQRLQuery.setResourceManager(resourceManager);
|
|
||||||
runSPQRLQuery.setBulkUpload(bulkUpload);
|
|
||||||
runSPQRLQuery.executeQueryGraph();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
package eu.dnetlib.ariadneplus.workflows.nodes;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import eu.dnetlib.enabling.resultset.client.ResultSetClient;
|
||||||
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
||||||
|
import eu.dnetlib.msro.workflows.nodes.AsyncJobNode;
|
||||||
|
import eu.dnetlib.msro.workflows.procs.Env;
|
||||||
|
import eu.dnetlib.msro.workflows.procs.Token;
|
||||||
|
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
|
||||||
|
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
|
||||||
|
import eu.dnetlib.rmi.common.ResultSet;
|
||||||
|
import eu.dnetlib.rmi.manager.MSROException;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class IndexOnESJobNode extends AsyncJobNode {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(IndexOnESJobNode.class);
|
||||||
|
|
||||||
|
private String eprParam;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResultSetClient resultSetClient;
|
||||||
|
|
||||||
|
private String publisherEndpoint;
|
||||||
|
private String datasourceInterface;
|
||||||
|
private String datasource;
|
||||||
|
|
||||||
|
//for parallel requests to the publisher endpoint
|
||||||
|
private int nThreads = 5;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String execute(final Env env) throws Exception {
|
||||||
|
|
||||||
|
int statusCode = -1;
|
||||||
|
String indexOnESResult = "noResult";
|
||||||
|
log.info("Publisher endpoint: " + getPublisherEndpoint());
|
||||||
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
|
cm.setMaxTotal(nThreads);
|
||||||
|
CloseableHttpClient client = HttpClients.custom().setConnectionManager(cm).build();
|
||||||
|
|
||||||
|
log.info("IndexOnES endpoint: " + getIndexOnESEndpoint());
|
||||||
|
CloseableHttpResponse responsePOST = null;
|
||||||
|
try {
|
||||||
|
HttpPost post = new HttpPost(getIndexOnESEndpoint());
|
||||||
|
List<NameValuePair> params = Lists.newArrayList();
|
||||||
|
String[] splits = getDatasourceInterface().split("::");
|
||||||
|
String datasource = splits[2];
|
||||||
|
String collectionId = splits[3];
|
||||||
|
params.add(new BasicNameValuePair("datasource", datasource));
|
||||||
|
params.add(new BasicNameValuePair("collectionId", collectionId));
|
||||||
|
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params, "UTF-8");
|
||||||
|
post.setEntity(ent);
|
||||||
|
log.info("Calling IndexOnES endpoint with params: "+getDatasource()+" "+getDatasourceInterface());
|
||||||
|
responsePOST = client.execute(post);
|
||||||
|
statusCode = responsePOST.getStatusLine().getStatusCode();
|
||||||
|
switch (statusCode) {
|
||||||
|
case 200:
|
||||||
|
log.info("index on ES completed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.error("error indexing on ES " + responsePOST.getStatusLine().getStatusCode() + ": " + responsePOST.getStatusLine().getReasonPhrase());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (ConnectException ce) {
|
||||||
|
log.error(ce);
|
||||||
|
throw new MSROException("Unable to connect to Publisher endpoint" + getIndexOnESEndpoint());
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
log.error(e);
|
||||||
|
throw new MSROException("IO Error" + getIndexOnESEndpoint());
|
||||||
|
}
|
||||||
|
finally{
|
||||||
|
if(responsePOST != null) responsePOST.close();
|
||||||
|
client.close();
|
||||||
|
cm.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "statusCode", Integer.toString(statusCode));
|
||||||
|
env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "enrichResult", indexOnESResult);
|
||||||
|
|
||||||
|
log.info(indexOnESResult);
|
||||||
|
if (statusCode!=200) {
|
||||||
|
throw new MSROException("Error from Publisher endpoint [ status code: " + statusCode + " ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Arc.DEFAULT_ARC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublisherEndpoint() {
|
||||||
|
return publisherEndpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getIndexOnESEndpoint() {
|
||||||
|
return publisherEndpoint.concat("/indexOnES");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublisherEndpoint(final String publisherEndpoint) {
|
||||||
|
this.publisherEndpoint = publisherEndpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultSetClient getResultSetClient() {
|
||||||
|
return resultSetClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResultSetClient(final ResultSetClient resultSetClient) {
|
||||||
|
this.resultSetClient = resultSetClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEprParam() {
|
||||||
|
return eprParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEprParam(String eprParam) {
|
||||||
|
this.eprParam = eprParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatasourceInterface() {
|
||||||
|
return datasourceInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setDatasourceInterface(String datasourceInterface) {
|
||||||
|
this.datasourceInterface = datasourceInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void beforeStart(Token token) {
|
||||||
|
token.setProgressProvider(new ResultsetProgressProvider(token.getEnv().getAttribute(getEprParam(), ResultSet.class), this.resultSetClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatasource() {
|
||||||
|
return datasource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatasource(String datasource) {
|
||||||
|
this.datasource = datasource;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,4 +17,6 @@
|
||||||
<bean id="wfNodeEnrichGraphDBContent" class="eu.dnetlib.ariadneplus.workflows.nodes.EnrichGraphDBContentJobNode" scope="prototype"/>
|
<bean id="wfNodeEnrichGraphDBContent" class="eu.dnetlib.ariadneplus.workflows.nodes.EnrichGraphDBContentJobNode" scope="prototype"/>
|
||||||
|
|
||||||
<bean id="wfNodeImportPeriodoIntoGraphDB" class="eu.dnetlib.ariadneplus.workflows.nodes.ImportPeriodoIntoGraphDBJobNode" scope="prototype"/>
|
<bean id="wfNodeImportPeriodoIntoGraphDB" class="eu.dnetlib.ariadneplus.workflows.nodes.ImportPeriodoIntoGraphDBJobNode" scope="prototype"/>
|
||||||
|
|
||||||
|
<bean id="wfNodeIndexOnES" class="eu.dnetlib.ariadneplus.workflows.nodes.IndexOnESJobNode" scope="prototype"/>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<RESOURCE_PROFILE>
|
||||||
|
<HEADER>
|
||||||
|
<RESOURCE_IDENTIFIER value=""/>
|
||||||
|
<RESOURCE_TYPE value="WorkflowDSResourceType"/>
|
||||||
|
<RESOURCE_KIND value="WorkflowDSResources"/>
|
||||||
|
<RESOURCE_URI value=""/>
|
||||||
|
<DATE_OF_CREATION value=""/>
|
||||||
|
</HEADER>
|
||||||
|
<BODY>
|
||||||
|
<WORKFLOW_NAME>$name$</WORKFLOW_NAME>
|
||||||
|
<WORKFLOW_DESCRIPTION>$desc$</WORKFLOW_DESCRIPTION>
|
||||||
|
<WORKFLOW_INFO />
|
||||||
|
<WORKFLOW_FAMILY>aggregator</WORKFLOW_FAMILY>
|
||||||
|
<WORKFLOW_PRIORITY>$priority$</WORKFLOW_PRIORITY>
|
||||||
|
<DATASOURCE id="$dsId$" interface="$interface$" />
|
||||||
|
|
||||||
|
<CONFIGURATION status="WAIT_SYS_SETTINGS" start="MANUAL">
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM name="publisherEndpoint" description="AriadnePlus Publisher Endpoint" required="true" managedBy="user" type="string">http://localhost:8080/ariadneplus/publish</PARAM>
|
||||||
|
</PARAMETERS>
|
||||||
|
<WORKFLOW>
|
||||||
|
<NODE name="IndexOnES" type="LaunchWorkflowTemplate" isStart="true">
|
||||||
|
<DESCRIPTION>Index on Elastic Search all records of a collection from GraphDB</DESCRIPTION>
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM name="wfTemplateId" value="3819eb3d-fdea-4fc3-925f-9ce0f61be9ee_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ=="/>
|
||||||
|
<PARAM name="wfTemplateParams">
|
||||||
|
<MAP>
|
||||||
|
<ENTRY key="dsId" value="$dsId$" />
|
||||||
|
<ENTRY key="dsName" value="$dsName$" />
|
||||||
|
<ENTRY key="interface" value="$interface$" />
|
||||||
|
<ENTRY key="publisherEndpoint" ref="publisherEndpoint" />
|
||||||
|
</MAP>
|
||||||
|
</PARAM>
|
||||||
|
</PARAMETERS>
|
||||||
|
<ARCS>
|
||||||
|
<ARC to="success"/>
|
||||||
|
</ARCS>
|
||||||
|
</NODE>
|
||||||
|
</WORKFLOW>
|
||||||
|
<DESTROY_WORKFLOW_TEMPLATE id="23ef4bb3-2383-45b4-9661-ab03472fcd52_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ==">
|
||||||
|
<PARAMETERS/>
|
||||||
|
</DESTROY_WORKFLOW_TEMPLATE>
|
||||||
|
</CONFIGURATION>
|
||||||
|
|
||||||
|
<NOTIFICATIONS/>
|
||||||
|
|
||||||
|
<SCHEDULING enabled="false">
|
||||||
|
<CRON>9 9 9 ? * *</CRON>
|
||||||
|
<MININTERVAL>10080</MININTERVAL>
|
||||||
|
</SCHEDULING>
|
||||||
|
<STATUS/>
|
||||||
|
</BODY>
|
||||||
|
</RESOURCE_PROFILE>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<RESOURCE_PROFILE>
|
||||||
|
<HEADER>
|
||||||
|
<RESOURCE_IDENTIFIER value="3819eb3d-fdea-4fc3-925f-9ce0f61be9ee_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ=="/>
|
||||||
|
<RESOURCE_TYPE value="WorkflowTemplateDSResourceType"/>
|
||||||
|
<RESOURCE_KIND value="WorkflowTemplateDSResources"/>
|
||||||
|
<RESOURCE_URI value=""/>
|
||||||
|
<DATE_OF_CREATION value="2020-06-16T16:53:35+02:00"/>
|
||||||
|
</HEADER>
|
||||||
|
<BODY>
|
||||||
|
<CONFIGURATION>
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM description="Datasource Name" name="dsName" required="true" type="string"/>
|
||||||
|
<PARAM description="Datasource Id" name="dsId" required="true" type="string"/>
|
||||||
|
<PARAM description="Datasource Interface" name="interface" required="true" type="string"/>
|
||||||
|
<PARAM description="AriadnePlus Publisher Endpoint" name="publisherEndpoint" required="true" type="string">http://localhost:8281/ariadneplus-graphdb</PARAM>
|
||||||
|
</PARAMETERS>
|
||||||
|
<WORKFLOW>
|
||||||
|
<NODE isStart="true" name="indexOnES" type="IndexOnES">
|
||||||
|
<DESCRIPTION>Index on Elastic Search all records of a collection from GraphDB</DESCRIPTION>
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM name="publisherEndpoint" ref="publisherEndpoint"/>
|
||||||
|
<PARAM name="datasourceInterface" ref="interface"/>
|
||||||
|
<PARAM name="datasource" ref="dsName"/>
|
||||||
|
</PARAMETERS>
|
||||||
|
<ARCS>
|
||||||
|
<ARC to="success"/>
|
||||||
|
</ARCS>
|
||||||
|
</NODE>
|
||||||
|
</WORKFLOW>
|
||||||
|
</CONFIGURATION>
|
||||||
|
</BODY>
|
||||||
|
</RESOURCE_PROFILE>
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<RESOURCE_PROFILE>
|
||||||
|
<HEADER>
|
||||||
|
<RESOURCE_IDENTIFIER value="caf5903e-d040-4506-b00c-32db35d0cd59_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl"/>
|
||||||
|
<RESOURCE_TYPE value="WorkflowDSResourceType"/>
|
||||||
|
<RESOURCE_KIND value="WorkflowDSResources"/>
|
||||||
|
<RESOURCE_URI value=""/>
|
||||||
|
<DATE_OF_CREATION value="2020-06-16T12:00:00.0Z"/>
|
||||||
|
</HEADER>
|
||||||
|
<BODY>
|
||||||
|
<WORKFLOW_NAME>Index On ES</WORKFLOW_NAME>
|
||||||
|
<WORKFLOW_DESCRIPTION>Index on Elastic Search all records of a collection from GraphDB</WORKFLOW_DESCRIPTION>
|
||||||
|
<WORKFLOW_INFO>
|
||||||
|
<FIELD name="Action">IndexOnES</FIELD>
|
||||||
|
<FIELD name="Datasource class">Content Provider</FIELD>
|
||||||
|
</WORKFLOW_INFO>
|
||||||
|
<WORKFLOW_FAMILY>REPO_HI</WORKFLOW_FAMILY>
|
||||||
|
<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
|
||||||
|
<CONFIGURATION status="EXECUTABLE" start="MANUAL">
|
||||||
|
<PARAMETERS/>
|
||||||
|
<WORKFLOW>
|
||||||
|
<NODE name="VerifyDatasource" type="VerifyDatasource" isStart="true">
|
||||||
|
<DESCRIPTION>Verify if DS is pending</DESCRIPTION>
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM name="expectedInterfaceTypologyPrefixes" value=""/>
|
||||||
|
<PARAM name="expectedCompliancePrefixes" value="metadata,native"/>
|
||||||
|
</PARAMETERS>
|
||||||
|
<ARCS>
|
||||||
|
<ARC to="registerIndexOnESWf"/>
|
||||||
|
<ARC to="validateDs" name="validateDs"/>
|
||||||
|
</ARCS>
|
||||||
|
</NODE>
|
||||||
|
<NODE name="validateDs" type="ValidateDatasource">
|
||||||
|
<DESCRIPTION>Validate DS</DESCRIPTION>
|
||||||
|
<PARAMETERS/>
|
||||||
|
<ARCS>
|
||||||
|
<ARC to="registerIndexOnESWf"/>
|
||||||
|
</ARCS>
|
||||||
|
</NODE>
|
||||||
|
<NODE name="registerIndexOnESWf" type="RegisterWorkflowFromTemplate">
|
||||||
|
<DESCRIPTION>Create Workflow</DESCRIPTION>
|
||||||
|
<PARAMETERS>
|
||||||
|
<PARAM name="wfName" value="Index On ES"/>
|
||||||
|
<PARAM name="wfTemplate" value="/eu/dnetlib/ariadneplus/workflows/repo-hi/index_on_es_wf.xml.st"/>
|
||||||
|
<PARAM name="description" value="Index on Elastic Search all records of a collection from GraphDB"/>
|
||||||
|
</PARAMETERS>
|
||||||
|
<ARCS>
|
||||||
|
<ARC to="success"/>
|
||||||
|
</ARCS>
|
||||||
|
</NODE>
|
||||||
|
</WORKFLOW>
|
||||||
|
</CONFIGURATION>
|
||||||
|
<NOTIFICATIONS/>
|
||||||
|
<SCHEDULING enabled="false">
|
||||||
|
<CRON>9 9 9 ? * *</CRON>
|
||||||
|
<MININTERVAL>10080</MININTERVAL>
|
||||||
|
</SCHEDULING>
|
||||||
|
<STATUS/>
|
||||||
|
</BODY>
|
||||||
|
</RESOURCE_PROFILE>
|
Loading…
Reference in New Issue