forked from topoteretes/cognee
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathontology_quickstart.py
More file actions
29 lines (21 loc) · 882 Bytes
/
Copy pathontology_quickstart.py
File metadata and controls
29 lines (21 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import asyncio
import cognee
import os
from cognee.modules.ontology.ontology_config import Config
from cognee.modules.ontology.rdf_xml.RDFLibOntologyResolver import RDFLibOntologyResolver
async def main():
# Prune data and system metadata before running, only if we want "fresh" state.
await cognee.forget(everything=True)
texts = ["Audi produces the R8 and e-tron.", "Apple develops iPhone and MacBook."]
ontology_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "ontology_input_example/basic_ontology.owl"
)
# Create full config structure manually
config: Config = {
"ontology_config": {
"ontology_resolver": RDFLibOntologyResolver(ontology_file=ontology_path)
}
}
await cognee.remember(texts, config=config, self_improvement=False)
if __name__ == "__main__":
asyncio.run(main())