ontocast.tool.facts_validation.grounding¶
Whether a value says what its text says.
A value (an instance of a value class, blank or named) states numbers and
names individuals (:func:~ontocast.tool.facts_validation.statements.value_components).
Two checks read it against the content unit's text:
- each number is grounded: the text writes it in digits
(:func:
~ontocast.util.numeric_inventory.stated_numbers), or in number words within a label of the value that the text writes verbatim, up to case and spacing (:func:~ontocast.util.numeric_inventory.worded_numbers), as written or rescaled by a power of ten (:func:~ontocast.util.numeric_inventory.grounds). A label the text does not write grounds nothing, since the model wrote it. A fraction, a converted value, or a conventional value for a vague phrase is not stated; - each individual whose property's range is a closed class agrees with the
catalog's cues written next to the value's numbers -- in the value's label
when it writes the number, the value's own mention, else in the text: the
skos:altLabel, notation and symbol literals of that class's individuals (:func:~ontocast.util.numeric_inventory.cue_index). A cue of another individual, and none of its own, contradicts it, when the individual has cues of its own in the catalog.
Both act only on value nodes: a graph without values gets no finding, and a catalog without cues gives no contradiction.
Attributes¶
__all__ = ['node_key', 'node_name', 'node_of', 'value_grounding_findings', 'value_nodes']
module-attribute
¶
Classes¶
Functions:¶
node_key(node)
¶
How a finding names node: its IRI, or _: and a blank node's id.
node_name(graph, node)
¶
How a message names node: its IRI, or a blank value by its carrier.
A blank node's id differs from run to run, so a value is named by the first carrier and property that point at it, in IRI order, up to the first named carrier.
Source code in ontocast/tool/facts_validation/grounding.py
node_of(key)
¶
value_grounding_findings(scope, contract, text, ontology_graph)
¶
Ungrounded numbers and contradicted individuals of the values in scope.
ungrounded_number: a number of a value that text writes neither in
digits nor in the number words of a label of the value that text
writes verbatim ("five constituencies"), as written or rescaled by a power
of ten (1e3 is grounded by "1000", 0.05 by "5%"). Its
subject is the value (:func:node_key), predicate and value
the number's property and lexical form.
contradicted_individual: an individual of a value, on a property whose
range is a closed class, when a cue of another individual of that class,
and none of its own, is written next to one of the value's numbers: in
the value's label when the label writes the number, else in the text,
and the individual has cues of its own. Its value is the individual,
its suggestions the individuals the cue names. No individual is ever
proposed for a value that names none.
Needs the unit's text: with none, nothing is judged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
FactScope
|
The unit's fact scope. |
required |
contract
|
StatementContract
|
The catalog's statement contract (value classes, closed ranges). |
required |
text
|
str
|
The content unit's text. |
required |
ontology_graph
|
Graph | None
|
The unit's ontology context, where cues are read. |
required |
Returns:
| Type | Description |
|---|---|
list[FactsUnitFinding]
|
Mandatory findings, ordered by value then property. |
Source code in ontocast/tool/facts_validation/grounding.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
value_nodes(scope, contract)
¶
The fact nodes typed with a value class, blank or named, in a stable order.