added optional surrounding union conditions, in case all those conditions do not match any statements

This commit is contained in:
Enrico Ottonello 2020-02-11 12:04:45 +01:00
parent 911ea12ac3
commit ae91617d1b
1 changed files with 123 additions and 82 deletions

View File

@ -50,14 +50,38 @@ CONSTRUCT {
#from onto:explain
where {
?record aocat:has_title ?title ;
graph ?g {
#mandatory statements in our model, to be added in all datasources
#?record aocat:has_title ?title ;
# aocat:has_access_rights ?accessRights ;
aocat:has_creator / aocat:has_name ?contributorName ;
aocat:has_creator / aocat:has_email ?contributorEmail ;
aocat:has_spatial_coverage ?spatial ;
aocat:has_native_subject / skos:prefLabel ?nativeSbj ;
aocat:has_original_id ?originalId ;
# aocat:has_creator / aocat:has_name ?contributorName ;
# aocat:has_creator / aocat:has_email ?contributorEmail ;
# aocat:has_native_subject / skos:prefLabel ?nativeSbj ;
# aocat:has_original_id ?originalId ;
?record aocat:has_spatial_coverage ?spatial ;
aocat:has_language / skos:prefLabel ?language .
optional {
{
?record aocat:has_original_id ?originalId .
}
union
{
?record aocat:has_native_subject / skos:prefLabel ?nativeSbj .
}
union
{
?record aocat:has_creator / aocat:has_name ?contributorName .
}
union
{
?record aocat:has_title ?title .
}
union
{
?record aocat:has_creator / aocat:has_email ?contributorEmail .
}
union
{
?record aocat:has_access_rights ?accessRights .
}
@ -92,28 +116,46 @@ where {
?record aocat:has_temporal_coverage ?t .
?t aocat:until ?until .
}
}
{
select *
where {
?collection aocat:has_publisher / rdfs:label ?publisherName ;
aocat:has_ARIADNE_subject ?archeologicalResourceType ;
aocat:was_issued ?issued ;
aocat:has_type / skos:prefLabel ?type .
#mandatory statements in our model, to be added in all datasources
#?collection aocat:has_publisher / rdfs:label ?publisherName ;
# aocat:has_ARIADNE_subject ?archeologicalResourceType ;
# aocat:has_type / skos:prefLabel ?type .
?collection aocat:was_issued ?issued .
optional {
{
?collection aocat:has_publisher / rdfs:label ?publisherName .
}
union
{
?collection aocat:has_ARIADNE_subject ?archeologicalResourceType .
?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
}
union
{
?collection aocat:has_type / skos:prefLabel ?type .
}
}
#?archeologicalResourceType skos:prefLabel ?archeologicalResourceTypeName .
}
}
{
select *
where {
?spatial aocat:has_place_name ?spatialPlaceName .
optional {
{
?spatial aocat:has_place_name ?spatialPlaceName .
?spatial aocat:has_latitude ?spatialLocationLat .
BIND(uri(concat('http://www.myprefix/location/', md5(str(?spatialLocationLat)))) as ?blocation)
}
union
{
?spatial aocat:has_place_name ?spatialPlaceName .
?spatial aocat:has_longitude ?spatialLocationLon .
BIND(uri(concat('http://www.myprefix/location/', md5(str(?spatialLocationLon)))) as ?blocation)
}
@ -123,12 +165,11 @@ where {
aocat:has_longitude ?spatialLocationLon .
BIND(uri(concat('http://www.myprefix/location/', md5(concat(str(?spatialLocationLat), str(?spatialLocationLon))))) as ?blocation)
}
}
}
}
BIND("organization" as ?contributorType) .
BIND("organization" as ?publisherType) .
}
}