readme.md 2.54 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 38 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 68 69 70 71
## 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
```

After some informational messages 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.

```
    % 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).

    ?-
```

You may freely use the Prolog interpreter while the server is running to stop the server enter `stop_server.`


## Documentation
Sebastian Seufert's avatar
Sebastian Seufert committed
72 73 74 75 76 77 78 79

Ongoing. Please check the [Wiki](https://gitlab.rz.uni-bamberg.de/cogsys/dare2del/demonstrator/-/wikis/home) in the meantime.

Details that might change:

* Minor details in the JSON schemata
* HTTP status codes 
* Error and Exception Handling
Sebastian Seufert's avatar
moving  
Sebastian Seufert committed
80 81 82