ontocast.onto.blank_structures¶
Blank nodes as structures: an OWL restriction, an RDF list, an anonymous axiom.
A blank node has no name of its own, so a statement about it means nothing
apart from the statements that reach it. A structure is a set of blank nodes
connected to each other through statements, with every statement whose subject
is one of them. Its inbound statements are those whose named subject points
at one of its nodes (home:C rdfs:subClassOf _:r), and their subjects are
its anchors. A structure is filed, kept and removed as one piece: half a
restriction is not a restriction.
Attributes¶
Triple = tuple[Node, Node, Node]
module-attribute
¶
__all__ = ['BlankStructure', 'blank_structures', 'remove_with_structures', 'structure_closure']
module-attribute
¶
Classes¶
BlankStructure
dataclass
¶
Connected blank nodes, their statements and what points at them.
Source code in ontocast/onto/blank_structures.py
Attributes¶
anchors
property
¶
The named subjects that point at the structure.
inbound
instance-attribute
¶
nodes
instance-attribute
¶
references
property
¶
The named IRIs the structure's own statements use, as predicate or object.
triples
instance-attribute
¶
Methods:¶
__init__(nodes, triples, inbound)
¶
Functions:¶
blank_structures(graph)
¶
Every blank-node structure of graph, in no particular order.
Source code in ontocast/onto/blank_structures.py
remove_with_structures(graph, doomed)
¶
Remove doomed and every structure it would leave broken.
See :func:structure_closure. Returns the number of statements removed.
Source code in ontocast/onto/blank_structures.py
structure_closure(graph, doomed)
¶
doomed plus every blank-node structure its removal would leave broken.
A structure goes whole, with the statements pointing at it, when one of its
own statements is doomed (it would be left partial) or when every statement
pointing at it is doomed (it would be left orphaned). An unanchored
structure goes only when one of its own statements is doomed. Statements of
doomed that are not in graph are kept in the result.