Skip to content

Commit

Permalink
Merge pull request #210 from InTaVia/ms/209-new-europeana-data-missin…
Browse files Browse the repository at this point in the history
…g-in-frontend

adapts sparql queries; adds urls to providedIds
  • Loading branch information
sennierer authored Jan 9, 2024
2 parents de3dcdd + 24e06b6 commit f73f79b
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 50 deletions.
2 changes: 1 addition & 1 deletion intavia_backend/models_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def pp_id_provider(field, item, data):
if v["baseUrl"] in it:
data["label"] = v["label"]
if not "label" in data:
data["label"] = it
data["label"] = it.split("/")[2]
res.append(data)
return res

Expand Down
3 changes: 2 additions & 1 deletion intavia_backend/query_parameters_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DatasetsEnum(str, Enum):
SBI = "http://www.intavia.eu/sbi"
CHO_test = "http://data.acdh.oeaw.ac.at/intavia/cho/v6"
CHO_test2 = "http://data.acdh.oeaw.ac.at/intavia/cho/v1"
EDM_test = "http://edm-enrich2023-06-14.intavia.eu"
EDM_test = "http://europeana_2023-10-27.intavia.eu"


class GenderqueryEnum(str, Enum):
Expand Down Expand Up @@ -68,6 +68,7 @@ class Base:
DatasetsEnum.SBI,
DatasetsEnum.CHO_test,
DatasetsEnum.BNet,
DatasetsEnum.EDM_test
],
)

Expand Down
10 changes: 10 additions & 0 deletions intavia_backend/sparql/add_datasets_named_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

FROM <http://www.intavia.eu/idm-classes/>
FROM <http://www.intavia.eu/idm-core/>
FROM <http://www.intavia.eu/graphs/provided_persons>
FROM <http://www.intavia.eu/graphs/provided_groups>
FROM <http://www.intavia.eu/graphs/provided_places>
FROM <http://www.intavia.eu/graphs/provided_cho>
{% for dataset in datasets %}
FROM NAMED <{{dataset.value}}>
{% endfor %}
8 changes: 1 addition & 7 deletions intavia_backend/sparql/bulk_retrieve_events_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
{% include 'prefixes_v2_1.sparql' %}

SELECT ?event ?role ?entity ?event_label ?role_label ?begin ?end ?time_span_label ?role_type ?event_type ?count

Expand Down
3 changes: 3 additions & 0 deletions intavia_backend/sparql/entity_type_bindings_v2_1.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ BIND("place" AS ?entityTypeLabel)
} UNION {
?entity_proxy a idm:CHO_Proxy
BIND("cultural-heritage-object" AS ?entityTypeLabel)
} UNION {
?entity_proxy a idm2:CHO_Proxy
BIND("cultural-heritage-object" AS ?entityTypeLabel)
}
{%- endif -%}
10 changes: 1 addition & 9 deletions intavia_backend/sparql/get_entity_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX bgn: <http://data.biographynet.nl/rdf/>
{% include 'prefixes_v2_1.sparql' %}

SELECT ?entity ?entityType ?entityTypeLabel ?entityLabel ?gender ?genderLabel ?nationalityLabel ?occupation ?occupationLabel
?event ?eventLabel ?role ?roleLabel ?start ?end ?role_type
Expand Down
8 changes: 1 addition & 7 deletions intavia_backend/sparql/get_event_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
{% include 'prefixes_v2_1.sparql' %}

SELECT ?event ?role ?entity ?event_label ?role_label ?begin ?end ?time_span_label ?role_type ?event_type

Expand Down
1 change: 1 addition & 0 deletions intavia_backend/sparql/prefixes_v2_1.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idm2: <https://www.intavia.org/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
Expand Down
5 changes: 3 additions & 2 deletions intavia_backend/sparql/retrieve_entities_v2_1.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OPTIONAL {?entity_proxy crm:P1_is_identified_by ?appellation .
{?appellation a crm:E33_E41_Linguistic_Appellation .} UNION {?appellation a crm:E35_Title}
?appellation rdfs:label ?entityLabelPre .}
OPTIONAL {?entity_proxy bioc:has_occupation ?occupation . ?occupation rdfs:label ?occupationLabel .}
OPTIONAL {?entity_proxy owl:sameAs ?linkedIds}
OPTIONAL {?entity_proxy owl:sameAs ?linkedIdsPre}
OPTIONAL {?entity_proxy bioc:has_gender ?gender
OPTIONAL {?gender rdfs:label ?genderLabel }}
OPTIONAL {?entity_proxy bioc:has_nationality ?nationality . ?nationality rdfs:label ?nationalityLabel .}
Expand All @@ -16,4 +16,5 @@ OPTIONAL {?entity_proxy crm:P168_place_is_defined_by/crm:P168_place_is_defined_b
OPTIONAL {?entity_proxy ^crm:P70_documents ?mediaObject }
OPTIONAL {?entity_proxy idmcore:bio_link ?biographyObject }
OPTIONAL {?entity_proxy ore:proxyIn ?biographyObject . ?biographyObject bgn:hasBioParts ?bioparts . ?bioparts bgn:text ?biotext . FILTER NOT EXISTS { ?bioparts bgn:hasFigure ?fig. } }
BIND(COALESCE(?entityLabelPre, ?defaultEntityLabel) AS ?entityLabel)
BIND(COALESCE(?entityLabelPre, ?defaultEntityLabel) AS ?entityLabel)
BIND(COALESCE(?linkedIdsPre, ?entity_proxy) AS ?linkedIds)
Empty file.
9 changes: 2 additions & 7 deletions intavia_backend/sparql/search_events_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
{% include 'prefixes_v2_1.sparql' %}


SELECT ?event ?role ?entity ?event_label ?role_label ?begin ?end ?time_span_label ?role_type ?event_type ?count

Expand Down
11 changes: 1 addition & 10 deletions intavia_backend/sparql/search_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@

PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX bgn: <http://data.biographynet.nl/rdf/>
{% include 'prefixes_v2_1.sparql' %}

SELECT ?entity ?entityType ?entityTypeLabel ?entityLabel ?gender ?genderLabel ?nationalityLabel ?occupation ?occupationLabel
?event ?linkedIds ?count ?geometry ?role_type (?entity as ?source) ?mediaObject ?biographyObject
Expand Down
7 changes: 1 addition & 6 deletions intavia_backend/sparql/statistics_occupation_v2_1.sparql
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.eu/idm/>
PREFIX idmcore: <http://www.intavia.eu/idm-core/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
{% include 'prefixes_v2_1.sparql' %}

SELECT ?occupation (COUNT(DISTINCT ?entity) as ?count) ?occupationLabel ?broaderUri ?broaderLabel
WHERE {
Expand Down

0 comments on commit f73f79b

Please sign in to comment.