# Create new vocabulary + Authorization

**URL:** <https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534>\
**Category:** General Discussion\
**Created:** [April 20, 2023, 11:43am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534 "2023-04-20T11:43:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 20, 2023, 11:43am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/1 "2023-04-20T11:43:32Z")

</div>

Hi guys,

My project is to build a solid server and then build a client app (with Node.js) to interact with that server. My server will store data with FHIR (a health data standard).

I reused the Community Solid Server and configured it for the server, but when I tried to build a client app, I had some questions:

1. FHIR data:

- The HL7 company provides a FHIR vocabulary, but I don’t know how to import and use it to create data, like some rdf-common-vocabularies.
- Are there any npm packages/projects that can help convert FHIR Json ↔ FHIR turtle (or just Json ↔ turtle)? I need it because when other client apps interact with my server, they usually use the JSON format, but Solid server must store RDF data.

1. I have seen many solid client apps, but in these apps, users have to enter a webID to give access to their data to client apps. However, I want users to just receive a notification and choose the option to accept/deny. Any suggestions?

Thank you so much, guys!

---

<div class="post-metadata">

**Author:** ![gaz009](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gaz009](https://forum.solidproject.org/u/gaz009)\
**Post date:** [April 20, 2023, 6:29pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/2 "2023-04-20T18:29:56Z")

</div>

As far as 1. goes, converting between JSON and Turtle is doable, though it’s more common to convert JSON-LD between turtle, using a library like this : [GitHub - frogcat/ttl2jsonld: Turtle to JSON-LD converter for node.js and browser, no library dependencies.](https://github.com/frogcat/ttl2jsonld) . There are also other tools published by SOLID community members. Also see here: [Vocabularies overview · Solid](https://solidproject.org/developers/vocabularies) to understand vocabularies better.

For 2. the SOLID spec is about _explicit consent_ of data sharing to allow applications to interact with user data. For just notifications, the notifications specification defines some ways to use notifications with static client credentials on the Inrupt server and the Community Solid server^6.0.0.

---

<div class="post-metadata">

**Author:** ![mrkvon](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/mrkvon/32/3768_2.png) [@mrkvon](https://forum.solidproject.org/u/mrkvon)\
**Post date:** [April 20, 2023, 11:08pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/3 "2023-04-20T23:08:47Z")

</div>

> [@tranbau](#):
>
> Are there any npm packages/projects that can help convert FHIR Json ↔ FHIR turtle (or just Json ↔ turtle)? I need it because when other client apps interact with my server, they usually use the JSON format, but Solid server must store RDF data.

Actually, according to Solid protocol, [you can get JSON-LD representation of RDF documents directly](https://solidproject.org/TR/protocol#resource-representations).

```ts
// in browser
// authenticated fetch
import { fetch } from '@inrupt/solid-client-authn-browser'

// within async function
// fetch document
const response = await fetch(uri, {
  headers: { accept: 'application/ld+json' } // this is important
})
// get body in JSON format
const data = await response.json()

```

I tried it with both NSS and CSS and it works.

Depending on your needs, also check out [LDO](https://www.npmjs.com/package/ldo) library. Especially useful if you build app that consumes RDF documents from Solid server. It allows you to read and write RDF data as TypeScript/JavaScript objects.

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 21, 2023, 8:01am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/4 "2023-04-21T08:01:17Z")

</div>

Thank you so much.  
I read Vocabularies overview :Solid and i found that [ArtifactGenerator](https://www.npmjs.com/package/@inrupt/artifact-generator) can hepl but when i try it follow the document, it doesn’t work, just creating a js file with some name definition and no classes or properties like: const OBELISK = {  
PREFIX: “obelisk”,  
NAMESPACE: \_NAMESPACE,  
PREFIX\_AND\_NAMESPACE: { “obelisk”: “[http://w3id.org/obelisk/](http://w3id.org/obelisk/)” },  
NS: \_NS,  
Have you ever try it and dit it work?

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 21, 2023, 8:02am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/5 "2023-04-21T08:02:13Z")

</div>

Thank you so much.  
I read Vocabularies overview :Solid and i found that [ArtifactGenerator](https://www.npmjs.com/package/@inrupt/artifact-generator) can hepl but when i try it follow the document, it doesn’t work, just creating a js file with some name definition and no classes or properties like: const OBELISK = {  
PREFIX: “obelisk”,  
NAMESPACE: \_NAMESPACE,  
PREFIX\_AND\_NAMESPACE: { “obelisk”: “[http://w3id.org/obelisk/”](http://w3id.org/obelisk/%E2%80%9D) },  
NS: \_NS,  
Have you ever try it and dit it work?

---

<div class="post-metadata">

**Author:** ![mrkvon](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/mrkvon/32/3768_2.png) [@mrkvon](https://forum.solidproject.org/u/mrkvon)\
**Post date:** [April 21, 2023, 9:58am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/6 "2023-04-21T09:58:06Z")

</div>

I tried that once, and [apparently succeeded](https://github.com/OpenHospitalityNetwork/ohn-solid/blob/main/src/vocabularies/HOSPEX.js), but i remember setting it up was a pain. ~~Are your source files in proper RDF+XML or Turtle or similar format? (i didn’t find a way to get that from [FHIR](https://www.hl7.org/fhir/))  
I’m guessing the vocabulary may also need to be in a single file. Hard to say.~~  
_edit: @Vincent [found that file](https://gitlab.com/vincenttunru/rdf-namespaces/-/merge_requests/8/diffs#f837a87ae89e9f4fb6b8cf89dc0ee4403e26e770_44_45). Very cool_

Hopefully, folks from Inrupt may be able to help you more here.

Or, for other solution, maybe @Vincent, who maintains [rdf-namespaces](https://www.npmjs.com/package/rdf-namespaces) would be able to share some of his magic. Or you can have a look into [the repo of the project](https://gitlab.com/vincenttunru/rdf-namespaces).

Anyways, this is a great question, and i’m hoping to find better solutions for custom vocabularies, too. Currently, [i setup the terms i need manually](https://github.com/OpenHospitalityNetwork/sleepy-bike-solid/blob/main/src/utils/rdf-namespaces.ts#L21-L27).

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [April 21, 2023, 11:26am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/7 "2023-04-21T11:26:53Z")

</div>

> [@mrkvon](#):
>
> Or, for other solution, maybe @Vincent, who maintains [rdf-namespaces](https://www.npmjs.com/package/rdf-namespaces) would be able to share some of his magic. Or you can have a look into [the repo of the project](https://gitlab.com/vincenttunru/rdf-namespaces).

Honestly, all it does is create convenience variables like:

```js
// foaf.js
export const knows = 'http://xmlns.com/foaf/0.1/knows';

```

You can then use it like:

```js
import { foaf } from "rdf-namespaces";

console.log(foaf.knows); // "http://xmlns.com/foaf/0.1/knows"

```

I don’t know of the specific use case here, but just using the URLs of the vocabulary directly as plain strings is probably fine too.

But in case it’s helpful, I [added the FHIR vocabulary](https://gitlab.com/vincenttunru/rdf-namespaces/-/merge_requests/8), so if you install rdf-namespaces 1.11.0 or higher, you can now do

```js
import { fhir } from "rdf-namespaces";

console.log(fhir.Medication); // "http://hl7.org/fhir/Medication"

```

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 21, 2023, 2:14pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/8 "2023-04-21T14:14:51Z")

</div>

"You can download the FHIR ontology from [https://www.hl7.org/fhir/downloads.html](https://www.hl7.org/fhir/downloads.html). However, it includes many ontologies, and my database is quite simple. Therefore, I think I can try to set it up manually, like you suggested. But if I do that, although it can help my users create and modify their data, I cannot specify which terms or resources the client apps use when they send their data, even if it’s FHIR data. Thank you again for your help

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 21, 2023, 2:15pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/9 "2023-04-21T14:15:51Z")

</div>

Thank you so much for your help! I will try it

---

<div class="post-metadata">

**Author:** ![mrkvon](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/mrkvon/32/3768_2.png) [@mrkvon](https://forum.solidproject.org/u/mrkvon)\
**Post date:** [April 21, 2023, 2:43pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/10 "2023-04-21T14:43:25Z")

</div>

Using `fhir` from `rdf-namespaces` solves the same problem as my manual method, only better. So please kindly ignore my solution in favor of `rdf-namespaces`. 🙂

If your needs go beyond exporting terms from the vocabulary, this won’t help much, unfortunately. If that’s the case, sorry for misunderstanding.

---

<div class="post-metadata">

**Author:** ![A\_A](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/a_a/32/786_2.png) [@A\_A](https://forum.solidproject.org/u/A_A)\
**Post date:** [April 21, 2023, 7:19pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/11 "2023-04-21T19:19:54Z")

</div>

> [@tranbau](#):
>
> I have seen many solid client apps, but in these apps, users have to enter a webID to give access to their data to client apps. However, I want users to just receive a notification and choose the option to accept/deny. Any suggestions?

It should be possible through an extra app that handles the requests. I could imagine that following works:

1. create a server-side application
2. give this application control access to the users pod(s)
3. create a UI where other users can send access requests to this application
4. somehow notify the user (not sure how exactly would be nice, but eg sending an email)
5. when the user accepts, the application grants the requested permissions

I think all of this would also work in a client-side app, but not sure how you would handle the notifications (step 4) in this case.

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 22, 2023, 10:33am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/12 "2023-04-22T10:33:52Z")

</div>

I’ll try.  
Thank you a lot

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 22, 2023, 10:35am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/13 "2023-04-22T10:35:26Z")

</div>

My team is trying to handle that  
Pls give me any idea if you have  
Thank you a lot

---

<div class="post-metadata">

**Author:** ![gaz009](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gaz009](https://forum.solidproject.org/u/gaz009)\
**Post date:** [April 22, 2023, 12:59pm UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/14 "2023-04-22T12:59:18Z")

</div>

For step 4, if you wanted to associate some contact information with a user’s pod, I’d just use something like a Twilio API to send requests, and then consume those responses and have the server-side application determine what to do depending on the response to a text message, but there are definitely other solutions

---

<div class="post-metadata">

**Author:** ![tranbau](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tranbau](https://forum.solidproject.org/u/tranbau)\
**Post date:** [April 24, 2023, 8:11am UTC](https://forum.solidproject.org/t/create-new-vocabulary-authorization/6534/15 "2023-04-24T08:11:17Z")

</div>

thank you so much
