Open madmike200590 opened 4 years ago
For JSON, output, consider what clingo
does:
{
"Solver": "clingo version 5.4.0",
"Input": [
"examples/clingo/consequences/example.lp"
],
"Call": [
{
"Witnesses": [
{
"Value": [
"atom(q)", "atom(p(1))", "atom(p(2))", "atom(p(3))", "atom(p(4))", "atom(p(5))", "atom(p(6))", "atom(p(7))", "atom(p(8))", "atom(p(9))", "atom(p(10))"
]
}
]
}
],
"Result": "SATISFIABLE",
"Models": {
"Number": 1,
"More": "yes"
},
"Calls": 1,
"Time": {
"Total": 0.001,
"Solve": 0.000,
"Model": 0.000,
"Unsat": 0.000,
"CPU": 0.001
}
}
@madmike200590 you mentioned that you might want to use Jackson in order to implement JSON output. I'd like to bring JSR-353 to your attention. There are some words regarding Jackson in this article from 2018:
Many commercial products based on Java EE use either the Glassfish SI (Specification Implementation) directly, because apart from the JSON API itself, it has no dependencies on other parts of Java EE, Jakarta EE or Glassfish. So, it can be easily used on a desktop or in a "serverless" environment. That's why the JSR as an alternative to Jackson is also supported by several popular Java frameworks like Spring. While Jackson itself does not directly implement the JSON-P standard yet, there are both Jackson types for JSR 353, which practically anticipated both JSON standards in Java EE 8, as well as a JSR 353 implementation based on Jackson.
I am using Eclipse Yasson in other projects which is an implementation of JSON-P. It might be worth to consider using this library instead of Jackson.
Thanks for looking into this! Will take a look when I get to this issue
It would also be useful to have an out-of-the-box option that outputs answer sets as facts.
Clingo allows this with --outf=1
.
For example, the answer set
{ a, b }
would then be printed as
a. b.
Currently, in Alpha it is only possible to specify the separator between atoms, but you can neither get rid of the curly braces nor output something after the same atom. E.g., when using -sep ". "
, the output will be:
{ a. b }
In addition to current answer set printing facilities, the following additional features should be added to Alpha:
Code-wise, implement each of these as an implementation of the
AnswerSetFormatter
interface