-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(webapi): Add script for loading of a minimal set of data (#1267)
resolves #1266
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/expect | ||
|
||
set timeout 120 | ||
spawn openrdf-console/bin/console.sh --force --echo --serverURL [lindex $argv 0] | ||
set prompt "> " | ||
expect $prompt | ||
send "open knora-test .\r" | ||
expect $prompt | ||
send "load ../../knora-ontologies/knora-base.ttl into http://www.knora.org/ontology/knora-base .\r" | ||
expect $prompt | ||
send "load ../../knora-ontologies/knora-admin.ttl into http://www.knora.org/ontology/knora-base .\r" | ||
expect $prompt | ||
send "load ../../knora-ontologies/standoff-onto.ttl into http://www.knora.org/ontology/standoff .\r" | ||
expect $prompt | ||
send "load ../../knora-ontologies/standoff-data.ttl into http://www.knora.org/data/standoff .\r" | ||
expect $prompt | ||
send "load ../../knora-ontologies/salsah-gui.ttl into http://www.knora.org/ontology/salsah-gui .\r" | ||
expect $prompt | ||
send "load ../_test_data/all_data/admin-data.ttl into http://www.knora.org/data/admin .\r" | ||
expect $prompt | ||
send "load ../_test_data/all_data/permissions-data.ttl into http://www.knora.org/data/permissions .\r" | ||
expect $prompt | ||
send "load ../_test_data/all_data/system-data.ttl into http://www.knora.org/data/0000/SystemProject .\r" | ||
expect $prompt | ||
|
||
send "close .\r" | ||
expect $prompt | ||
send "exit .\r" |
44 changes: 44 additions & 0 deletions
44
webapi/scripts/graphdb-se-docker-init-knora-test-minimal.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
GRAPHDB="http://localhost:7200" | ||
CONSOLE="openrdf-console/bin/console.sh --force --echo --serverURL $GRAPHDB" | ||
|
||
GREEN='\033[0;32m' | ||
RED='\033[0;31m' | ||
NO_COLOUR='\033[0m' | ||
DELIMITER="****************************************************************************************************\n* " | ||
|
||
printf "${GREEN}${DELIMITER}Deleting repository${NO_COLOUR}\n\n" | ||
|
||
cat graphdb-drop-knora-test-repository.ttl | $CONSOLE | ||
|
||
printf "\n${GREEN}${DELIMITER}Creating repository${NO_COLOUR}\n\n" | ||
|
||
sed -e 's@PIE_FILE@'"/graphdb/KnoraRules.pie"'@' graphdb-se-knora-test-repository-config.ttl.tmpl > graphdb-se-knora-test-repository-config.ttl | ||
|
||
curl -X POST -H "Content-Type:text/turtle" -T graphdb-se-knora-test-repository-config.ttl "$GRAPHDB/repositories/SYSTEM/rdf-graphs/service?graph=http://www.knora.org/config-test" | ||
|
||
curl -X POST -H "Content-Type:text/turtle" -d "<http://www.knora.org/config-test> a <http://www.openrdf.org/config/repository#RepositoryContext>." $GRAPHDB/repositories/SYSTEM/statements | ||
|
||
printf "${GREEN}Repository created.\n\n${DELIMITER}Creating Lucene Index${NO_COLOUR}\n\n" | ||
|
||
STATUS=$(curl -s -w '%{http_code}' -S -X POST --data-urlencode 'update@./graphdb-knora-index-create.rq' $GRAPHDB/repositories/knora-test/statements) | ||
|
||
if [ "$STATUS" == "204" ] | ||
then | ||
printf "${GREEN}Lucene index built.${NO_COLOUR}\n\n" | ||
else | ||
printf "${RED}Building of Lucene index failed: ${STATUS}${NO_COLOUR}\n\n" | ||
fi | ||
|
||
printf "${GREEN}Loading Data${NO_COLOUR}\n\n" | ||
|
||
./graphdb-knora-test-data-minimal.expect $GRAPHDB | ||
|
||
printf "${GREEN}Data Loaded.\n\n${DELIMITER}Updating Lucene Index${NO_COLOUR}\n\n" | ||
|
||
curl -X POST --data-urlencode 'update@./graphdb-knora-index-update.rq' $GRAPHDB/repositories/knora-test/statements | ||
|
||
printf "${GREEN}Lucene Index Updated.${NO_COLOUR}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters