-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API and Modularization #108
Comments
@lorenzleutgeb Has there been any implementation work on that yet? Since I'm currently working on a number of projects that use (parts of) Alpha as a dependency (e.g. curriculator), I'd be highly motivated to move this forward, but since the issue is assigned to you, wanted to make sure I'm not duplicating stuff that might already be in progress.. |
I once attempted to split up the code, but that branch is hopelessly outdated. I took the liberty to reassign it to you. Please take some time to rethink whether the modules I suggested, i.e. "core", "api", "cli", still make sense, and let's talk if you think that a different way of splitting would be more beneficial. |
Thanks! Since we've currently got a few bigger PRs waiting to be merged, I can't do much right now anyway.. (as the splitting will probably wreak havoc on file histories). The split I was thinking about would roughly be
The reason I'd split out the parser is that it would open up possibilities for metaprogramming (e.g. custom syntax constructs that can be rewritten to standard ASP) without having to depend on the full solver every time |
Sounds good, except that I don't get why parsing/core would depend on api? I would expect it to be the other way round. |
If API depended on core (and possibly parsing) you'd always have the full solver implementation in your classpath, regardless if you're actually using it. For example, let's assume we have some ReST-Webapp that uses Alpha for some kind of business logic. The app consists of modules |
Right. Sorry. |
Resolves #108. See #300 for further suggestions to improve code quality. Summary: - New Gradle modules. - Hide implementations, provide API. - Move CLI to separate module, consuming API. Co-authored-by: Michael Langowski <[email protected]> Co-authored-by: Antonius Weinzierl <[email protected]>
I have been thinking about implementing an API for Alpha for some time. With the introduction of the
Alpha
class that acts as a facade for the whole system I made a first step. There's still a long way to go if the API should be taken seriously by application developers.Prototyping Applications
I identified at least two applications that might use the API and act as guides in the API design:
(first I have to wrap my head around higher order predicates and eliminate them)clingo
is here; pointed out to me by @lukeswissman)Modularization
In order to provide a smooth API, I think that we should modularize Alpha as follows:
alpha-core
: Contains grounder(s) and solver(s), but no main entry point. Depends onalpha-api
.alpha-api
: Contains glue code that allows instantiation of the Alpha system with given parameters, run it, and collect solutions. This includes a specification of all I/O, so we needProgram
s to go in andAnswerSet
s to go out, these would have to move to some packageac.at.kt.tuwien.alpha.api
or similar that resides in this module.Depends on.alpha-core
alpha-cli
: Contains a main entry point that fiddles with arguments in order to run Alpha viaalpha-api
.Further down the line we might want to extend this scheme, for example by writing a wrapper that integrates Alpha with Clojure. Such a wrapper would then depend on
alpha-api
as well.While it might seem strange that these modules all depend on each other in a trivial fashion, we would have the following side-effects:
alpha-api
package in a way that it is suitable for a large range of ASP systems. Instead ofalpha-core
one could then depend onevenbettersolver
which implements everything declared inalpha-api
. It is conceivable to wrapclasp
, so applications could switch out implementations.Related Projects
asp4j
uses Annotationsnet.sf.tweety.lp.asp.solver.AspInterface
declares an interface for solversCourse of Action
asp4j
can be re-used/forked/adopted.The text was updated successfully, but these errors were encountered: