tetherless-world / mcs-apps

DARPA Machine Common Sense (MCS) applications for exploring knowledge graphs of common sense, benchmark questions, and question-answering processes
MIT License
4 stars 1 forks source link

Node's sources are calculated incorrectly #259

Closed gordom6 closed 3 years ago

gordom6 commented 3 years ago

Split off from comments on the PR for #251.

Currently we consider that the sources of a node are the sources of the first edge containing a node. This loop in Neo4jKgCommandStore putKgtkEdgesWithNodes:

          for (edgeWithNodes <- edgesWithNodesList) {
            if (putNodeIds.add(edgeWithNodes.node1.id)) {
              putNode(edgeWithNodes.node1)
            }
            if (putNodeIds.add(edgeWithNodes.node2.id)) {
              putNode(edgeWithNodes.node2)
            }
            putEdge(edgeWithNodes.edge)
          }

The sources of a node should be the union of the sources of the edges the node appears in.

gordom6 commented 3 years ago

This is likely a problem in the MemKgStore, too.

gordom6 commented 3 years ago

This should be as straightforward as updating the node's sourceIds when a node appears in a subsequent edge. So rather than only checking if the node is already in the graph, also update its sourceIds if necessary.