This repository contains a partial implementation of a JaCaMo application, in which autonomous agents are able to operate on Linked Data in a distributed social network — and to manage personal data of a user.
├── src
│ ├── agt
│ │ ├── movie_manager.asl // agent program of the agent that stores in your pod the titles of movies you add to your watchlist
│ │ ├── wristband_manager.asl // agent program of the agent that stores in your pod information about your sleep and running trails
│ │ └── personal_assistant.asl // agent program of the agent that recommends to you activities based on your personal data
│ └── env
│ └── solid
│ └── Pod.java // artifact that can be used for interacting with an LDP container in a Solid pod
└── task.jcm // the configuration file of the JaCaMo application
Go to https://wiser-solid-xi.interactions.ics.unisg.ch/.account/login/password/register/and create a Solid Pod.
You get a WebId for this pod that you should edit its associated profile, using the foaf ontology with:
- your name
- your email
- the WebId of the people that you know from the group
WARNING: If you edit your WebID profile with a file that is not a proper Turtle document, you will lose access to your Pod. You can use a Turtle editor (e.g., https://ci.mines-stetienne.fr/teaching/semweb/turtle.html) to edit your profile and ensure that it satisfies the right Turtle syntax. If you have an issue, you should contact Jérémy and Alessandro for reinitializing the profile. To do so, please provide the last valid version of the profile.
Use a Pod editor, such as Penny to edit your Pod.
Install Comunica with:
npm install -g @comunica/query-sparql- Perform a comunica-sparql query to get the WebIds of the people you know.
Install Comunica for Link Traversal with:
npm install -g @comunica/query-sparql-link-traversal- Perform a comunica-sparql-link-traversal query to get all the names of the people you know directly or indirectly. Compare with the result of the request performed without link traversal.
- Use Penny to navigate and edit the Access Control List (ACL) of your Solid pod (https://wiser-solid-xi.interactions.ics.unisg.ch/your-pod-name/.acl). Update the
<#public>authorization rule based on the Web Access Control vocabulary so that agents can interact with your pod to read and/or write data:
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
<#public>
a acl:Authorization;
acl:agentClass foaf:Agent;
acl:accessTo <./>;
acl:mode acl:Read, acl:Write, acl:Control;
acl:default <./>.
Using Penny, setting the permissions can also be done without directly writing the Turtle file representing the ACL. This option is safer.
First, update line 24 in the JaCaMo configuration file task.jcm, so that the project uses your own Solid pod:
artifact pod: solid.Pod("https://wiser-solid-xi.interactions.ics.unisg.ch/your-pod-name")
Second, complete the tasks that follow to enable autonomous agents to interact with our group's Solid Community Server that implements the Solid protocol, based on the W3C Linked Data Platform (LDP) specification. The API of our group’s Solid Community Server is documented here.
With the completion of the tasks you should expect the following project behavior: The personal assistant (personal_assistant.asl) creates an LDP container in your pod, named "personal-data", and informs the other agents that a new container is available. As a result, the movie manager (movie_manager.asl) stores in the container the titles of movies you add to your watchlist (e.g. Matrix, Inseption etc.) within a file watchlist.txt. The wristband manager (wristband_manager.asl) stores in the container information about the number of hours you sleep every night (e.g. 6h, 7h, 5h etc. every 4000ms) within a file sleep.txt. Additionally, the wristband manager stores in the container information about the distance of the running trails that you follow every time you train (e.g. 3km, 5.5km, 5.5km etc. every 4000s) within a file trails.txt. Every 10000ms, the personal assistant reads the data available in the "personal-data" container to make movie or running trail suggestions based on the number of hours you slept last night.
Implement the method createContainer() of the Java class Pod that enables agents to to create an LDP container in your pod. You can check whether a container is already present in order not to create it again, which would cause additional containers that you do not need to be created.
- TIP: Creating containers based on the Solid Community Server documentation
- TIP: You should create a container as an empty resource, whose URL ends with "/".
- TIP: You can optionally check that your container is not present before creating the container.
Implement the method publishData() of the Java class Pod that enables agents to publish data (text/plain) to an LDP container in your pod.
- TIP: Creating resources (e.g. publishing data to a container) based on the Solid Community Server documentation
- TIP: use the provided method: createStringFromArray in
Pod.
Implement the method readData() of the Java class Pod that enables agents to read data (text/plain) from an LDP container in your pod.
- TIP: Retrieving resources (e.g. reading data from a container) based on the Solid Community Server documentation
- TIP: use the provided method: createArrayFromString in
Pod.
You can run the project directly in Visual Studio Code or from the command line with Gradle 7.4.
- In VSCode: Click on the Gradle Side Bar elephant icon, and navigate through
GRADLE PROJECTS>exercise-4>Tasks>jacamo>task. - On MacOS and Linux run the following command:
./gradlew task- On Windows run the following command:
gradle.bat task- On Intellij IDEA, you can run one of the command above (depending on your OS), using the "▶" symbol that appears on your IDE.