Skip to content

Commit

Permalink
feat: Add knowledge_level/agent_type to edges
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Apr 11, 2024
1 parent 55811ee commit ded747c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export default class BTEGraph {
.map((item) => {
this.edges[recordHash].addAdditionalAttributes(item, record.mappedResponse[item]);
});
if (record.knowledge_level) {
this.edges[recordHash].addAdditionalAttributes('knowledge_level', record.knowledge_level);
}
if (record.agent_type) {
this.edges[recordHash].addAdditionalAttributes('agent_type', record.agent_type);
}
this.edges[recordHash].addSource(record.provenanceChain);
Object.entries(record.qualifiers).forEach(([qualifierType, qualifier]) => {
this.edges[recordHash].addQualifier(qualifierType, qualifier);
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export default class TRAPIQueryHandler {
const source = Object.entries(ontologyKnowledgeSourceMapping).find(([prefix]) => {
return expanded.includes(prefix);
})[1];
subclassEdge.addAdditionalAttributes('biolink:knowledge_level', 'knowledge_assertion')
subclassEdge.addAdditionalAttributes('biolink:agent_type', 'manual_agent')
subclassEdge.addSource([
{ resource_id: source, resource_role: 'primary_knowledge_source' },
{
Expand Down Expand Up @@ -221,6 +223,8 @@ export default class TRAPIQueryHandler {
object: object,
});
boundEdge.addAdditionalAttributes('biolink:support_graphs', [supportGraphID]);
boundEdge.addAdditionalAttributes('biolink:knowledge_level', 'logical_entailment')
boundEdge.addAdditionalAttributes('biolink:agent_type', 'automated_agent')
boundEdge.addSource([
{
resource_id: this.options.provenanceUsesServiceProvider
Expand Down
6 changes: 5 additions & 1 deletion src/inferred_mode/inferred_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ export default class InferredQueryHandler {
resource_role: 'primary_knowledge_source',
},
],
attributes: [{ attribute_type_id: 'biolink:support_graphs', value: [] }],
attributes: [
{ attribute_type_id: 'biolink:support_graphs', value: [] },
{ attribute_type_id: 'biolink:knowledge_level', value: "prediction" },
{ attribute_type_id: 'biolink:agent_type', value: "computational_model" },
],
};
}
let auxGraphSuffix = 0;
Expand Down

0 comments on commit ded747c

Please sign in to comment.