Skip to content

Commit

Permalink
entity-renderer: query quads
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovicm67 committed Mar 13, 2024
1 parent 858daa9 commit 04c75de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/beige-lemons-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zazuko/trifid-entity-renderer": patch
---

Try to get quads from the store, in order to get the graph name.
6 changes: 5 additions & 1 deletion packages/entity-renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const factory = async (trifid) => {

// Check if the IRI exists in the dataset
const askQuery = isContainer ? mergedConfig.containerExistsQuery : mergedConfig.resourceExistsQuery
const exists = await query(replaceIriInQuery(askQuery, iri), { ask: true })
const exists = await query(replaceIriInQuery(askQuery, iri), { ask: true, headers: queryHeaders })
if (!exists) {
return reply.callNotFound()
}
Expand Down Expand Up @@ -200,6 +200,10 @@ const factory = async (trifid) => {
const entity = await query(replaceIriInQuery(describeQuery, iri), {
ask: false,
rewriteResponse,
headers: {
...queryHeaders,
accept: 'application/n-quads',
},
})
const entityContentType = entity.contentType || 'application/n-triples'
const entityStream = entity.response
Expand Down

0 comments on commit 04c75de

Please sign in to comment.