-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from kaiwenho/main
Added script to generate a json containing the sources currently used by Unsecret
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/information_resource_registry/translator_dataflow/data/unsecret.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"infores:unsecret-agent": [ | ||
"infores:robokop-kg", | ||
"infores:text-mining-provider-targeted", | ||
"infores:rtx-kg2" | ||
] | ||
} |
24 changes: 24 additions & 0 deletions
24
src/information_resource_registry/translator_dataflow/unsecret.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import requests | ||
import yaml | ||
import json | ||
|
||
def main(): | ||
infores_dict = {'infores:unsecret-agent': []} | ||
|
||
url = "https://raw.githubusercontent.com/webyrd/mediKanren/refs/heads/master/medikanren2/neo/neo-open-api/unsecret-source-consume.yaml" | ||
response = requests.get(url) | ||
|
||
if response.status_code == 200: | ||
knowledge_sources = yaml.safe_load(response.content) | ||
|
||
for curie, infores_curie in knowledge_sources.items(): | ||
infores_dict['infores:unsecret-agent'].append(infores_curie['infores_curie']) | ||
else: | ||
print(f"Error downloading file: {response.status_code}") | ||
exit() | ||
|
||
json.dump(infores_dict, open('data/unsecret.json', 'w'), indent=2, sort_keys=True) | ||
|
||
# Call main() if this script is executed directly | ||
if __name__ == "__main__": | ||
main() |