ontocast.link.clusters¶
Read-time clusters: which stored entities are one, from the resolution graph.
Links only propose: two entities linked to one match node are candidates. A cluster joins candidates in a fixed order (stronger evidence first, then by IRI) and never joins two clusters that a veto separates, so the answer depends on the stored documents and declarations, not on their order.
Vetoes, all declared or structural:
- both entities are in one document graph (its aggregation kept them apart);
- their types are declared disjoint;
- a property the catalog caps at one value has disjoint values on each;
- a key that applies to both has different complete values.
An object IRI local to one document cannot be compared with another document's, so it never counts as a conflicting value.
Attributes¶
DEFAULT_MAX_CANDIDATES = 500
module-attribute
¶
Classes¶
ClusterMember
¶
Bases: BaseModel
One entity of a cluster.
Source code in ontocast/link/clusters.py
Attributes¶
graph = Field(description='The document graph that holds the entity.')
class-attribute
instance-attribute
¶
iri
instance-attribute
¶
labels = Field(default_factory=list)
class-attribute
instance-attribute
¶
reason = Field(description='`self` for the entity asked about, else the strongest kind of link it shares with the cluster (key, ifp, identifier, label).')
class-attribute
instance-attribute
¶
types = Field(default_factory=list)
class-attribute
instance-attribute
¶
via = Field(default_factory=list, description='Match nodes it shares with the cluster.')
class-attribute
instance-attribute
¶
EntityCluster
¶
Bases: BaseModel
The entities stored as one with iri, and the candidates kept apart.
Source code in ontocast/link/clusters.py
KeptApart
¶
Bases: BaseModel
A candidate that shares a match node with the cluster but is not in it.
Source code in ontocast/link/clusters.py
Functions:¶
cluster_of(store, declarations, iri, *, max_candidates=DEFAULT_MAX_CANDIDATES)
async
¶
The cluster of the stored entity iri, or None when no document holds it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store
|
TripleStoreManager
|
The triple store holding the documents and their links graphs. |
required |
declarations
|
IdentityDeclarations
|
The catalog's identity declarations. |
required |
iri
|
str
|
An entity of some document graph. |
required |
max_candidates
|
int
|
Stop collecting candidates beyond this many. |
DEFAULT_MAX_CANDIDATES
|
Source code in ontocast/link/clusters.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |