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

Note: ifcopenshell must be installed separately — it is not on PyPI. Download it from ifcopenshell.org or install via conda:

conda install -c conda-forge ifcopenshell

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.0.tar.gz (57.1 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.0-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ifctoneo4j-0.1.0.tar.gz
  • Upload date:
  • Size: 57.1 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.0.tar.gz
Algorithm Hash digest
SHA256 de6c40e2261a8db76e5f85908d4eff1d5f5aa58c5d1a10c03e6a56e0ec6a206a
MD5 7806564c96b0e99bf2077069d8326c2f
BLAKE2b-256 11bb6e5dd6de53f1829c1d38bda80a076a0ed0f1eef32e761144ef504f1d419f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifctoneo4j-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: ifctoneo4j-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17e6a3c211049145c0f1f2d3fc5c2cf5fa1d3bafecbec1a1a4d59e0fcce58547
MD5 74a06472e297049aa903d42d10a4e396
BLAKE2b-256 3b5670e01337f7952b32185756be64569632ba847683cf51176a7612988a955b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifctoneo4j-0.1.0-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