.. index:: single: asp_output
.. _asp_output/0:

.. rst-class:: right

**object**

``asp_output``
==============

Whole-document Clingo and Zetesis JSON output decoding.

| **Availability:** 
|    ``logtalk_load(asp(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-11-15

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Uses:**
|    :ref:`asp_program <asp_program/0>`
|    :ref:`asp_symbols <asp_symbols/0>`
|    :ref:`json(ObjectRepresentation,PairRepresentation,StringRepresentation) <json/3>`
|    :ref:`list <list/0>`
|    :ref:`type <type/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: decode/8
.. _asp_output/0::decode/8:

``decode/8``
^^^^^^^^^^^^

Decodes CLI JSON and process metadata into a collected ``asp_result(Status, Models, Properties)`` term.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``decode(Solver,Codes,RawStatus,NormalizedStatus,Diagnostics,SourceMap,Result,Options)``
| **Mode and number of proofs:**
|    ``decode(+atom,+list(code),+term,+compound,+list(code),+list(compound),-compound,+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Solver`` is a variable:
|        ``instantiation_error``
|    ``Solver`` is neither a variable nor an atom:
|        ``type_error(atom,Solver)``
|    ``Solver`` is an atom but not a valid ASP solver:
|        ``domain_error(asp_solver,Solver)``
|    ``Codes`` is a partial list or a list with an element ``Element`` which is a variable:
|        ``instantiation_error``
|    ``Codes`` is neither a partial list nor a list of character codes:
|        ``type_error(codes,Codes)``
|    ``Codes`` does not contain parsable JSON:
|        ``domain_error(json,codes(Codes))``
|    A JSON field has an invalid type or value:
|        ``domain_error(asp_output,Field-Value)``
|    A JSON field required by the selected solver output schema is missing:
|        ``domain_error(asp_output,Field-missing)``
|    The JSON simultaneously reports a time limit and another interruption:
|        ``domain_error(asp_output,interruption_flags)``
|    A shown value is not a supported symbol:
|        ``domain_error(asp_symbol,Codes)``
|    A numeric symbol cannot be represented as an integer:
|        ``representation_error(asp_integer)``
|    ``RawStatus`` is not a ground term:
|        ``instantiation_error``
|    ``NormalizedStatus``` is not a ground term:
|        ``instantiation_error``
|    ``NormalizedStatus`` is fatal or inconsistent with the decoded solver result:
|        ``domain_error(asp_process_status,NormalizedStatus)``
|    ``Diagnostics`` is a partial list or a list with an element ``Element`` which is a variable:
|        ``instantiation_error``
|    ``Diagnostics`` is neither a partial list nor a list of character codes:
|        ``type_error(codes,Diagnostics)``
|    ``SourceMap`` is a partial list or a list with an element ``Element`` which is a variable:
|        ``instantiation_error``
|    ``SourceMap`` is neither a variable nor a list:
|        ``type_error(list,SourceMap)``
|    ``Options`` is a variable:
|        ``instantiation_error``
|    ``Options`` is neither a variable nor a list:
|        ``type_error(list,Options)``
|    An element ``Option`` of the list ``Options`` is a variable:
|        ``instantiation_error``
|    An element ``Option`` of the list ``Options`` is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the list ``Options`` is a compound term but not a valid option:
|        ``domain_error(option,Option)``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

