You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Oograph: an intert, literate representation format for knowledge graphs
#44
I assert that LLMs need Knowledge Graphs. Certainly I'm far from the only one who says that, and this is a good thing, but for me a natural implication of this assertion is that we should have a format that represents knowledge graphs in a way that can be readily consumed by humans (so "literate"), so that we can also use this format to put such representations into LLM prompt contexts, training and fine-tuning data sets, etc. I think such a representation should be free of semantics that relate to how such graphs are processed or queried (so "inert").
Oograph is such a format, designed for property graphs1, my current, preferred knowledge graph model for after many years of working with different approaches2.
I'll use examples based on conventions for importing data into the Kùzu Graph DBMS. It allows you to import data by defining a schema in CYPHER, and then shredding the actual data into CSVs. Most GDBMSes push similar approaches. Memgraph has a specialized variant called CYPHERL, which I won't go into here.
The schema definitions that frame the CSVs are in DBMS-specific language, hence not inert, and it's hard for a reader person to really get a sense of the entities being described because of the way the information is shredded, so not literate.
Here is a portion of the same data represented in a prototype form of Oograph.
There would be similar stanzas for the other users and cities. You still need the schema to actually put the data into a DBMS, to e.g. make clear that 30 is a number (a 64-bit integer) rather than a string, and that the names are primary keys. Yet you can read the data and get clear context from this format, and you can use it that way in an LLM prompt.
This prototype format is loosely based on YAML, but is its own, tiny language.
Footnotes
There are different approaches to knowledge graphs. RDF is one that I worked with, and advocated for a long time, but it's tricky in RDF to make statements about statements, so you can say "Abuja is the capital of Nigeria" but it's a pain to also note that this has only been the case since 1991 (before that it was Lagos). There have been many approaches to fixing this in RDF, but they've never fit very comfortably. Property graphs, made popular by Neo4j, handles this much better, and has become my preferred choice in recent years. One thing I still prefer about RDF is that it makes explicit the use of IRIs (e.g. URLs) as canonical identifiers, but I tend to handle that by using IRIs anyway through the data model. ↩
I was working with RDF for over a decade, starting in 1999. I created a query language for RDF, Versa, which had several features later used in CYPHER, including the arrow syntax - … ->, but this "path-like" approach was rejected in favor of SPARQL. The weird fit of SPARQL and increasing focus on formal ontologies (i.e. OWL) rather than lightweight pragmatism, eventually put me off RDF. For a while I used my own home-grown KG toolkit, also called Versa, which was sort of halfway between RDF and property graphs, but decided in the end it would be more practical to just adopt the latter, which had the momentum. I've actually based the Oograph work on work I'd started in the Versa project, refined in the short-lived Onya project. ↩
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I assert that LLMs need Knowledge Graphs. Certainly I'm far from the only one who says that, and this is a good thing, but for me a natural implication of this assertion is that we should have a format that represents knowledge graphs in a way that can be readily consumed by humans (so "literate"), so that we can also use this format to put such representations into LLM prompt contexts, training and fine-tuning data sets, etc. I think such a representation should be free of semantics that relate to how such graphs are processed or queried (so "inert").
Oograph is such a format, designed for property graphs1, my current, preferred knowledge graph model for after many years of working with different approaches2.
I'll use examples based on conventions for importing data into the Kùzu Graph DBMS. It allows you to import data by defining a schema in CYPHER, and then shredding the actual data into CSVs. Most GDBMSes push similar approaches. Memgraph has a specialized variant called CYPHERL, which I won't go into here.
Example Kùzu schema (taken from their Colab notebook):
CSVs with actual data, one for each of the NODE and REL definition:
User:
Follows:
City:
LivesIn:
The schema definitions that frame the CSVs are in DBMS-specific language, hence not inert, and it's hard for a reader person to really get a sense of the entities being described because of the way the information is shredded, so not literate.
Here is a portion of the same data represented in a prototype form of Oograph.
There would be similar stanzas for the other users and cities. You still need the schema to actually put the data into a DBMS, to e.g. make clear that 30 is a number (a 64-bit integer) rather than a string, and that the names are primary keys. Yet you can read the data and get clear context from this format, and you can use it that way in an LLM prompt.
This prototype format is loosely based on YAML, but is its own, tiny language.
Footnotes
There are different approaches to knowledge graphs. RDF is one that I worked with, and advocated for a long time, but it's tricky in RDF to make statements about statements, so you can say "Abuja is the capital of Nigeria" but it's a pain to also note that this has only been the case since 1991 (before that it was Lagos). There have been many approaches to fixing this in RDF, but they've never fit very comfortably. Property graphs, made popular by Neo4j, handles this much better, and has become my preferred choice in recent years. One thing I still prefer about RDF is that it makes explicit the use of IRIs (e.g. URLs) as canonical identifiers, but I tend to handle that by using IRIs anyway through the data model. ↩
I was working with RDF for over a decade, starting in 1999. I created a query language for RDF, Versa, which had several features later used in CYPHER, including the arrow syntax
- … ->, but this "path-like" approach was rejected in favor of SPARQL. The weird fit of SPARQL and increasing focus on formal ontologies (i.e. OWL) rather than lightweight pragmatism, eventually put me off RDF. For a while I used my own home-grown KG toolkit, also called Versa, which was sort of halfway between RDF and property graphs, but decided in the end it would be more practical to just adopt the latter, which had the momentum. I've actually based the Oograph work on work I'd started in the Versa project, refined in the short-lived Onya project. ↩All reactions