Example #1
0
 def get_w3c(self, bundle=None):
     if bundle is None:
         bundle = ProvBundle()
     w3c_record = ProvEntity(bundle, self.identifier, self.attributes)
     w3c_record.add_asserted_type(
         self._prov_type)  # self.__class__.__name__)
     return bundle.add_record(w3c_record)
Example #2
0
 def get_w3c(self, bundle=None):
     """get this element in the prov version which is an implementation of the W3C PROV-DM standard"""
     if bundle is None:
         bundle = ProvBundle()
     w3c_record = ProvEntity(bundle, self.identifier, self.attributes)
     w3c_record.add_asserted_type(self._prov_type)  # self.__class__.__name__)
     return bundle.add_record(w3c_record)
def get_process_entity(prov_bundle: ProvBundle, item: db.Item) -> ProvEntity:
    try:
        entity_process = procedure_entities[item.itemid]
        if not prov_bundle.get_record(entity_process.identifier):
            # the entity was created in another admission
            prov_bundle.add_record(entity_process)
        return entity_process
    except KeyError:
        entity_id = ns_process[str(item.itemid)]
        entity_process = prov_bundle.entity(
            entity_id,
            {
                "prov:type": ns_type["Process"],
                "prov:label": item.label,
                ns_attrs["abbreviation"]: item.abbreviation,
                ns_attrs["category"]: item.category,
                ns_attrs["dbsource"]: item.dbsource,
            },
        )
        procedure_entities[item.itemid] = entity_process
        return entity_process
Example #4
0
    def get_w3c(self, bundle=None):
        """get this relation in the prov version which is an implementation of the W3C PROV-DM standard"""
        if bundle is None:
            bundle = ProvBundle()
        attribute = self.extra_attributes
        relation_formal_attribute = self.formal_attributes[0:2]

        w3c_record = ProvInfluence(bundle, self.identifier, attribute)
        namespaces = [list(i) for i in w3c_record.formal_attributes]
        for i in range(0, 2):
            namespaces[i][1] = relation_formal_attribute[i][1]
        w3c_record.add_attributes(namespaces)
        w3c_record.add_asserted_type(
            self._prov_type)  # self.__class__.__name__)
        return bundle.add_record(w3c_record)