dipper.models.assoc.Association module

class dipper.models.assoc.Association.Assoc(graph, definedby, sub=None, obj=None, pred=None, subject_category=None, object_category=None)

Bases: object

A base class for OBAN (Monarch)-style associations, to enable attribution of source and evidence on statements.

add_association_to_graph(association_category=None)
add_date(date)
add_evidence(identifier)

Add an evidence code to the association object (maintained as a list) :param identifier:

Returns:
add_predicate_object(predicate, object_node, object_type=None, datatype=None)
add_provenance(identifier)
add_source(identifier)

Add a source identifier (such as publication id) to the association object (maintained as a list) TODO we need to greatly expand this function!

Parameters:identifier
Returns:
get_association_id()
static make_association_id(definedby, sub, pred, obj, attributes=None)

A method to create unique identifiers for OBAN-style associations, based on all the parts of the association If any of the items is empty or None, it will convert it to blank. It effectively digests the string of concatonated values. Subclasses of Assoc can submit an additional array of attributes that will be appeded to the ID.

Note this is equivalent to a RDF blank node

Parameters:
  • definedby – The (data) resource that provided the annotation
  • subject
  • predicate
  • object
  • attributes
Returns:

set_association_id(assoc_id=None)

This will set the association ID based on the internal parts of the association. To be used in cases where an external association identifier should be used.

Parameters:assoc_id
Returns:
set_description(description)
set_object(identifier)
set_relationship(identifier)
set_score(score, unit=None, score_type=None)
set_subject(identifier)