Skip to content
/ clingo4j Public

Java interface for clingo a grounder and solver for logic programs.

License

Notifications You must be signed in to change notification settings

ajahl/clingo4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clingo4j

Build Status

Java API for the clingo

Clingo4j is distributed under the Apache License 2.0.

Maven

    <dependency>
        <groupId>org.lorislab.clingo4j</groupId>
        <artifactId>clingo4j</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </dependency>

Example

    Clingo.init("src/main/clingo");
    
    try (Clingo control = Clingo.create()) {
        System.out.println(control.getVersion());
        control.add("base", "b :- not a. a :- not b.");
        control.ground("base");
        
        try (SolveHandle handle = control.solve()) {
            for (Model model : handle)  {
                System.out.println("Model type: " + model.getType());
                for (Symbol atom : model.getSymbols()) {
                    System.out.println(atom);
                }
            }  
        } 
    } catch (ClingoException ex) {
       System.err.println(ex.getMessage());
    }

Build

mvn clean install

Rebuild the java c-api

java -jar src/main/jnaerator/jnaerator.jar src/main/jnaerator/c.jnaerator 

About

Java interface for clingo a grounder and solver for logic programs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published