Identify subject-predicate-object triples to construct Knowledge Graphs (KG).
Constraint Formats:
- Entity types only:
["Person", "Place"] - Entity and Relation types:
[["Person", "Place"], ["LivesIn", "BornIn"]] - Subject, Relation, and Object types:
[["Person"], ["LivesIn"], ["Place"]]
Building a Knowledge Graph:
To automatically construct a KG (e.g., in Neo4j), add the construct field to your YAML configuration.
Warning: If you do NOT want to build a KG, you must remove or comment out the construct field to avoid database connection errors.
Steps:
- Configure
./examples/config/Triple2KG.yaml with the construct block. - Run the extraction script:
config_file=./examples/config/Triple2KG.yaml
python src/run.py --config $config_file
construct: # (Optional) If you want to construct a Knowledge Graph, you need to set the construct field, or you must delete this field.
database: Neo4j # your database type.
url: neo4j://localhost:7687 # your database URL
username: your_username # your database username.
password: "your_password" # your database password.