Created
August 2, 2022 11:05
-
-
Save epoz/c5faca2eb514f7d0dde0843e181a548c to your computer and use it in GitHub Desktop.
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
from rdflib import * | |
from rich.progress import track | |
hydra_graph = Graph() | |
hydra_graph.parse( | |
"https://nfdi4culture.de/resource.ttl?tx_lod_api[limit]=999&tx_lod_api[page]=1" | |
) | |
output_graph = Graph() | |
resources = [ | |
str(s) | |
for s, p, o in hydra_graph.triples((None, None, None)) | |
if s.startswith("https://nfdi4culture.de/resource/E") and s.endswith(".ttl") | |
] | |
print(f"There are {len(resources)} resources") | |
for resource in track(resources): | |
output_graph.parse(resource) | |
print("Serializing") | |
open("nfdico.ttl", "w").write(output_graph.serialize(format="turtle")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment