Skip to main content

Enable graph-based analysis of any Speckle model.

Project description

Speckle2Graph

Sample Image

Purpose of the Library

This is an alpha version, so any feedback of bugs is very appreciated

The library aims to enrich the Speckle-Directed Acyclic Graph (DAG) by adding edges between BIM elements, enabling more specific graph-based analysis.

Currently we support Neo4j only

Prerequisites

  • Ensure that the Speckle models were uploaded using the latest versions of the connectors.
  • Ensure that your Neo4j instance has the APOC plugin installed. Since Cypher queries are used to insert data and they don't support dynamic labels from parameters, we are forced to use APOC to save time on writing label-assigning queries manually.

Usage

# Install the library (PYPI will be added soon)
!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)

# Make sure you paste the root of the speckle model, otherwise, the geometries will fail to build.
root = operations.receive(ROOT, remote_transport = transport) 
# Build a Graph in 4 lines of code
traversed_object = TraverseRevitDAG(root)
graph_builder = GraphBuilder(traversed_speckle_object=traversed_object)
graph_builder.build_logical_graph()
graph_builder.build_geometrical_graph()
# Some predefined quries could be imported
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=full_graph_builder_object
    )
    neo4j_client_wrapper.write_geometrical_graph_to_neo4j(neo4j_client_wrapper)
    neo4j_client_wrapper.write_logical_graph_to_neo4j(neo4j_client_wrapper)

Development Roadmap

Will be added soon!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speckle2graph-0.0.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speckle2graph-0.0.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file speckle2graph-0.0.2.tar.gz.

File metadata

  • Download URL: speckle2graph-0.0.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for speckle2graph-0.0.2.tar.gz
Algorithm Hash digest
SHA256 565bd08def3d25d78dc85b58cd801f338aa4a7d087d7b78244f618a5d7084630
MD5 97e621cf47ed79ddc8381a33178c22c5
BLAKE2b-256 cb675ef6ea9994b8f2f97cf3c5a48612c43a298427e51a15a666edd86893012f

See more details on using hashes here.

File details

Details for the file speckle2graph-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: speckle2graph-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for speckle2graph-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef7c9aaf92b2fc7e47a103bb315c35d0c3771eac948d0cdb8c20238fbdb5aada
MD5 8e4d3b8bc7b588b16c028a42796aa6b6
BLAKE2b-256 c074da0c4187f578b5d946dd5fe9f28ecdb67934f07bc78a3f52a6790c9329b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page