Skip to content

Commit

Permalink
Merge branch 'main' into semmed-sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
colleenXu committed Oct 18, 2024
2 parents b516a74 + f3a5165 commit 6172b99
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 450 deletions.
72 changes: 0 additions & 72 deletions __test__/integration/biolink.test.ts

This file was deleted.

66 changes: 33 additions & 33 deletions __test__/integration/graph/graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ describe('Test graph class', () => {
expect(g.nodes['inputPrimaryCurie'].qNodeID).toEqual('qg1');
expect(Array.from(g.nodes['inputPrimaryCurie'].targetNodes)).toEqual(['outputPrimaryCurie']);
expect(Array.from(g.nodes['inputPrimaryCurie'].targetQNodeIDs)).toEqual(['qg2']);
expect(g.edges).toHaveProperty('2c826c3663b91f65a1cba70f06c7fc65');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].apis)).toEqual(['API1']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].attributes).toHaveProperty('relation', new Set(['relation1']));
expect(g.edges).toHaveProperty('3eb29a4cead0e5f3c3bdca4997bf215b');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].apis)).toEqual(['API1']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].attributes).toHaveProperty('relation', new Set(['relation1']));
});

test('Multiple query results are correctly updated for two edges having same input, predicate and output', () => {
Expand All @@ -130,17 +130,17 @@ describe('Test graph class', () => {
expect(Array.from(g.nodes['inputPrimaryCurie'].targetNodes)).toEqual(['outputPrimaryCurie']);
expect(Array.from(g.nodes['inputPrimaryCurie'].targetQNodeIDs)).toEqual(['qg2']);

expect(g.edges).toHaveProperty('2c826c3663b91f65a1cba70f06c7fc65');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].apis)).toEqual(['API1']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].attributes).toHaveProperty('relation', new Set(['relation1']));
expect(g.edges).toHaveProperty('3eb29a4cead0e5f3c3bdca4997bf215b');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].apis)).toEqual(['API1']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].attributes).toHaveProperty('relation', new Set(['relation1']));

expect(g.edges).toHaveProperty('827c366e2e3088b3f4a90dd88a524f15');
expect(Array.from(g.edges['827c366e2e3088b3f4a90dd88a524f15'].apis)).toEqual(['API2']);
expect(g.edges['827c366e2e3088b3f4a90dd88a524f15'].sources).toHaveProperty('source2');
expect(Array.from(g.edges['827c366e2e3088b3f4a90dd88a524f15'].publications)).toEqual(['PMC:1', 'PMC:2']);
expect(g.edges['827c366e2e3088b3f4a90dd88a524f15'].attributes).toHaveProperty('relation', new Set(['relation2']));
expect(g.edges).toHaveProperty('6930dcb2e9363817e9f6e736829ce278');
expect(Array.from(g.edges['6930dcb2e9363817e9f6e736829ce278'].apis)).toEqual(['API2']);
expect(g.edges['6930dcb2e9363817e9f6e736829ce278'].sources).toHaveProperty('source2');
expect(Array.from(g.edges['6930dcb2e9363817e9f6e736829ce278'].publications)).toEqual(['PMC:1', 'PMC:2']);
expect(g.edges['6930dcb2e9363817e9f6e736829ce278'].attributes).toHaveProperty('relation', new Set(['relation2']));
});

test('Multiple query results for different edges are correctly updated', () => {
Expand All @@ -157,37 +157,37 @@ describe('Test graph class', () => {
expect(Array.from(g.nodes['inputPrimaryCurie'].targetNodes)).toEqual(['outputPrimaryCurie']);
expect(Array.from(g.nodes['inputPrimaryCurie'].targetQNodeIDs)).toEqual(['qg2']);

expect(g.edges).toHaveProperty('2c826c3663b91f65a1cba70f06c7fc65');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].apis)).toEqual(['API1']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['2c826c3663b91f65a1cba70f06c7fc65'].attributes).toHaveProperty('relation', new Set(['relation1']));
expect(g.edges).toHaveProperty('3eb29a4cead0e5f3c3bdca4997bf215b');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].apis)).toEqual(['API1']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].sources).toHaveProperty('source1');
expect(Array.from(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].publications)).toEqual(['PMID:1', 'PMID:2']);
expect(g.edges['3eb29a4cead0e5f3c3bdca4997bf215b'].attributes).toHaveProperty('relation', new Set(['relation1']));

expect(g.edges).toHaveProperty('827c366e2e3088b3f4a90dd88a524f15');
expect(Array.from(g.edges['827c366e2e3088b3f4a90dd88a524f15'].apis)).toEqual(['API2']);
expect(g.edges['827c366e2e3088b3f4a90dd88a524f15'].sources).toHaveProperty('source2');
expect(Array.from(g.edges['827c366e2e3088b3f4a90dd88a524f15'].publications)).toEqual(['PMC:1', 'PMC:2']);
expect(g.edges['827c366e2e3088b3f4a90dd88a524f15'].attributes).toHaveProperty('relation', new Set(['relation2']));
expect(g.edges).toHaveProperty('6930dcb2e9363817e9f6e736829ce278');
expect(Array.from(g.edges['6930dcb2e9363817e9f6e736829ce278'].apis)).toEqual(['API2']);
expect(g.edges['6930dcb2e9363817e9f6e736829ce278'].sources).toHaveProperty('source2');
expect(Array.from(g.edges['6930dcb2e9363817e9f6e736829ce278'].publications)).toEqual(['PMC:1', 'PMC:2']);
expect(g.edges['6930dcb2e9363817e9f6e736829ce278'].attributes).toHaveProperty('relation', new Set(['relation2']));

expect(g.edges).toHaveProperty('3138ca0afca791770ed38c243dea2116');
expect(Array.from(g.edges['3138ca0afca791770ed38c243dea2116'].apis)).toEqual(['API3']);
expect(g.edges['3138ca0afca791770ed38c243dea2116'].sources).toHaveProperty('source3');
expect(Array.from(g.edges['3138ca0afca791770ed38c243dea2116'].publications)).toEqual(['PMC:3', 'PMC:4']);
expect(g.edges['3138ca0afca791770ed38c243dea2116'].attributes).toHaveProperty('relation', new Set(['relation3']));
expect(g.edges).toHaveProperty('38e8cf1917452c83bb878c5a916ef86a');
expect(Array.from(g.edges['38e8cf1917452c83bb878c5a916ef86a'].apis)).toEqual(['API3']);
expect(g.edges['38e8cf1917452c83bb878c5a916ef86a'].sources).toHaveProperty('source3');
expect(Array.from(g.edges['38e8cf1917452c83bb878c5a916ef86a'].publications)).toEqual(['PMC:3', 'PMC:4']);
expect(g.edges['38e8cf1917452c83bb878c5a916ef86a'].attributes).toHaveProperty('relation', new Set(['relation3']));
});

test('Multiple attributes with the same name are merged', () => {
const g = new graph();
g.update([record3, record3a]);

expect(g.edges).toHaveProperty('3138ca0afca791770ed38c243dea2116');
expect(Array.from(g.edges['3138ca0afca791770ed38c243dea2116'].publications)).toEqual([
expect(g.edges).toHaveProperty('38e8cf1917452c83bb878c5a916ef86a');
expect(Array.from(g.edges['38e8cf1917452c83bb878c5a916ef86a'].publications)).toEqual([
'PMC:3',
'PMC:4',
'PMC:6',
'PMC:7',
]);
expect(g.edges['3138ca0afca791770ed38c243dea2116'].attributes).toHaveProperty(
expect(g.edges['38e8cf1917452c83bb878c5a916ef86a'].attributes).toHaveProperty(
'relation',
new Set(['relation3', 'relation3a', 'relation3b']),
);
Expand Down
Loading

0 comments on commit 6172b99

Please sign in to comment.