Data Models
Entity
crategraph.core.models.Entity
dataclass
An immutable node in the graph.
types is stored as a tuple so the frozen contract extends to the
type list. properties is a plain dict for ergonomics — treat it
as read-only; mutating it will change graph state in place.
Source code in crategraph/core/models.py
has_data
property
Whether this entity is a data entity (file or directory).
Returns True if the entity has File or Dataset in its
types, per the RO-Crate specification. The root Dataset entity
is excluded (identified by the _is_root property flag set
during loading).
label
property
Human label via the shared name -> title -> id fallback, always a string.
name
property
Best display name: name property, falling back to id.
type
property
Display string joining all types (e.g. 'PublishedResource, Report').
Relationship
crategraph.core.models.Relationship
dataclass
An immutable directed edge in the graph.
Relationships with an id were reified nodes in the source format
(e.g. @type: Relationship items in an RO-Crate). Inline references
(e.g. preparedBy: {"@id": "..."})) have id=None.
properties is a plain dict for ergonomics — treat it as read-only;
mutating it will change graph state in place.
Source code in crategraph/core/models.py
FileInfo
crategraph.core.models.FileInfo
dataclass
Result of inspecting a data file.
Source code in crategraph/core/models.py
ViewInfo
crategraph.core.models.ViewInfo
dataclass
Result of viewing a data file — rich HTML preview.
Source code in crategraph/core/models.py
html
instance-attribute
Raw HTML — callers are responsible for escaping all data-sourced
content before including it here. This field is rendered unescaped
by _repr_html_.
SelectOptions
crategraph.core.models.SelectOptions
Bases: BaseModel
Parameters for structural filtering via Graph.select().
Source code in crategraph/core/models.py
ValidationReport
crategraph.core.models.ValidationReport
Bases: BaseModel
Result of running a validator against a graph.
Source code in crategraph/core/models.py
is_valid
property
A report is valid when it contains no error-level issues.