Skip to content

Commit

Permalink
Merge branch 'up-vocabs' into docker-node-20
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovicm67 committed Dec 8, 2023
2 parents 33603a3 + a574204 commit bef78fb
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
4 changes: 4 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ router.get('/prefix', (req, res) => {
})
})

router.get('/prefixes', (req, res) => {
res.json(Object.fromEntries(Object.entries(prefixMetadata).map(([prefix, value]) => [prefix, value.namespace])))
})

router.get('/summary', (req, res) => {
res.json(summary)
})
Expand Down
2 changes: 1 addition & 1 deletion components/CurlExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="line">
curl --silent \
<br />
<a :href="url" target="_blank">"${DOMAIN}{{ path }}<span class="hl">?{{ query }}</span>"</a> \
<a :href="url" target="_blank">"${DOMAIN}{{ path }}<span v-if="query" class="hl">?{{ query }}</span>"</a> \
<br />
| jq .
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/PageFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<span class="part">
Copyright
<a href="https://zazuko.com">Zazuko</a>
GmbH © 2022
GmbH © 2023
</span>
</div>
</div>
Expand Down
30 changes: 29 additions & 1 deletion pages/api.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
RDF Prefix Resolve API
</h1>

<p>We provide two API endpoints:</p>
<p>We provide the following API endpoints:</p>

<ul>
<li><a href="#expand-endpoint"><code>/api/v1/expand?q=…</code></a></li>
<li><a href="#shrink-endpoint"><code>/api/v1/shrink?q=…</code></a></li>
<li><a href="#autocomplete-endpoint"><code>/api/v1/autocomplete?q=…</code></a></li>
<li><a href="#prefixes"><code>/api/v1/prefixes</code></a></li>
</ul>

<h2 id="expand-endpoint">
Expand Down Expand Up @@ -143,6 +144,33 @@
:url="apiPath('/api/v1/autocomplete', {q: 'rdfs:', type: 'rdf:Property' })"
:result="['rdfs:comment','rdfs:domain','rdfs:isDefinedBy','rdfs:label','']" />

<h2 id="prefixes">
Prefixes
</h2>

<p>
This endpoint returns the list of all known prefixes.
This can be used to implement a prefix selector.
</p>

<h3>Examples</h3>

<p>
How to get the list of all known prefixes:
</p>
<curl-example
:url="apiPath('/api/v1/prefixes')"
:result="{
'acl':'http://www.w3.org/ns/auth/acl#',
'as':'https://www.w3.org/ns/activitystreams#',
'bibo':'http://purl.org/ontology/bibo/',
'cc':'http://creativecommons.org/ns#',
'cert':'http://www.w3.org/ns/auth/cert#',
'cnt':'http://www.w3.org/2011/content#',
'constant':'http://qudt.org/vocab/constant/',
'': ''
}" />

</div>
</section>
</div>
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/integration/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,13 @@ describe('/api/v1', () => {
})
})
})
describe('prefixes', () => {
it('get a list of prefixes', () => {
cy.request('/api/v1/prefixes').then((response) => {
expect(response.status).to.eq(200)
expect(Object.entries(response.body).length).to.be.greaterThan(0)
})
})
})
})
})

0 comments on commit bef78fb

Please sign in to comment.