Enable graph-based analysis of any Speckle model.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speckle2graph-0.0.5.tar.gz.
File metadata
- Download URL: speckle2graph-0.0.5.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31b2a5b790f479170b76f1f318f9bb706f0e2dbe839dc8165580438f07b100fc
|
|
| MD5 |
0eef897403c5e39736de6aa63cc667d2
|
|
| BLAKE2b-256 |
506a9c58c1f135be997564c021c50ad56f9d59cb9ce51f46200f62f0830682f7
|
File details
Details for the file speckle2graph-0.0.5-py3-none-any.whl.
File metadata
- Download URL: speckle2graph-0.0.5-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b07998f83430b9228c482921d4d5d5a0df7819d46bcdf99dfdbe0a20f136b77
|
|
| MD5 |
43169f68094ca72aa75cc3414d38a820
|
|
| BLAKE2b-256 |
a684e536f7fc094b5c2e477f06587ad7b69a07f3b49b85a38f0a2fd82c49230e
|