Based on the discussion around T56085 and previously on T101752, I propose to add support for "foreign" EntityIds[*] as follows described below:
[*let's reserve "external" for the external-id property data type]
* EntityId gets an additional field `repository`, which contains the logical name of the repository that the ID refers to. This serves as a namespace mechanism for entity IDs. The name used to refer to a given repo is local, and can differ from client to client.
* repository names can be used to look up the repository Site object, which in turn allows the ID to be mapped to the currect URI, URL, or api path for the repo it belongs to.
* The empty repository name "" refers to the local wiki.
* The serialization of the EntityId follows the pattern `<repository>:<id>`. If `<repository>` is empty, the leading ":" is optional. This format follows the convention set by XML namespaces, RDF prefixes, and MediaWiki interwiki links.
* Repository names can be mapped during serialization and deserialization.
* When reading data from a another repo, repo names in entity ids get mapped from the names used on the other repo to the names used on the local wiki. In particular, the empty prefix is mapped to the foreign repo's name while reading ids.
* When writing data to a another repo, repo names in entity ids get mapped from the names used on the local wiki to the names used on the foreign repo. In particular, the foreign wiki's name is mapped to the empty prefix.
* The repo name in an EntityId object can always be assumed to match the local definition of that name. A repo name in serialized data however cannot be interpreted without knowing which repo it came from.