ontocast.agent.render_facts¶
Fact rendering agent for OntoCast.
This module provides functionality for rendering facts from RDF graphs into human-readable formats, making the extracted knowledge more accessible and understandable.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Functions:¶
render_facts(state, tools, supplemental_ontologies=None)
async
¶
Extract a unit's facts from its text.
There is one renderer because there is one render. The loop retries this only when it fails; a unit that rendered successfully is improved by the critic passes, which apply a compiled patch rather than asking for the graph to be written again. The update-mode renderer this used to dispatch to had become unreachable: it keyed on the unit graph being non-empty, and nothing populates that except a successful render, after which the render loop is already done.
The ontology renderer still has both modes, and for a reason that does not apply here: it keys on the retrieved snapshot, a different field from the one it writes, so its update mode is the normal path whenever a catalog exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
UnitFactsState
|
The current unit facts state. |
required |
tools
|
AtomicToolBox
|
The toolbox containing necessary tools. |
required |
supplemental_ontologies
|
Sequence[Ontology] | None
|
Extra ontologies for prefix resolution. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
UnitFactsState |
UnitFactsState
|
Updated state with rendered facts. |
Source code in ontocast/agent/render_facts.py
render_facts_fresh(state, tools, supplemental_ontologies=None)
async
¶
Render fresh facts from the current chunk into Turtle format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
UnitFactsState
|
The current unit facts state containing the chunk to render. |
required |
tools
|
AtomicToolBox
|
The toolbox instance providing utility functions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
UnitFactsState |
UnitFactsState
|
Updated state with rendered facts. |
Source code in ontocast/agent/render_facts.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |