prov-db-connector
prov-db-connector copied to clipboard
Add top level method: get_relation(....) ?
Currently the ProvDb
class expose methods like get_element(identifier)
this method returns 3 possible types:
- ProvAgent
- ProvEntity
- ProvActivity
In order to provide a consistent we should discuss the advantage of a method like get_relation()
For example:
matching_attributes = dict()
matching_attributes.update({'prov:type': 'prov:Mention'})
pro_relation = prov_api.get_relation(matching_attributes)
The problem is that this kind of filter mechanism could return a list instead of a single entry. According to the PROV spec the uniques of a relation is defined by all formal attributes (eg form / to node). Maybe we can set a filter by this formal attributes.
This seems the best solution but also require to alter the BaseAdapter
and all adapter implementations.
Also I really don't know if it is necessary to get only a single relation between to ProvElements
. Is there any good use case for this?
If we implement a method like prov_api.get_relation(matching_attributes)
we should return list in every case, since its easier to process.
I don't think just return the relation itself is interesting. At least it should return a list of all relations, including the involved node as well. i.e.
[
{
id:{
type:prov-type,
attributes: ..
},
id:{
type: prov-type,
attributes: ...
},
},
{...} # next entry
]
But, usually it question would be like: "Which entities were in created in a particular process". Isn't there a filter function that could solve such questions?