Skip to main content

Convert IFC building models to a Linked Building Data graph in Neo4j — no RDF, no Turtle files.

Project description

ifctoneo4j

Convert IFC building models to a Linked Building Data graph in Neo4j — no RDF, no Turtle files.


Install

pip install ifctoneo4j

This will also install ifcopenshell and neo4j automatically.

For bounding box geometry and interface detection, also install:

pip install ifctoneo4j[geometry]

Python API

Basic usage

import ifctoneo4j

# Step 1 — parse the IFC file (no database needed)
result = ifctoneo4j.parse("model.ifc")
print(result)
# ParseResult(nodes=187, rels=186, elements=93)

# Step 2 — write to Neo4j
ifctoneo4j.write(
    result,
    neo4j_uri="bolt://localhost:7687",
    neo4j_user="neo4j",
    neo4j_password="secret",
)

parse() options

result = ifctoneo4j.parse(
    "model.ifc",
    properties_level=1,   # 1 = flat props on nodes (default)
                          # 2 = separate OPM PropertyNode per value
                          # 3 = OPM + versioned StateNode with timestamp
    include_units=False,  # attach QUDT unit URIs to numeric properties
    base_uri="https://linkedbuildingdata.org/building#",  # URI prefix
)

write() options

ifctoneo4j.write(
    result,
    neo4j_uri="bolt://localhost:7687",
    neo4j_user="neo4j",
    neo4j_password="secret",
    database="neo4j",   # target database name (important for AuraDB)
    clear_db=False,     # set True to wipe the database before importing
    batch_size=500,     # rows per Neo4j transaction
)
# returns {"nodes": 187, "rels": 186, "prop_nodes": 0}

AuraDB (cloud)

ifctoneo4j.write(
    result,
    neo4j_uri="neo4j+s://xxxxxxxx.databases.neo4j.io",
    neo4j_user="your-username",
    neo4j_password="your-password",
    database="your-database-name",
    clear_db=True,
)

CLI

ifctoneo4j model.ifc \
    --neo4j-uri bolt://localhost:7687 \
    --neo4j-user neo4j \
    --neo4j-password secret

Common flags

Flag Description
--database Target database name (default: neo4j)
--clear-db Delete all data before importing
--properties-level 2 OPM property nodes instead of flat props
--units Attach QUDT unit URIs to numeric properties
--geometry Compute bounding boxes
--interfaces Detect element interfaces (requires --geometry)
--geolocation Extract site lat/lon as WKT POINT
--batch-size 1000 Rows per transaction (default: 500)
--no-elements Spatial hierarchy only, skip elements
-v Verbose / debug logging
# Full example with geometry and AuraDB
ifctoneo4j model.ifc \
    --neo4j-uri neo4j+s://xxxxxxxx.databases.neo4j.io \
    --neo4j-user myuser --neo4j-password mypassword \
    --database mydb \
    --clear-db --geometry --geolocation

What gets created in Neo4j

The graph follows the BOT spatial hierarchy:

Site -[HAS_BUILDING]-> Building -[HAS_STOREY]-> Storey -[HAS_SPACE]-> Space
Storey/Space -[CONTAINS_ELEMENT]-> Element
Wall -[HAS_SUB_ELEMENT]-> Door/Window

Element nodes get multi-label classification — a solid wall becomes :Element:Wall:Wall_SOLIDWALL, an axial fan becomes :Element:Fan:Fan_AXIAL.

Properties from IFC property sets are stored as camelCase_property_simple on each node:

MATCH (w:Wall)
WHERE w.isExternal_property_simple = true
RETURN w.name, w.globalId

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

ifctoneo4j-0.1.1.tar.gz (56.9 kB view details)

Uploaded Source

Built Distribution

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

ifctoneo4j-0.1.1-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

Details for the file ifctoneo4j-0.1.1.tar.gz.

File metadata

  • Download URL: ifctoneo4j-0.1.1.tar.gz
  • Upload date:
  • Size: 56.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ifctoneo4j-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a9c718cf4598798edcb2c16c70f7acd1e8e944521ee19e3816d3aadf8d9ef134
MD5 4402d41cfce1513a1f0087a182a1bd96
BLAKE2b-256 8ddd74a4f5e6b5b2a64cfd56ba63b22f6a6781ae1dfe548a918dfa9d32e4b723

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifctoneo4j-0.1.1.tar.gz:

Publisher: publish.yml on alfarseniko/ifctoneo4j

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ifctoneo4j-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ifctoneo4j-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 63.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ifctoneo4j-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e394da6547bb7d3cdb8dbca79f11f17346a0ff375bf5983d0cde952fbfd5016b
MD5 12376aec0ac839058323046a33d82c0f
BLAKE2b-256 d782bc490620eb5fdcd3742143f01df897ebb91e20cd6911fe7aafc53496d7c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifctoneo4j-0.1.1-py3-none-any.whl:

Publisher: publish.yml on alfarseniko/ifctoneo4j

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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