Class
ResourceSet
A resource set manages multiple resources and enables cross-resource reference resolution.
@globalActor actor ResourceSet
Overview
ResourceSets provide a container for multiple resources, enabling complex models that span multiple files or logical units. They maintain a registry of metamodels by namespace URI and provide cross-resource reference resolution capabilities.
Thread Safety
ResourceSets are thread-safe actors that coordinate access to multiple resources and provide atomic cross-resource operations.
Example
let resourceSet = ResourceSet()
// Register a metamodel
resourceSet.registerMetamodel(companyPackage, uri: "http://company/1.0")
// Create resources
let modelResource = resourceSet.createResource(uri: "models/company.xmi")
let instanceResource = resourceSet.createResource(uri: "instances/acme.xmi")
// Cross-resource references are automatically resolved
Topics
Initializers
Initialises a new resource set with empty registries.
Instance Methods
Converts a logical URI to its physical equivalent.
Gets the number of resources in this resource set.
Creates a new resource with the specified URI.
Gets a metamodel package by its namespace URI.
Gets all registered metamodel URIs.
Gets a resource by its URI, loading it if necessary.
Gets a resource factory for a given URI.
Gets all resources in this resource set.
Load a JSON resource from a file URL
Load an XMI resource from a file URL
Maps a logical URI to a physical URI.
Normalises a URI by applying registered conversions and cleanup.
Registers a metamodel package with its namespace URI.
Registers a resource factory for handling specific file extensions or URI patterns.
Removes a resource from this resource set.
Removes a resource by its URI from this resource set.
Resolves an object by its identifier across all resources in the set.
Resolves an object by its URI across all resources in the set.
Resolves the opposite reference for a bidirectional reference across all resources.
Synchronous version for internal use within Resource
Unregisters a metamodel by its namespace URI.
Updates the opposite side of a bidirectional reference across resources.
Type Properties
Global resource set actor for thread-safe operations.
Default Implementations
Relationships
Conforms To
See Also
Resources and Serialisation
A resource manages model objects and provides EMF-compliant 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)