1 requete
```
const rawResponse = await fetch(this.params.source, {
method: 'POST',
headers: {
'Accept': 'application/ld+json',
// 'Content-Type': 'application/json'
},
body: this.params.query
});
const triples = await rawResponse.json();
console.log(triples);
```
une fois que tu recupéré tes triples
````
triples.forEach((t, i) => {
let n_sub = {id: t.subject.value, label: app.localName(t.subject.value), title: t.subject.value}
app.addNodeIfNotExist(n_sub)
let n_obj = {id: t.object.value, label: app.localName(t.object.value), title: t.object.value}
app.addNodeIfNotExist(n_obj)
let edge = {from: n_sub.id, to: n_obj.id, label: app.localName(t.predicate.value), title: t.predicate.value}
/* app.network.body.data.edges.update(edge)*/
this.addEdgeIfNotExist(edge)
this.network.fit();
});
```
Aucun commentaire:
Enregistrer un commentaire