Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: KGL, a query language for knowledge graphs (github.com/capjamesg)
3 points by zerojames 8 months ago | hide | past | favorite
I am fascinated by different ways to explore corpora of texts. A few months ago, I built an index for my blog [1], inspired by physical book indices, which lets you explore blog posts by key word.

With this spirit of exploring text data in different ways in mind, I have been working on KGL, a query language for knowledge graphs. Using GPT, I ingested my personal website into semantic ("subject, predicate, object") triples. I then turned these into a graph that I could query.

KGL is designed for unstructured data, whereas RDF was designed for explicitly structured data (and thus suffers from significant verbosity that is not necessary for my application). SPARQL, which is used to query RDF, is similarly complex. SPARQL as conducive to play, the intent for this language.

The language is processed as pointers between concepts, like:

    { taylor swift -> created }!
Retrieves information about all albums that Taylor Swift created. The ! is the expansion operator to explore the graph by one degree. [2]

You can create queries of arbitrary length, like:

    { taylor swift -> created -> have }
KGL is implemented in Python and works on an in-memory graph. Data can be imported to and exported from a KGL graph in CSV, TSV, and JSON.

Demo video: https://jamesg.blog/assets/kgl-interpreter-demo.mp4

Playground with which you can experiment: https://jamesg.blog/kgl/

[1]: https://jamesg.blog/2023/06/03/website-index/

[2]: https://jamesg.blog/2024/03/22/kgl/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: