{"id":34046120,"url":"https://github.com/bramucas/xclingo2","last_synced_at":"2026-04-02T02:13:00.631Z","repository":{"id":37739608,"uuid":"422646949","full_name":"bramucas/xclingo2","owner":"bramucas","description":"A tool for explainability and debugging in Answer Set Programming.","archived":false,"fork":false,"pushed_at":"2025-03-25T08:18:56.000Z","size":231,"stargazers_count":15,"open_issues_count":7,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-12T05:44:13.768Z","etag":null,"topics":["answer-set-programming","debugging-tool","explainability","logic-programming"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bramucas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-29T16:40:48.000Z","updated_at":"2025-07-21T13:34:15.000Z","dependencies_parsed_at":"2024-10-22T11:14:44.473Z","dependency_job_id":null,"html_url":"https://github.com/bramucas/xclingo2","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"07e69273fe6a45b4586018d3c7f250ac370f9882"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bramucas/xclingo2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramucas%2Fxclingo2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramucas%2Fxclingo2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramucas%2Fxclingo2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramucas%2Fxclingo2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramucas","download_url":"https://codeload.github.com/bramucas/xclingo2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramucas%2Fxclingo2/sbom","scorecard":{"id":250951,"data":{"date":"2025-08-11","repo":{"name":"github.com/bramucas/xclingo2","commit":"07e69273fe6a45b4586018d3c7f250ac370f9882"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v2.0b4 not signed: https://api.github.com/repos/bramucas/xclingo2/releases/52983786","Warn: release artifact v2.0b4 does not have provenance: https://api.github.com/repos/bramucas/xclingo2/releases/52983786"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T08:27:05.823Z","repository_id":37739608,"created_at":"2025-08-17T08:27:05.823Z","updated_at":"2025-08-17T08:27:05.823Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["answer-set-programming","debugging-tool","explainability","logic-programming"],"created_at":"2025-12-13T23:36:20.753Z","updated_at":"2026-04-02T02:13:00.618Z","avatar_url":"https://github.com/bramucas.png","language":"Python","readme":"# xclingo\n\nA tool for explaining and debugging Answer Set Programs.\n\n***IMPORTANT:*** This is a new version of [xclingo](https://github.com/bramucas/xclingo). This version is intended to replace the previous one in the future.\n\n**xclingo** is a clingo-based tool which produces text explanations for the solutions of ASP programs. The original program must be annotated with clingo-friendly annotations and then provided to xclingo. \n\nAll the directives start with a ```%``` character, so they are recognized by clingo as comments and therefore they don't modify the meaning of the original program. In other words: a xclingo-annotated ASP program will still produce the original output when called with clingo. \n\n## Installation\n*Install with python3*\n\n```bash\npython3 -m pip install xclingo\n```\n\n## Short usage\nxclingo must be provided with a maximum number of solutions to be computed for the original program and with the maximum number of explanations to be printed for each solution.\n\nAn example (all the solutions and 2 explanations):\n```\nxclingo -n 0 2 examples/drive.lp\n```\n\nDefaults are 1 solution and 1 explanation.\n\n## Example\n\nWe have any ASP program:\n```\n% examples/dont_drive_drunk.lp\n\nperson(gabriel;clare).\n\ndrive(gabriel).\nalcohol(gabriel, 40).\nresist(gabriel).\n\ndrive(clare).\nalcohol(clare, 5).\n\npunish(P) :- drive(P), alcohol(P,A), A\u003e30, person(P).\npunish(P) :- resist(P), person(P).\n\nsentence(P, prison) :- punish(P).\nsentence(P, innocent) :- person(P), not punish(P).\n```\n\nAnd we write some special comments:\n```\n% examples/dont_drive_drunk.lp\n\nperson(gabriel;clare).\n\ndrive(gabriel).\nalcohol(gabriel, 40).\nresist(gabriel).\n\ndrive(clare).\nalcohol(clare, 5).\n\n%!trace_rule {\"% drove drunk\", P}\npunish(P) :- drive(P), alcohol(P,A), A\u003e30, person(P).\n\n%!trace_rule {\"% resisted to authority\", P}\npunish(P) :- resist(P), person(P).\n\n%!trace_rule {\"% goes to prison\",P}\nsentence(P, prison) :- punish(P).\n\n%!trace_rule {\"% is innocent by default\",P}\nsentence(P, innocent) :- person(P), not punish(P).\n\n%!trace {\"% alcohol's level is %\",P,A} alcohol(P,A).\n%!trace {\"% was drunk\",P} alcohol(P,A).\n\n%!show_trace sentence(P,S).\n```\nWe will call those comments *annotations* from now on.\n\nNow we can obtain the answer sets of the (annotated) program with clingo (```clingo -n 0 examples/dont_drive_drunk.lp```):\n```\nAnswer: 1\nperson(gabriel) person(clare) alcohol(gabriel,40) alcohol(clare,5) drive(gabriel) drive(clare) punish(gabriel) resist(gabriel) sentence(clare,innocent) sentence(gabriel,prison)\nSATISFIABLE\n```\n\nBut also very fashion natural language explanations of with xclingo (```xclingo -n 0 0 examples/dont_drive_drunk.lp```):\n```\nAnswer 1\n  *\n  |__clare is innocent by default\n\n  *\n  |__gabriel goes to prison\n  |  |__gabriel drove drunk\n  |  |  |__gabriel alcohol's level is 40;gabriel was drunk\n\n  *\n  |__gabriel goes to prison\n  |  |__gabriel resisted to authority\n```\n\n*Note:* for this small example almost all the rules and facts of the program have its own text label (this is, they have been *labelled*). Actually, only labelled rules are used to build the explanations so you can still obtain clear, short explanations even for most complex ASP programs.\n\n## Annotations\n\n### %!trace_rule\nAssigns a text to the atom in the head of a rule.\n```\n%!trace_rule {\"% resisted to authority\", P}\npunish(P) :- resist(P), person(P).\n```\n\n### %!trace\nAssigns a text to the set of atoms produced by a conditional atom.\n```\n%!trace {\"% alcohol's level is above permitted (%)\",P,A} alcohol(P,A) : A\u003e40.\n```\n\n### %!show_trace\nSelects which atoms should be explained via conditional atoms.\n```\n%!show_trace sentence(P,S).\n```\n\n### %!mute\nMark some atoms as *untraceable*. Therefore, explanations will not include them, nor will atoms cause them.\n```\n%!mute punish(P) : vip_person(P).\n```\n\n## Usage\n\n```\nusage: xclingo [-h] [--version] [--only-translate | --only-translate-annotations | --only-explanation-atoms] [--auto-tracing {none,facts,all}] [-n N N] infiles [infiles ...]\n\nTool for explaining (and debugging) ASP programs\n\npositional arguments:\n  infiles               ASP program\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --version             Prints the version and exists.\n  --only-translate      Prints the internal translation and exits.\n  --only-translate-annotations\n                        Prints the internal translation and exits.\n  --only-explanation-atoms\n                        Prints the atoms used by the explainer to build the explanations.\n  --auto-tracing {none,facts,all}\n                        Automatically creates traces for the rules of the program. Default: none.\n  -n N N                Number of answer sets and number of desired explanations.\n```\n\n## Differences with respect to the previous version\n\n### Choice rules and pooling\nThey are now supported.\n```\nn(1..20).\nswitch(s1;s2;s3;s4).\n2{num(N):n(N)}4 :- n(N), N\u003e15.\n```\nThen can be traced with ```%!trace_rule``` annotations.\n\n### Multiple labels for the same atom\n\nIn the [previous version](https://github.com/bramucas/xclingo), multiple labels for the same atom lead to alternative explanations. In this version a single explanation is be produced in which labels are concatenated.\n\nAs an example, the following situation:\n```\n%!trace {\"% alcohol's level is above permitted (%)\",P,A} alcohol(P,A) : A\u003e40.\n%!trace {\"% was drunk\",P} alcohol(P,A) : A\u003e40.\n```\n\nwould lead to the following result in the previous version:\n```\n*\n  |__gabriel goes to prison\n  |  |__gabriel drove drunk\n  |  |  |__gabriel alcohol's level is 40\n\n*\n  |__gabriel goes to prison\n  |  |__gabriel drove drunk\n  |  |  |__gabriel was drunk\n```\n\nwhile the new version will produce:\n\n```\n*\n  |__gabriel goes to prison\n  |  |__gabriel drove drunk\n  |  |  |__gabriel alcohol's level is 40;gabriel was drunk\n```\n\n###\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramucas%2Fxclingo2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramucas%2Fxclingo2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramucas%2Fxclingo2/lists"}