Linked data
Files, links, texts and identifiers on objects, kept outside the IFC; how a link follows its object to the later versions of a model, what "check" and "orphaned" mean, and how the files are stored and synced.
A pump has a datasheet and a warranty, a door a supplier page, a boiler an SAP equipment number, a wall a photo of the damage found on site. Linked data attaches these to the objects of a model: a file, a web link, a short text or an identifier, with a title, a category and who added it when. The steps are on Link data to objects and Link data to objects from code; this page explains what happens to a link when the model changes.
Not in the IFC#
BIM.works keeps linked data itself, next to the model: the metadata, links, texts and identifiers in its database, the file bytes in its file storage. Linking, editing and deleting never create a version, and the versions, their files and everything derived from them stay exactly as they were.
Writing the links into the IFC would make every link a new version, and the next export from the authoring tool would drop the links only BIM.works knows about. Files cannot live in an IFC anyway. The documents an IFC file carries itself (IfcDocumentReference) are a different thing: they belong to their version and are never turned into linked data.
How a link follows its object#
A link is made on one version of a model node, its first version, and records the object as it is there: its object id, its GlobalId, its IFC type and its name. From there it follows the object forward, from each version to the next, by the first of these rules that finds it:
- The same object id, when the newer version was made from the older one by a BUL transaction, a schema conversion or a branch, which keep object ids, or when it is a new upload of the identical file.
- A pair someone fixed by hand in a compare of the two versions (Comparing versions).
- The GlobalId, after a new upload, which numbers the objects anew. One object with that GlobalId is the object; two or more are shown on the first and marked check.
- Type and place, when the authoring tool gave a re-modelled object a new GlobalId: an object of the same IFC type and size, new in this version, within 500 mm (
linked_data.rescue_distance_mm). It is marked check until someone confirms it. - Otherwise the link is orphaned.
Six versions of a small model with four links on it. Pick a version to see how each link finds its object there, or why it cannot.
The follow runs as soon as a version is created, and again before any read of a version it has not reached yet, so a list of linked data is never out of date. A link made on an older version is followed up to the newest at once.
Check and orphaned#
A link is never moved to another object silently. It is shown without remark only when the object id is the same within one line of edits, the file is the same, a person paired the objects, or the GlobalId is equal and unique. Everything else that is shown is marked check: BIM.works found an object, and a person should confirm it is the right one. A check stays on the later versions too, whatever rule finds the object there, until someone confirms it.
An orphaned link has no object in a version: a transaction deleted it, or an upload has nothing with its GlobalId. The link is kept, with the GlobalId, type and name of the object it was last on, and every later version looks for that GlobalId again. When an upload brings it back, the link is shown again (resumed).
Two things settle a link by hand. Confirm says the object BIM.works found is the right one: the check goes away on that version and the later ones, and the compare of the two versions pairs the objects the same way from then on. Re-attach puts a link on another object from a version on: a link marked check that is on the wrong one of two objects, an orphaned link whose object was replaced by another, or a link that was followed onto the wrong object. The older versions keep the object they had, and the later versions follow the new object, by its GlobalId after an upload.
A pair fixed in a compare after the link was followed onto that version does not move it: re-attach the link instead.
Links added in later versions#
A link shows from its first version on. Someone looking at version 4 may still want the datasheet a colleague linked on version 9, because the pump was already there. Also show links added in later versions is a view option for that, off by default: the same rules then look backwards, from the link's first version down to the one being viewed. A pair someone fixed in a compare, or confirmed on a link, counts in this direction too. Such links are listed apart, marked with the version they were added on, and never counted in that version's own numbers; they are changed (ended, unlinked, re-attached) on their own versions only. Looking back stops for good at the first version where the object is not found: an object that a transaction created has no past, and an object that only appears later has nothing to come back to. BIM.works looks back once, the first time someone asks for an older version, and keeps what it found.
Ending and deleting#
A link can be ended from a version on: the older versions keep it, and it is neither shown nor followed from that version on. Replacing does that and more, for the datasheet of a pump that was swapped: the new item goes on every object the old one is on in that version, the old one's links end there, and each says which replaced which. Deleting removes an item from every object on every version, because a delete says the data was wrong. A deleted item can be restored for 30 days (linked_data.retention_days); after that its content is purged, and only a note of who added it, when, and who purged it stays. The content of an item never changes: a new datasheet is a new item.
A copy of a model, such as the models in every account's Demo folder, gets the source's links as items of its own on the same stored files, so nothing is stored twice and deleting on one side leaves the other. A photo keeps its location and camera details unless the person who links it asks to remove them; the photo itself is not changed by that.
In queries#
BQL reads linked data with the linkedData feature, on the version a query runs on: WHERE NOT linkedData.any finds the objects nothing is linked to, linkedData.category = "Certificate" AND linkedData.expiresInDays < 90 the certificates that expire within three months, and GET linkedData lists the items per object (Linked data).
Storage, compression and sync#
This section is for administrators.
- Where. Web links, identifiers and texts up to 16 KiB are kept in the item's database row. Files, and longer texts, go to the instance's file storage under
linkeddata/. - Cleaned up. Once a day every node purges the items deleted longer ago than the retention period, removes stored files no item refers to any more, and sweeps upload leftovers. Trim's store sweep removes a file without a row only when it finds it on two runs in a row. A super admin can purge an item at once, for a legal reason with its title and file name blanked as well.
- Stored once. A file is stored under the SHA-256 of its bytes and never written again, however often it is linked. This is internal: no API takes a hash instead of the bytes, so nobody can find out whether a file is already stored for another account.
- Compressed when it pays. Text-like formats (CSV, JSON, XML, IFC, DXF) are always compressed with zstd, formats that are already compressed (JPEG, MP4, ZIP, DOCX) never, and the rest (PDF, DWG, TIFF) only when a trial on the first MiB saves at least 10 %. A compressed file is stored as seekable 4 MiB frames. A browser that accepts zstd downloads the stored bytes as they are; other clients get them decoded, so a download is always the file as uploaded. Linked data file types lists the class of every extension.
- Checked. An upload must have an allowed extension, its content must be what the extension says, and programs, scripts, HTML and Office files with macros are refused whatever their name (the list). A file may be up to 100 MiB (
linked_data.max_file_bytes). - Served safely. "Open", the previews and the players fetch a file from a URL that is signed for one item and expires after 10 minutes; BIM.works checks the reader's rights before it signs. The URL supports byte ranges, so a PDF viewer or a video player fetches only what it shows, and a range of a compressed file decodes only the 4 MiB frames it overlaps. Only PDF, JPEG, PNG, GIF, WebP, MP4, WebM, MP3, M4A, OGG, WAV and text are shown in the browser; every other type, SVG included, is sent as a download, and every answer forbids the browser to guess a type, run scripts or load anything else. With
linked_data.content_originset, files are served from a host name of their own, so they never share an origin with the app; the proxy then forwards only/linkeddata/content/on that name. - Synced. On a fleet a file is stored like an uploaded model, on every node before the upload returns, and before its rows are written, so no node sees an item whose file has not reached it. When a node is down the upload fails with
REPLICATION_FAILEDand leaves nothing behind. The rows sync like the rest of the database. Two nodes that store the same file write the same bytes under the same name, so they never conflict. - Configured in the instance's
linked_datasection, which is applied without a restart:
linked_data:
max_file_bytes: 104857600 # 100 MiB per file
max_inline_bytes: 16384 # a longer text is stored as a file
extensions: [default] # the default list; [default, -dwg] takes DWG off it
url_schemes: [https, http, mailto, tel]
categories: [Datasheet, Manual, Certificate, Warranty, Maintenance, Photo, Drawing, Report, Contract, Other]
retention_days: 30 # how long a deleted item can be restored
content_origin: https://files.example.com # optional: serve files from their own host nameA category outside the list is refused, unless the list ends in "*".