Skip to content

Commit

Permalink
Link inscription & witness in the graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Sep 24, 2018
1 parent 8b38388 commit 915efed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions graph.py
Expand Up @@ -291,6 +291,11 @@ def adopt_orphans(graph: nx.MultiDiGraph):
logger.info('Adopted %s from ambiguous ref %s', witness, node)


def add_inscription_links(base: nx.MultiDiGraph):
for node in list(base.nodes):
if isinstance(node, Inscription):
base.add_edge(node, node.witness, kind='inscription', source=BiblSource('faust://model/inscription'))

def add_missing_wits(working: nx.MultiDiGraph):
all_wits = {wit for wit in Witness.database.values() if isinstance(wit, Witness)}
known_wits = {wit for wit in working.nodes if isinstance(wit, Witness)}
Expand Down Expand Up @@ -354,6 +359,7 @@ def macrogenesis_graphs() -> MacrogenesisInfo:
logger.info('Removed %d of the original %d edges', len(all_conflicting_edges), len(working.edges))

closure = nx.transitive_closure(dag)
add_inscription_links(base)

return MacrogenesisInfo(base, working, dag, closure, conflicts)

Expand Down
5 changes: 3 additions & 2 deletions report.py
Expand Up @@ -331,6 +331,7 @@ def _last_ref_subpage(self, DAY, ref):
'temp-syn': 'ca. gleichzeitig',
'temp-pre': 'entstanden nach',
'orphan': '(Verweis)',
'inscription': 'Inskription von',
None: '???'
}
assertionTable = (HtmlTable()
Expand All @@ -347,7 +348,7 @@ def _last_ref_subpage(self, DAY, ref):
u + DAY if isinstance(u, date) else u,
attr['source'],
attr.get('comments', []),
attr['xml']),
attr.get('xml', [])),
class_='delete' if delete_ else str(attr['kind']))
kinds['temp-pre'] = 'entstanden vor'
for (u, v, attr) in self.base.out_edges(ref, data=True):
Expand All @@ -357,7 +358,7 @@ def _last_ref_subpage(self, DAY, ref):
v - DAY if isinstance(v, date) else v,
attr['source'],
attr.get('comments', []),
attr['xml']),
attr.get('xml', [])),
class_='delete' if delete_ else str(attr['kind']))
write_html(basename.with_suffix('.php'), report + assertionTable.format_table(),
breadcrumbs=[dict(caption='Referenzen', link='refs')],
Expand Down
5 changes: 5 additions & 0 deletions styles.yaml
Expand Up @@ -30,6 +30,11 @@ edge:
orphan: # artificial edges from ambiguous refs / inscriptions to otherwise unused witnesses
style: dashed
color: gray
inscription:
dir: none
color: gray
constraint: false
style: dashed

# additional style for conflicting edges
delete:
Expand Down

0 comments on commit 915efed

Please sign in to comment.