Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vocabularies #96

Merged
merged 12 commits into from
Dec 9, 2023
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# First step: build the assets
FROM docker.io/library/node:16-alpine AS builder
FROM docker.io/library/node:20-alpine AS builder

ARG VERSION
ARG COMMIT
Expand Down Expand Up @@ -27,12 +27,12 @@ RUN npm run build-data
RUN npm run build:modern

# Second step: only install runtime dependencies
FROM docker.io/library/node:16-alpine
FROM docker.io/library/node:20-alpine

WORKDIR /src

ADD . .
RUN npm ci --production --no-optional
RUN npm ci --omit=dev --no-optional

# Copy the built assets from the first step
COPY --from=builder /src/.nuxt/ ./.nuxt
Expand Down
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
29,856 changes: 6,392 additions & 23,464 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@nuxtjs/axios": "^5.13.6",
"@rdfjs/data-model": "^1.3.4",
"@rdfjs/to-ntriples": "^2",
"@zazuko/vocabularies": "^2.0.0",
"@zazuko/vocabularies": "^2.0.3",
"debug": "^4.3.4",
"express": "^4.18.1",
"express-preconditions": "^1.0.5",
Expand All @@ -46,7 +46,6 @@
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-unicorn": "^35.0.0",
"eslint-plugin-vue": "^7.20.0",
"fibers": "^5.0.3",
"nuxt": "^2.16.3",
"sass": "^1.55.0",
"sass-loader": "^10.3.1"
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)
})
})
})
})
})