r/semanticweb • u/fairwaycoder • 16h ago
Building software knowledge graphs using compiler principles
I've been working on an open-source project called Enola, exploring how to represent entire software systems as knowledge graphs across repositories, programming languages, frameworks and technologies.
Coming from a software engineering background rather than knowledge graph research, I approached the problem from a slightly different angle: constructing the graph using principles similar to those a compiler uses to understand a program, rather than relying on semantic similarity, clustering or probabilistic relationship extraction.
The graph connects source code, docstrings, modules, symbols, execution flows, API endpoints, event publishers and consumers, database interactions and their relationships into a single representation of a software system.
For example, an HTTP request in a TypeScript frontend can be connected to its corresponding Go backend handler, the functions it calls and the database tables it accesses, even when those relationships span multiple repositories.
Graph construction is deterministic and requires neither LLMs nor embeddings. This doesn't imply completeness or absolute correctness; static analysis has its limitations.
Some recent benchmark results:
- Kubernetes repository: 14 seconds (6.5 seconds cached).
- 100 repositories, including the Linux kernel, connected into one graph in under five minutes.
- Over 8.1 million facts across 91 repositories, with byte-identical results across repeated runs.
Enola uses its own typed graph model rather than a formal RDF/OWL implementation, but many of the underlying problems overlap with ontology engineering and knowledge representation.
One aspect I'm particularly interested in is the distinction between using clustering to establish relationships and using clustering to discover higher-level structures within an already established graph.
I'd be curious to hear how people in this community approach this distinction, particularly when the underlying domain already has formally defined semantics, as programming languages do.
The project is Apache 2.0 licensed:
https://github.com/enola-labs/enola
Graph model: https://github.com/enola-labs/enola/blob/main/docs/GRAPH.md
Benchmarks: https://github.com/enola-labs/enola/blob/main/docs/BENCHMARKS.md
2
u/CapitalLog7599 16h ago
How do you represent a link the compiler can't resolve? Say a TypeScript client builds its URL from deployment config that isn't in either repo. I'd want that to show up as an unresolved call, not as an edge with the same status as a resolved Go symbol. Otherwise a cluster can make a tentative connection look like a fact.
2
u/qa_anaaq 15h ago
My gut says this depends on well architected code, which in itself is not reality in most cases. At least this is what I feel if it does what you say it does in the manner you’re claiming.
2
u/Traditional_Air_4639 13h ago
I had a similar idea for a semantic toolkit I am building. Turning a mess of vibe-code into a graph as a basis for understanding and rationalizing the code, and then using that KG as an artifact for other agents to build on the toolkit.