trudag.dotstop.core.item
Classes for managing the items in a TrustableGraph.
Item
Item(
name: str,
text: str = "",
normative: bool = True,
unresolved_references: list[BaseReference]
| None = None,
resolved_references: list[ResolvedReference]
| None = None,
validator_config: dict | None = None,
sme_scores: dict[str, float | dict[str, float | str]]
| float
| None = None,
fallacies: dict[str, Fallacy] | None = None,
order: ItemOrder | None = None,
)
A representation for a falsifiable statement and its associated properties.
name
property
The name of the item constructed from two parts, separated by a hyphen: DOCUMENT-ID
DOCUMENTis the document prefix and may contain any alphanumeric or special character expect.and". Items with the same document prefix are grouped together in aTrustableGraph.IDis used to uniquely identify the item within a document. ID may contain any alphanumeric or special character except.and-.
Example
Item with a name TSF-ITEM_1 is within the TSF document, uniquely identified in this document as ITEM_1.
text
property
The statement associated with a normative item. If the item is not normative this can be any text.
add_namespace
Namespaces the item by prepending its name with the namespace name, followed by a ..
header
A short text summary of the item, containing more information than the name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_name
|
bool
|
Prepend the item's name to the header. |
True
|
references
references() -> list[ResolvedReference]
Returns references in resolved form.
Unresolved references are resolved lazily, This is an in-place operation, the unresolved state is lost.
validation
validation(validator: Validator) -> dict[str, Any]
Computes the validator score for the item if there exists a validator config and returns the validation result object.
ItemOrder
dataclass
Storage for item ordering properties.
create_default_item_markdown
create_default_item_markdown(name: str, dir: Path) -> Item
Create a default item, writes it in markdown in dir.
item_from_markdown
item_from_markdown(
item_name: str,
md_content: str,
reference_builder: ReferenceBuilder = ReferenceBuilder(),
) -> Item
Creates an item from markdown content.
migrate_to_versioned_schema
This is a conversion function for artifact schemas before the addition of artifact version to be compatible with the artifact schemas after the addition of artifact version This should be removed in the next release, see : https://gitlab.eclipse.org/eclipse/tsf/tsf/-/issues/492
need_as_markdown
need_as_markdown(item: Item, namespace: str) -> str
Creates a markdown string for a needs item.