These are chat archives for lawlesst/vivo-vagrant

5th
Oct 2015
Darren Weber
@darrenleeweber
Oct 05 2015 20:24
Anyone listening?
Is there a CLI util or simple command for wiping the db?
Unless it's already documented somewhere, it could be handy to have it in the README.md
@lawlesst - heads up Ted ...
Darren Weber
@darrenleeweber
Oct 05 2015 20:41
The SPARQL UI will not accept a 'DELETE * WHERE { ?s ?p ?o }'
Ted Lawless
@lawlesst
Oct 05 2015 22:04
@darrenleeweber this would be good to add to the add to the README.
The SPARQL UI accepts only read queries - not UPDATE or DELETE.
Your most direct route is probably to drop the MySQL database and recreate it.
Another option moving forward is to use named graphs for logical groups of entities - people, publications, organizations - and then just remove or empty the named graph via the UI when you want to. As the named graphs grow in size, though, deletes can be slow.
Darren Weber
@darrenleeweber
Oct 05 2015 22:17
Where is the db schema defined in the vagrant installation? If it's a schema.sql file and the MySQL root user and password are available, it should be possible to do this from the ssh command line, right? Would it be necessary to take down the tomcat server/container before and after?
Ted Lawless
@lawlesst
Oct 05 2015 22:21
Jena handles creating the DB schema so it's not defined anywhere in the Vagrant installation. I would stop Tomcat, drop the VIVO db, recreate it, and start tomcat.
Here is the line in the install that creates the db: https://github.com/lawlesst/vivo-vagrant/blob/master/provision/vivo/install.sh#L27
Darren Weber
@darrenleeweber
Oct 05 2015 22:35
Great, thanks! If the follow bash script were placed into the 'provision' directory, it could be called with 'vagrant ssh -c "cd; ./provision/reset_vivo_db.sh"' or something like that...
This message was deleted
Darren Weber
@darrenleeweber
Oct 05 2015 22:41
This message was deleted
cd
sudo service tomcat7 stop 
VIVO_DATABASE=$(grep 'VIVO_DATABASE=' provision/vivo/install.sh | sed s/VIVO.*=// )
mysql -uroot -pvivo -e "DROP DATABASE IF EXISTS $VIVO_DATABASE;"
mysql -uroot -pvivo -e "CREATE DATABASE $VIVO_DATABASE DEFAULT CHARACTER SET utf8;"
sudo service tomcat7 start
Darren Weber
@darrenleeweber
Oct 05 2015 22:50
Created ticket for this at lawlesst/vivo-vagrant#24
Ted Lawless
@lawlesst
Oct 05 2015 23:09
Thanks for the script. I was updating in the process of updating the README but I'l add this to the repo and link to it.