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

Clear triplestore when running fedora-rebuild? #29

Open
sprater opened this issue Mar 28, 2018 · 9 comments
Open

Clear triplestore when running fedora-rebuild? #29

sprater opened this issue Mar 28, 2018 · 9 comments

Comments

@sprater
Copy link

sprater commented Mar 28, 2018

More of a question than an issue: Does trippi-sparql library clear the triplestore when running fedora-rebuild? If not, then consider this issue a feature request.

If that would require adding functionality to Fedora 3.x (which, looking at the fedora-rebuild source code, I think might be the case), I have some documentation I can contribute about what to do prior to rebuilding the triplestore through Fedora 3.x.

@ddavis
Copy link
Member

ddavis commented Mar 28, 2018

It does not. You have to handle that manually.

@ajs6f
Copy link
Member

ajs6f commented Mar 28, 2018

It does not. It leaves that entirely to the rebuilder utility. There is a good reason for that: there isn't any way for the client (e.g. Fedora or the rebuilder) to tell Trippi that "This is a rebuild." or "This is just normal operation." so that in order to do a feature like this, we would have to fork Fedora 3 and Trippi.

Ouch.

What's your triplestore? It's usually possible to clean out a triplestore with just a SPARQL Update command or two...

@sprater
Copy link
Author

sprater commented Mar 28, 2018

Yep, that's what I did. I'm using Fuseki (Apache Jena):

cat <<EOF > cleartriplestore.ru
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX fedora-model: <info:fedora/fedora-system:def/model#>
PREFIX fedora-view: <info:fedora/fedora-system:def/view#>
PREFIX fedora-rels-ext: <info:fedora/fedora-system:def/relations-external#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
 
WITH <info:edu.si.fedora#ri>
 
DELETE { ?s ?p ?o }
WHERE { ?s ?p ?o . }
EOF

$FUSEKI_BASE/bin/s-update --service=http://localhost:8080/fuseki/ri/update --file=cleartriplestore.ru

The DELETE statement could probably be made simpler (I used it originally for just clearing certain object triples, specifying the subject), and of course, the mechanics of how the SPARQL update will be executed will depend on the triplestore implementation. Might be good to call out in the documentation, though, that a fedora-rebuild of the resource index does NOT clear the triplestore beforehand, and that this will have to happen outside Fedora, prior to running fedora-rebuild.

@ajs6f
Copy link
Member

ajs6f commented Mar 28, 2018

  1. Yeah, if you want to toast the whole graph, no need for all that PREFIX preface and jazz, the whole update can be DROP GRAPH <info:edu.si.fedora#ri>, or if your triplestore supports SPARQL Graph Store (as a Jena committer, I'm glad to report that Fuseki does) it's just a single HTTP DELETE.

  2. Agreed about the desirability of documentation. PR? 🙏

@sprater
Copy link
Author

sprater commented Mar 28, 2018

will do!

@sprater
Copy link
Author

sprater commented Oct 25, 2018

I bet you thought I forgot. I did, but then I remembered. PR #30

@ddavis
Copy link
Member

ddavis commented Oct 25, 2018

I am working on Docker images for Fuseki and F3 (derived from ones started by @ajs6f) that includes working out how to rebuild likely by wiping out the persistent storage. No code changes needed I hope though the rebuilder no longer exits cleanly (completes but hangs without returning to the shell).

@sprater
Copy link
Author

sprater commented Oct 25, 2018

I've repeatedly had that problem since the 3.7.x branch -- it most likely predates your changes.

@ajs6f ajs6f mentioned this issue Oct 25, 2018
@ajs6f
Copy link
Member

ajs6f commented Oct 25, 2018

In regards Docker images @sprater, are you familiar with ISLE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants