Profiles
Three profiles ship built-in, each extending the previous one:
research— the scientific-provenance vocabulary: statement types (claim,finding,result, …) plusevidenceandactivity.article— adds the shape for representing a paper as a graph: anarticleroot, asummary_pointlayer (contains/summarizesedges), andquantity/factdetail nodes.project— addsquestionandhypothesisnodes and theaddresses/answers/testsedges that wire a research project's question → hypothesis → test → answer loop.
Validate a graph against a chosen profile with get_profile(name).validate(g)
or ideagraph doctor --profile <name>.
A project graph closes its loop with two operations: conclusion_status(g)
reports whether the question is answered (a result answers it, backed by
evidence, with every addressing hypothesis resolved), and
promote(g, article_id=...) carves the project's own new knowledge into a fresh
article graph for the cache — gated on conclusion, with edges into imported
nodes rewired as cross-article citations. The CLI equivalent is
ideagraph promote (--check reports status without promoting).
Built-in knowledge-graph profiles and their semantics.
Importing this package registers the bundled profiles (currently research)
so they are available via :func:ideagraph.kg.profile.get_profile. The
research-profile semantics (coverage, validation, staleness) are re-exported
here for convenience.
ActivityKind
¶
Bases: StrEnum
The type of process an activity represents.
Source code in src/ideagraph/kg/profiles/research.py
66 67 68 69 70 71 72 73 74 | |
ConclusionResult
dataclass
¶
Whether a project graph's question is concluded.
Attributes:
| Name | Type | Description |
|---|---|---|
concluded |
bool
|
True when nothing blocks the conclusion. |
reasons |
tuple[str, ...]
|
Human-readable reasons the project is not concluded (empty when it is). |
Source code in src/ideagraph/kg/profiles/project_ops.py
34 35 36 37 38 39 40 41 42 43 44 45 | |
Coverage
dataclass
¶
How one assertion node is supported by evidence.
Attributes:
| Name | Type | Description |
|---|---|---|
node_id |
str
|
The assertion node's id. |
has_own |
bool
|
Whether any first-hand evidence supports it. |
has_literature |
bool
|
Whether any literature evidence supports it. |
has_other |
bool
|
Whether any other-kind evidence supports it. |
evidence_kinds |
list[str]
|
The kinds of all supporting evidence, in edge order. |
Source code in src/ideagraph/kg/profiles/research_ops.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
category
property
¶
The support category: unsupported / own / literature / both / other.
supported
property
¶
Whether the assertion has any supporting evidence.
to_dict()
¶
Serialise the coverage record.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary representation. |
Source code in src/ideagraph/kg/profiles/research_ops.py
82 83 84 85 86 87 88 89 90 91 92 93 94 | |
EvidenceKind
¶
Bases: StrEnum
The type of artefact a piece of evidence points at.
Source code in src/ideagraph/kg/profiles/research.py
43 44 45 46 47 48 49 50 51 52 53 54 55 | |
EvidenceRelation
¶
Bases: StrEnum
How a piece of evidence bears on a claim.
Source code in src/ideagraph/kg/profiles/research.py
58 59 60 61 62 63 | |
NodeType
¶
Bases: StrEnum
The category of a node for relation-endpoint reasoning.
Source code in src/ideagraph/kg/profiles/research.py
77 78 79 80 81 82 83 84 | |
ProvenancePredicate
¶
Bases: StrEnum
The vocabulary of edge types in the research profile.
Source code in src/ideagraph/kg/profiles/research.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
StatementStatus
¶
Bases: StrEnum
Validation status of an assertion statement.
Source code in src/ideagraph/kg/profiles/research.py
33 34 35 36 37 38 39 40 | |
StatementType
¶
Bases: StrEnum
The rhetorical role a statement node plays.
Source code in src/ideagraph/kg/profiles/research.py
20 21 22 23 24 25 26 27 28 29 30 | |
ValidationResult
dataclass
¶
The outcome of validating one assertion node against its evidence.
Attributes:
| Name | Type | Description |
|---|---|---|
node_id |
str
|
The validated node's id. |
status |
str
|
The resolved status token. |
supporting |
list[str]
|
Ids of evidence linked by |
refuting |
list[str]
|
Ids of evidence linked by |
reason |
str
|
A human-readable explanation. |
Source code in src/ideagraph/kg/profiles/research_ops.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
apply_all(graph)
¶
Validate every assertion node and write each status back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to validate and update in place. |
required |
Returns:
| Type | Description |
|---|---|
list[ValidationResult]
|
The results, one per assertion node. |
Source code in src/ideagraph/kg/profiles/research_ops.py
230 231 232 233 234 235 236 237 238 239 240 | |
apply_validation(graph, node_id)
¶
Validate a node and write the resolved status into its properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph. |
required |
node_id
|
str
|
The node to validate and update. |
required |
Returns:
| Type | Description |
|---|---|
ValidationResult
|
The validation result whose status was applied. |
Source code in src/ideagraph/kg/profiles/research_ops.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
conclusion_status(graph)
¶
Report whether a project graph's question has been answered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The project graph. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
ConclusionResult
|
class: |
Source code in src/ideagraph/kg/profiles/project_ops.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
coverage(graph)
¶
Classify support origin for every assertion node in a graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to analyse. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Coverage]
|
A mapping from assertion node id to its coverage. |
Source code in src/ideagraph/kg/profiles/research_ops.py
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 | |
evidence_changed(node, current_digest)
¶
Report whether an evidence node's artefact has drifted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
Node
|
The evidence node holding a baseline |
required |
current_digest
|
str | None
|
The artefact's current digest, or None if unknown. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/ideagraph/kg/profiles/research_ops.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
find_stale_assertions(graph, resolver)
¶
Return assertion nodes with at least one changed supporting evidence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to sweep. |
required |
resolver
|
DigestResolver
|
Resolves an evidence node's current digest (or None). |
required |
Returns:
| Type | Description |
|---|---|
list[Node]
|
The affected assertion nodes, in insertion order. |
Source code in src/ideagraph/kg/profiles/research_ops.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
find_stale_evidence(graph, resolver)
¶
Return evidence nodes whose artefact has changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to sweep. |
required |
resolver
|
DigestResolver
|
Resolves an evidence node's current digest (or None). |
required |
Returns:
| Type | Description |
|---|---|
list[Node]
|
The changed evidence nodes. |
Source code in src/ideagraph/kg/profiles/research_ops.py
263 264 265 266 267 268 269 270 271 272 273 274 | |
graph_from_legacy(data)
¶
Convert a legacy provenance-graph dict into a KnowledgeGraph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
A legacy |
required |
Returns:
| Type | Description |
|---|---|
KnowledgeGraph
|
The equivalent generic knowledge graph (research profile). |
Source code in src/ideagraph/kg/profiles/research_compat.py
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 | |
mark_stale(graph, resolver)
¶
Flip affected valid assertion nodes to stale and return them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to update in place. |
required |
resolver
|
DigestResolver
|
Resolves an evidence node's current digest (or None). |
required |
Returns:
| Type | Description |
|---|---|
list[Node]
|
The assertion nodes whose status changed to |
Source code in src/ideagraph/kg/profiles/research_ops.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
promote(graph, *, article_id)
¶
Promote a concluded project's own knowledge into a new article graph.
Keeps every node the project produced itself (those without a
source_gid stamp) and the edges among them; edges into imported nodes are
rewired as cross-article references to the imported node's origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The concluded project graph. |
required |
article_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
KnowledgeGraph
|
A new :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the project is not concluded. |
Source code in src/ideagraph/kg/profiles/project_ops.py
76 77 78 79 80 81 82 83 84 85 86 87 88 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 | |
validate_all(graph)
¶
Validate every assertion node without mutating the graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph to validate. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ValidationResult]
|
A mapping from node id to validation result. |
Source code in src/ideagraph/kg/profiles/research_ops.py
199 200 201 202 203 204 205 206 207 208 209 | |
validate_node(graph, node_id)
¶
Resolve an assertion node's status from its supporting/refuting evidence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
KnowledgeGraph
|
The graph holding the node and its evidence. |
required |
node_id
|
str
|
The id of the node to validate. |
required |
Returns:
| Type | Description |
|---|---|
ValidationResult
|
The validation result. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the node is not held by the graph. |
Source code in src/ideagraph/kg/profiles/research_ops.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |