linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
564 stars 143 forks source link

Impossible to set a namespace prefix in serializer #536

Open pduchesne opened 2 years ago

pduchesne commented 2 years ago

It is not possible to set namespace prefixes in the serializer; only to suggest them, meaning they cannot override the default prefixes.

As a generic RDF lib, it should be possible to forcefully set any namespace prefix.

As a concrete example, I have a usecase where the schema.org URIs are expressed in the HTTPS scheme. The default schema prefix targets http://schema.org . I cannot redefine it.

pduchesne commented 2 years ago

Here's a PR for this : https://github.com/linkeddata/rdflib.js/pull/534

TallTed commented 2 years ago

Note that the default prefix now targets http://schema.org/ (note terminating slash), not http://schema.org, and the new target you want for them should be https://schema.org/ (again, terminating slash). I cannot make substantive comment on the PR.

pduchesne commented 2 years ago

Indeed, typo on my part.

bourgeoa commented 2 years ago

@timbl does seem a good idea.

jeff-zucker commented 2 years ago

@timbl Related issue : solid-ui demands http://www.w3.org/ns/ui and will fail with https.

timbl commented 2 years ago

Well the policy in Solid has so far to leave all the historical namespaces at http://www.w3.org/ and Dublin Core etc http: space, and just to actually fetch the ontology from https: space, either by being redirected at fetch time, or by having code which just adds the s before the fetch for any ontology. This has worked fine, and all the RDF terms match correctly. Yes, in RDF if you add an 's' to the identifier then it is a different thing and won't work. So don't! :-)

The same had applied to schema.org .

But now schema.org is changing its human-readable documentation at least to use https . This breaks everything, as it fills the world with a mixture of the two, which will break code and query and data. We need to decide what to do. For example,

rdflib already has some canonicalization code, for example when one uri is redirected 'moved' to another, just using the second.

If we added the ability to switch out old versions of terms for new ones, them also we could use it for moving between old and new ontologies: when you patched a file, the server could switch out the old terms in it. Could be useful. But RDF purists would maybe not like it at all, and systems which did not canonicalize internally would have to be protected by having canonicalizing adapters upstream of them.

Need to move this to a different issue.