Skip to content

Features

dependency_graph

This module contains the classes for building a dependency graph from an ASP document.

DependencyGraph dataclass

Dependency graph of an ASP document.

nodes: list[DependencyGraphNode] instance-attribute

The nodes of the dependency graph.

from_document(documents: list[Document]) -> 'DependencyGraph' staticmethod

Create a dependency graph from a list of ASP documents.

Parameters:

Name Type Description Default
documents list[Document]

The list of documents to create the graph from.

required

Returns:

Type Description
'DependencyGraph'

The dependency graph.

DependencyGraphNode dataclass

Dependency graph node.

negative: set[str] instance-attribute

The negative dependencies of the predicate.

positive: set[str] instance-attribute

The positive dependencies of the predicate.

signature: str instance-attribute

The predicate this node represents.

encoding_info

This module contains the classes for building a dependency graph from an ASP document.

Encoding dataclass

source: str instance-attribute

Raw source code of the encoding.

EncodingInfo dataclass

Content of the encoding including statements and lines.

from_documents(documents: list[Document]) -> EncodingInfo staticmethod

Create a encoding content from an ASP document.

Parameters:

Name Type Description Default
document

The ASP document.

required

Returns:

Type Description
EncodingInfo

The encoding content.

EncodingLine dataclass

Line in the encoding.

str_content: str instance-attribute

Content of the line

type: str instance-attribute

Wither code or md

EncodingLineType

Type of the encoding line.

CODE = 'code' class-attribute instance-attribute

Code line

MD = 'md' class-attribute instance-attribute

Markdown line

is_clingo_code(code: str) -> bool

Check if the given code is clingo code.

Parameters:

Name Type Description Default
code str

The code to check.

required

Returns:

Type Description
bool

True if the code is clingo code, False otherwise.

predicate_info

PredicateInfo dataclass

predicates: Dict[str, Predicate] = field(default_factory=OrderedDict) class-attribute instance-attribute

Dictionary of predicates with their signatures as keys.

from_documents(documents: dict[Document]) -> PredicateInfo staticmethod

Create a predicate list from a list of documents.

Parameters:

Name Type Description Default
documents dict[Document]

The documents to create the predicate list from.

required

Returns:

Type Description
PredicateInfo

The predicate list.