Class
Resource
A resource manages model objects and provides EMF-compliant reference resolution.
@globalActor actor Resource
Overview
Resources serve as containers for model objects, providing identity-based storage and resolution capabilities. They enable cross-reference resolution, URI-based addressing, and proper object lifecycle management following EMF patterns.
Thread Safety
Resources are thread-safe actors that manage concurrent access to model objects and provide atomic reference resolution operations.
Example
let resource = Resource(uri: "http://example.com/mymodel")
// Add objects to resource
let person = DynamicEObject(eClass: personClass)
resource.add(person)
// Resolve references by ID
if let resolved = resource.resolve(person.id) {
print("Found object: \(resolved)")
}
Topics
Initializers
Initialises a new resource with the specified URI.
Instance Properties
Enable debug output.
The resource set that owns this resource, if any.
The URI identifying this resource.
Instance Methods
Adds an object to this resource.
Removes all objects from this resource.
Checks if this resource contains an object with the specified identifier.
Gets the number of objects in this resource.
Create an EAttribute from a DynamicEObject with full cross-reference resolution.
Create an EClass from a DynamicEObject with full cross-reference resolution.
Create an EEnum from a DynamicEObject with full cross-reference resolution.
Create an EPackage from a DynamicEObject with full cross-reference resolution.
Create an EReference from a DynamicEObject with full cross-reference resolution.
Gets a feature value from an object managed by this resource.
Modifies a feature value on an object managed by this resource.
Enable or disable debug mode.
Gets all instances of a specific EClass in this resource.
Gets all objects contained in this resource. Gets all objects in this resource in insertion order.
Get all feature names for an object
Gets an object by its ID, used for ATL lazy binding resolution.
Gets all root objects in this resource.
Registers an object with this resource without adding it as a root object.
Removes an object from this resource.
Removes an object from this resource by its identifier.
Resolves an object by its identifier.
Resolves an object by its identifier with a specific type.
Resolves an object by its URI path within this resource.
Resolves the opposite reference for a bidirectional reference.
Resolve pending opposite references after all EReference objects are created.
Resolves a reference to its target objects.
Resolve a data type reference for an EAttribute.
Resolve the concrete EStructuralFeature type from a DynamicEObject.
Resolve a reference type for an EReference.
Resolves the concrete EClassifier type from a DynamicEObject.
Sets the resource set that owns this resource.
Type Properties
Global resource actor for thread-safe operations.
Default Implementations
Relationships
Conforms To
See Also
Resources and Serialisation
A resource set manages multiple resources and enables cross-resource reference resolution.
Parser for XMI (XML Metadata Interchange) files
Serialises EMF objects to XMI (XML Metadata Interchange) format
Parser for JSON files in emfjson/pyecore format
Serializes EMF objects to JSON format (emfjson/pyecore compatible)