@ -239,3 +239,155 @@ LDO uses ShEx "Shapes" as schemas to describe how data looks in an application.
npx @ldobjects/cli init
```
This command will install required libraries and creates two folders: the `.shapes` folder and the `.ldo` folder.
If you look in the `.shapes` folder, you'll find a default file called `foafProfile.shex`. This is a ShEx shape that defines a very simplified profile object.
If you look in the `.ldo` folder, you'll files generated from the shape. For example, `foafProfile.typings.ts` contains the Typescript typings associated with the shape, `foafProfile.context.ts` conatians a JSON-LD context for the shape, and `foafProfile.shapeTypes.ts` contains a shape type, a special object that groups all the information for a shape together. We'll be using ShapeTypes later in this tutorial.
For our project, we want to use a Solid Profile, so let's delete the "foafProfile" ShEx shape and make a new file for our Solid profile.
```bash
rm ./src/.shapes/foafProfile.shex
touch ./src/.shapes/solidProfile.shex
```
Now, let's create a shape for the Solid Profile. The code for a Solid profile is listed below, but you can learn more about creating ShEx shapes of your own on the [ShEx website](https://shex.io)
// rdfs:comment "The level of access provided to this origin" ;
acl:origin IRI
// rdfs:comment "The app origin the user trusts"
}
srs:RSAPublicKeyShape {
cert:modulus xsd:string
// rdfs:comment "RSA Modulus" ;
cert:exponent xsd:integer
// rdfs:comment "RSA Exponent" ;
}
```
Finally, we can run the command below to build the Solid Profile shape.
```bash
npm run build:ldo
```
You'll notice that the `.ldo` folder contains information about a _solid_ profile.
## 6. Fetching and using information
Let's go back to the header we built. Yeah it's cool, but if your profile includes a name, wouldn't it be better if it said, "You are logged in as Jackson Morgan" rather than "You are logged in with the webId https://solidweb.me/jackson3/profile/card#me?"
Well, we can fix that by retrieving the user's profile document and using the data from it.