Hi,
I am trying to build a KnowledgeGraph from structured Data in Python.
My data is similar to GoogleMaps restaurants.
Example Data:
[
{
"name": "Italian Restaurant 1",
"price": "10EUR",
"location": "New York",
"opening": "10am",
"closing": "10pm",
},
{...},
]
I am adding Nodes to the KnowledgeGraph based on this example:
https://gpt-index.readthedocs.io/en/v0.6.32/examples/index_structs/knowledge_graph/NebulaGraphKGIndexDemo.html#optional-try-building-the-graph-and-manually-add-tripletsAt the section: Building the Graph and Manually adding Triplets
Using this Example I would have Triplets looking similar to this:
[
("Italian Restaurant 1", "costs", "10EUR"),
("Italian Restaurant 1", "city", "New York"),
("Italian Restaurant 1", "opens", "10am"),
("Italian Restaurant 1", "closes", "10pm")
]
I would have many of those for my entire Dataset.
Now my general question is how I would create the custom
Nodes.
I have been using TextNodes so far, creating a new Node for each Data entry (restaurant).
node = TextNode()
triplets = [...]
for t in triplets:
index.upsert_triplet_and_node(t, node)
This to me seems wrong, as I don't really have a text for this Node. Using the NodeParsers or from_document options as stated in many other examples is not really applicable to this structured data.
Can someone guide me into the right direction? How should I use Initialize Nodes? What relationships should I use? Should I use a node per Restaurant or per Triplet?
The goal is to query the index for something like "What restaurant is open in Now York at 2pm?"