readme.md 3.17 KB
Newer Older
Siebers, Michael's avatar
Siebers, Michael committed
1
# Dare2Del Demonstrator – WebAPI
Sebastian Seufert's avatar
Sebastian Seufert committed
2

Siebers, Michael's avatar
Siebers, Michael committed
3 4
The Dare2Del Demonstrator identifies irrelevant files in the user's file system and suggests to delete them. This project provides the required reasoning facilities as Service over HTTP. This component holds all parts required to answer whether some file is irrelevant and to explain why this is the case. 
Basically, the core logic is encapsulated into a web-based API that receives and responds JSON objects:
Sebastian Seufert's avatar
Sebastian Seufert committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


```mermaid
sequenceDiagram
    participant Client
    
    participant API
    Client->>API: HTTP Request
    API-->>Theory: Query
    loop Rules & Learning
        Theory-->>Theory: Irrelevancy / Explanation
    end
    Theory-->>API: Query Results
    API->>Client: HTTP Response
```

Siebers, Michael's avatar
Siebers, Michael committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
## Running the server
The server component is written in Prolog. Running the server requires [SWI-Prolog](https://www.swi-prolog.org/) in version 8.2.2 or above.

To start the server, clone the git repository.

```bash
    git clone git@gitlab.rz.uni-bamberg.de:cogsys/dare2del/demonstrator.git demonstrator-webapi
    cd demonstrator-webapi
```

Then start the server using SWI-Prolog, optionally with a custom port (default is 4444).

```bash
    swipl run.pl
    swipl run.pl --port 4444
```

38
After some informational messages (starting with `%`) you will see the interactive prolog interpreter. Then the server is running and accepting requests at localhost:PORT as given in the last informational message.
Siebers, Michael's avatar
Siebers, Michael committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

```
    % Loading explanation templates from file irrelevance_templates:
    %     file/1
    %     abs_path/2
    %     file_size/2
    %     directory/1
    %     in_directory/2
    %     in_directory_recursive/2
    %     in_directory_recursive/2
    %     item_name/2
    %     creation_time/2
    %     change_time/2
    %     modification_time/2
    %     access_time/2
    %     newer/2
    %     same_directory/2
    % Started server at http://localhost:4444/

    Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.2)
    SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
    Please run ?- license. for legal details.

    For online help and background, visit https://www.swi-prolog.org
    For built-in help, use ?- help(Topic). or ?- apropos(Word).

    ?-
```

Siebers, Michael's avatar
Siebers, Michael committed
68
You may freely use the Prolog interpreter while the server is running. To stop the server enter `stop_server.`
Siebers, Michael's avatar
Siebers, Michael committed
69 70

## Documentation
71
[^local]: Links to localhost in section _Documentation_ assume that you started the server without explicit port option. If you started the server under another port, please replace `4444` accordingly.
Sebastian Seufert's avatar
Sebastian Seufert committed
72

73
The Dare2Del Demonstrator WebAPI component serves its own documentation. Unless turned of (see [Admin Guide](http://localhost:4444/doc/admin_guide.html)[^local]), the documentation may be accessed under [/doc](http://localhost:4444/doc)[^local]. Notably the following documents are available:
Sebastian Seufert's avatar
Sebastian Seufert committed
74

Siebers, Michael's avatar
Siebers, Michael committed
75 76 77
1. An [User Guide](http://localhost:4444/doc/user_guide.html)[^local]
1. A [detailed description of the API endpoints](http://localhost:4444/doc/api_endpoints.html)[^local]
1. An [Admin Guide](http://localhost:4444/doc/admin_guide.html)[^local]
78
1. A [file-by-file documentation of Prolog predicates](http://localhost:4444/doc/pldoc/doc/_API_/index.html)[^local]
Sebastian Seufert's avatar
moving  
Sebastian Seufert committed
79

Siebers, Michael's avatar
Siebers, Michael committed
80
---