BONSAMURAIS / schema

Relational database schemas for BONSAI
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

`datasource` shouldn't have an obligatory `location` FK #20

Closed cmutel closed 4 years ago

cmutel commented 4 years ago

From Slack message by @BenPortner.

@tngTUDOR Please explain the motivation for this, it doesn't seem clear to me.

@boweidema Do you know the status of the provenance ontology? It isn't provided anywhere on the official repo, and it would be nice to follow the ontology here.

tngTUDOR commented 4 years ago

@BenPortner the question is: should we associate every data source to a geographical location ?

At the beginning I thought we should, but after a second thought, if a datasource describes objects from many different (geographical) locations, then it wouldn't make sense.

BenPortner commented 4 years ago

@tngTUDOR That's a new train of thought for me. I assumed that the field should describe the location of the datasource. Now it sounds like the original purpose was for it to be a collection of all the locations associated with activities in the datasource. This could be useful to filter datasources quickly and decide which one is suitable for the user's purpose. Is that what the field is for?

cmutel commented 4 years ago

should we associate every data source to a geographical location ?

No. Locations of activities are defined per activity.

Now it sounds like the original purpose was for it to be a collection of all the locations associated with activities in the datasource.

This exists already:

select location.label from activity 
left join activity on activity.location_id = location.id 
left join datasource on activity.datasource_id = datasource.id 
where datasource.label = 'foo'

Or, more simply:

select activity.location_id from activity where activity.datasource_id = x