Multiple values with same subject and predicate

Suppose I want to create the following document:

<s1> <p1> <o1> .
<s1> <p1> <o2> .

I know TripleDoc has a distinction between https://vincenttunru.gitlab.io/tripledoc/docs/api/interfaces/triplesubject.html#addref and https://vincenttunru.gitlab.io/tripledoc/docs/api/interfaces/triplesubject.html#setref
so I would use addRef in this case, and call it twice.

Is something like that also possible in LDFlex?

1 Like

Although I haven’t explicitly tried it, peeking at my cheatsheet I think the following would work:

import data from "@solid/query-ldflex";
import { namedNode } from "@rdfjs/data-model";

const subject = data['s1'];
await subject['p1'].add(namedNode('o1'));
await subject['p1'].add(namedNode('o2'));

Note that that would perform two HTTP requests, one for every property.

(I’m assuming that s1, p1 and o1 and o2 would be replaced by actual URLs.)

3 Likes