Speckle2Graph
⚠️ Currently in alpha - bug reports and feedback are appreciated!
Purpose of the Library
speckle2graph is a framework for establishing pipelines from BIM models to graph databases with just a few lines of code.
The semantics of a BIM model are locked within the modelling software, which creates a bottleneck for implementing AI agents that truly understand the model. Converting a BIM model to a knowledge graph with a custom ontology is an ideal foundation for building AI-driven applications.
Currently we support Neo4j only.
Key Features
- Convert BIM models to Neo4j graph databases in 3 lines of code
- Support for Revit models via Speckle
- Preserves model relationships and hierarchies
- Extensible for custom ontologies
What Gets Created
The library traverses your Speckle BIM model and creates:
- Nodes: Representing BIM elements with their properties
- Relationships: Spatial and hierarchical connections between elements
- Graph structure: Ready for AI agents, path-finding, and semantic queries
Prerequisites
- Ensure that the Speckle models were uploaded using the latest versions of the connectors.
Usage
# Install the library
pip install speckle2graph
# To follow latest developments install it from the github
pip install git+https://github.com/2twenity/Speckle2Graph.git
# Authorize to Speckle
client = SpeckleClient()
client.authenticate_with_token(SPECKLE_TOKEN)
transport = ServerTransport(PROJECT_ID, client)
# Receive the root object from Speckle (must be the model root for geometry to build correctly)
root = operations.receive(ROOT, remote_transport = transport)
# Build a Graph in 3 lines of code
traversed_object = TraverseRevitDAG(root)
graph_builder = DataGraphBuilder(traversed_speckle_object=traversed_object)
graph_builder.build()
# Write the graph to a neo4j database
from speckle2graph import Neo4jRevitLabelAssigner
from speckle2graph import Neo4jClientDriverWrapper
from neo4j import GraphDatabase
# Authorize and write the graph to Neo4j for further analysis.
with GraphDatabase.driver(URI, auth=auth) as driver:
driver.verify_connectivity()
neo4j_client_wrapper = Neo4jClientDriverWrapper(
driver=driver,
graph_builder_object=graph_builder,
label_assigner=Neo4jRevitLabelAssigner()
)
neo4j_client_wrapper.write_graph()
Example
Metadata
Release files for Speckle2Graph 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| speckle2graph-0.0.5.tar.gz | 18.1 kB | Without provenance | Details for speckle2graph-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| speckle2graph-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for speckle2graph-0.0.5-py3-none-any.whl |
Total release size: 39.7 kB
Release files / speckle2graph-0.0.5.tar.gz
| Download URL | speckle2graph-0.0.5.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31b2a5b790f479170b76f1f318f9bb706f0e2dbe839dc8165580438f07b100fc
|
|
BLAKE2b-256 checksum How to use checksums |
506a9c58c1f135be997564c021c50ad56f9d59cb9ce51f46200f62f0830682f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / speckle2graph-0.0.5-py3-none-any.whl
| Download URL | speckle2graph-0.0.5-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b07998f83430b9228c482921d4d5d5a0df7819d46bcdf99dfdbe0a20f136b77
|
|
BLAKE2b-256 checksum How to use checksums |
a684e536f7fc094b5c2e477f06587ad7b69a07f3b49b85a38f0a2fd82c49230e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for Speckle2Graph 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.