Page MenuHomePhabricator

Allow the user to change the Blazegraph prefixes in the Wikibase Docker distribution
Open, MediumPublic

Description

As a user of the wikibase docker distribution I want to be able to use my own namespace prefixes in blazegraph so that the default wikidata namespace is not present in the query service

Event Timeline

So, everything is already configurable within blazegraph, I think it will just be a case of making sure the docs are there and linking to them from the image docs.

Gehel triaged this task as Medium priority.Sep 15 2020, 7:47 AM

For anyone running in this issue. The config can be done in the blazgraph container by editing this file:
ldf-config.json
Salut
D063520

I would rather recommend adding desired prefixes to prefixes.conf. Editing ldf-config.json didn't do anything for me.

Thank you for the pointer. Aftre checking I agree I was wrong. One has to set prefixes.conf like this:

PREFIX wd: https://YOURHOST/entity/

Then you also need to restart the docker container.

Merci : )
D063520

Seemingly this is already in the docs for the query service.
But these are probably not linked to in the best way from wikibase-docker
https://github.com/wikimedia/wikidata-query-rdf/blob/d52b50c57b739ca790726b4e72095ac3a06cfbbb/docs/configs.md#prefixesconf
For the default docker install as well better defaults could probably exist.

A bit more high level .... in my opinion there should be something like a global variable in the docker where one can set the public url. This should the automatically set for example:
$wgServer = "https://PUBLIC_URL"; (in the Mediawiki installation)
and also the prefix in the sparql endpoint .....
(and all the other places where it is needed)
just a suggestion ; )

I suggest using a text file that is parsed and added to both the blazegraph prefices.conf file, and baked into the query service GUI, format could be basic:

prefix rprv: <$baseurl/prop/reference/value/>
...

$baseurl could be taken from a global config.

This may be slightly off-topic, but what about the query ui and its RdfNamespaces.js definition?
Given that we might be changing wd, wdt etc prefixes using prefixes.conf, it might be confusing to have the UI add different prefixes to the query editor using the pin button (PrefixesAdd Standard Prefixes).

This could be a $baseurl and envsubst solution as @despens suggested, or alternatively, the script would have to load an object from a js or json file and deep merge it with the default configuration (RdfNamespaces.NAMESPACE_SHORTCUTS).

My own view: it's a bad idea to use wd:, wdt: etc. for things that are not Wikidata. Yes, they are stated to be "internal to Wikidata", and therefore could be internal to your own wiki. But practically, it is likely to be a source of confusion, especially if people try to do federated queries or otherwise interact with Wikidata.

One counterpoint: some tools like Cradle are set up to only use those prefixes - IMO this is a deficiency in the tools in question (which might include RDF dumping when not done by Wikidata, unless its own use of prefixes is configurable).

My own view: it's a bad idea to use wd:, wdt: etc. for things that are not Wikidata.

Makes absolute sense, but it seems that might require quite some work… from a quick, naive test, just changing the prefix that wdqs knows about for $domain/prod/direct for instance does not automatically make it work for auto-completion within the wdqs ui:
Unknown prefix: 'ldt:'.

Hi,

at the EU Knowledge Graph we overwrite the prefixes:

PREFIX wdata: https://linkedopendata.eu/wiki/Special:EntityData/
PREFIX wd: https://linkedopendata.eu/entity/
PREFIX wds: https://linkedopendata.eu/entity/statement/
PREFIX wdref: https://linkedopendata.eu/reference/
PREFIX wdv: https://linkedopendata.eu/value/
PREFIX wdt: https://linkedopendata.eu/prop/direct/
PREFIX p: https://linkedopendata.eu/prop/
PREFIX ps: https://linkedopendata.eu/prop/statement/
PREFIX psv: https://linkedopendata.eu/prop/statement/value/
PREFIX psn: https://linkedopendata.eu/prop/statement/value-normalized/
PREFIX pq: https://linkedopendata.eu/prop/qualifier/
PREFIX pqv: https://linkedopendata.eu/prop/qualifier/value/
PREFIX pqn: https://linkedopendata.eu/prop/qualifier/value-normalized/
PREFIX pr: https://linkedopendata.eu/prop/reference/
PREFIX prv: https://linkedopendata.eu/prop/reference/value/
PREFIX prn: https://linkedopendata.eu/prop/reference/value-normalized/
PREFIX wdno: https://linkedopendata.eu/prop/novalue/

I agree that this might create some confusion, but it is also helpful. When we write a SPARQL query then I know I can use wdt: ps: ect like in Wikidata. The Wikidata model is relatively complicated. If I need to get used to the new prefixes for every Wikibase instance, I think it gets complicated ...

Hope it helps to find a good decision on this : )

D063520