Implement ProvApi
B-Stefan opened this issue · comments
Stefan Bieliauskas commented
Implement following methods in the ProvApi class:
- create_document_form_prov(content=ProvDocument) ✅
- get_document_as_prov(document_id: string): ProvDocument
Pseudocode for the get_document_as_prov(document_id) method as far as I have been thinking:
#
#get document from adapter
#
#foreach bundle in document.bundles
# foreach record in records and relations
# add namespaces from record to bundle
# check if record belong to this bundle (bundle links) ?????(test!)
# skip all records of prov:type "prov:Unknown"
# create record in bundle
#
#
#
create record(prov_bundle, attributes, metadata)
# set prov_type from metadata
# set prov_label from metadata
# zip type_map and properties together
# use create_record method from jsondeserializer
Pseudocode for the create_document_from_prov(ProvDocument) method as far as I have been thinking:
# create document id
# create document records / relations (The same code like with bundles)
#
#foreach bundle
# create bundle id
#
# foreach record in bundle :
# prepare metadata (like labels, namespaces, type_map) as primitive datatypes
# create database node
# create relation between bundle node and record node
#
# foreach relation in bundle:
# skip relations of the type "prov:mentionOf"
# if target or origin record is unknown, create node "Unknown"
# prepare metadata (like labels, namespaces, type_map) as primitive datatypes
# create database relation
#
#
#foreach bundle in bundles
# foreach relation in bundle
# if the relation type is"prov:mentionOf" (https://www.w3.org/TR/prov-links/)
# create relation