1

I'm trying to use the new embedded visualisation feature. I have an iframe that points to the graphdb server with url in the form :

http://localhost:7200/graphs-visualizations?uri=[...]&embedded

That works fine, but only for the default or previously selected repository. I can't find a way to select repositories without having to manually go to http://localhost:7200/

It seems that the repository selection is stored in a cookie, and that the X-GraphDB-Repository HTTP header is available, but nothing seems to work with iframes.

Is there a way to select repositories through url ? &repository= would be perfect.

More detail : we have an app with N "studies" backed with N repositories (with SPARQL queries), when a user selects a study, then an uri, we want to display a Visual Graph iframe. That works for the default or previously selected repository, but when she go to another study, we need a way to transparently update/select the repository in the Workbench app.

The only solution we see for the moment is to use a proxy that will set the cookie on the fly. But that seems overkill.

Placoplatr
  • 480
  • 2
  • 12

2 Answers2

2

GraphDB Workbench has two mechanisms to control the current selected repository. To illustrate this open Setup > Repositories pages and check:

(1) the "Connect repository" icon (the first option in the Repository list) controls the current selected repository by storing it in the local store. Check what is the difference between local storage and a cookie.

(2) the "Set as default repository" icon (the last option in the repository list) controls the default server repository. When a default repository is selected the server assumes to which repository to dispatch all HTTP requests like linked data publishing or like in your case the Visual Graph.

vassil_momtchev
  • 1,173
  • 5
  • 11
  • Thank you for your answer but I can't set local storage through an iframe either. I want to embed the visualisation in an app that maintain multiple repositories, so that the user don't have to manually go to another domain and manually select the repository. – Placoplatr May 28 '18 at 08:32
  • Do you want to expose multiple repositories controlled by the user with a single Visual Graph? – vassil_momtchev May 29 '18 at 05:11
  • We have an app with N "studies" backed with N repositories (with SPARQL queries), when a user selects a study, then an uri, we want to display a Visual Graph iframe. That works for the default selected repository, but when she go to another study, we need a way to transparently update/select the repository in the Workbench app. – Placoplatr May 30 '18 at 08:42
0

We finally decided to configure a nginx proxy workaround. It works well, but a ?repository= query feature is definitely missing.

map $arg_repository $repo_cookie {
  "~^(?<repo>[0-9a-f]{32})$" "com.ontotext.graphdb.repository7200=$repo";
}

server {
  listen 7200;
  server_name localhost;

  location / {
    add_header Set-Cookie $repo_cookie;
    proxy_pass http://graphdb:7200;
  }
}
Placoplatr
  • 480
  • 2
  • 12