# People work at institutions and studied at institutions. Three sources feed
# the graph: an HR export that reports both readings of employment (a person
# is employed_by an institution, the institution employs the person), a public
# registry that reports only employed_by, and an alumni list.
schema:
    metadata:
        name: staffing
        version: 1.0.0
    graph:
        vertex_config:
            vertices:
            -   name: person
                properties: [person_id, name]
                identity: [person_id]
            -   name: institution
                properties: [institution_id, title]
                identity: [institution_id]
        edge_config:
            edges:
            -   source: person
                target: institution
                relation: employed_by
                directed: true
            # The same fact read from the institution, stored as its own edge.
            -   source: institution
                target: person
                relation: employs
                directed: true
                properties: [since]
            # No edge for has_alumnus: that name only reads alumnus_of backwards.
            -   source: person
                target: institution
                relation: alumnus_of
                directed: true
            # Collaboration reads the same from both ends. No source writes it.
            -   source: person
                target: person
                relation: collaborates_with
                directed: false
            inverses:
            -   relation: employed_by
                inverse: employs
            -   relation: alumnus_of
                inverse: has_alumnus
    db_profile:
        db_flavor: neo4j
ingestion_model:
    resources:
    -   name: hr
        infer_edges: false
        pipeline:
        -   vertex: person
        -   vertex: institution
        -   edge: {from: person, to: institution, relation: employed_by}
        -   edge: {from: institution, to: person, relation: employs}
    -   name: registry
        infer_edges: false
        pipeline:
        -   vertex: person
        -   vertex: institution
        -   edge: {from: person, to: institution, relation: employed_by}
    -   name: alumni
        infer_edges: false
        pipeline:
        -   vertex: person
        -   vertex: institution
        -   edge: {from: person, to: institution, relation: alumnus_of}
