-
Notifications
You must be signed in to change notification settings - Fork 5
Use namespace builder library #260
base: master
Are you sure you want to change the base?
Conversation
if (request.dataset.match(id, schema.name).size === 0) { | ||
throw new createHttpError.BadRequest(`Article must have at least one ${termToString(schema.name)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hydra: hydra().value, | ||
owl: owl().value, | ||
rdf: rdf().value, | ||
schema: schema().value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tpluscode Maybe we could add a base
or root
function to get the base IRI as a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this, and I'm not sure. Do you find yourself often in need of the base URI as string?
It would have to have a unique name, like schema.__base
. Unless I duplicated the prefixes
export and generated a default export
import prefixes from '@tpluscode/rdf-ns-builders'
app.use(jsonld({
...prefixes
}))
And neither is great IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you find yourself often in need of the base URI as string?
Only case I think, as this is outside RDF/JS.
You're right, neither of those is great...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened zazuko/rdf-vocabularies#55 to try and use a library rather than hard-coding them here.
Adds
@tpluscode/rdf-ns-builders
, which adds extends the namespace builder with types for known properties. This will help avoid typos.I'll leave this in draft until the library is a little more stable, and the@zazuko/rdf-vocabularies
dependency is removed (as it's huge and not needed at runtime).