Skip to main content

Speckle2Graph

"test"

⚠️ 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

"test"

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)

Source distribution for Speckle2Graph 0.0.5
File Size Uploaded
speckle2graph-0.0.5.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Speckle2Graph 0.0.5
File Interpreter ABI Platform
speckle2graph-0.0.5-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page