diff --git a/db-server/bin/get-value-of-rdf-property.py b/db-server/bin/get-value-of-rdf-property.py index 0d69a7bd..9f9a8c4e 100755 --- a/db-server/bin/get-value-of-rdf-property.py +++ b/db-server/bin/get-value-of-rdf-property.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -import sys +import sys from rdflib import Graph, URIRef def log(message): @@ -50,16 +50,16 @@ def main(): file_path = sys.argv[1] rdf_property = URIRef(sys.argv[2]) - + g = load_rdf_graph(file_path) - + # Query for subjects with the specified property query = f""" - SELECT ?subject ?value + SELECT ?subject ?value WHERE {{ ?subject <{rdf_property}> ?value. - }} - """ + }} + """ results = g.query(query) check_property_has_single_value(results, rdf_property) @@ -68,6 +68,6 @@ def main(): subject, value = row print(f"{value}") -if __name__ == "__main__": +if __name__ == "__main__": main() diff --git a/db-server/bin/repo-init.sh b/db-server/bin/repo-init.sh index 94c36571..127003d6 100755 --- a/db-server/bin/repo-init.sh +++ b/db-server/bin/repo-init.sh @@ -15,12 +15,12 @@ echo "INFO: Running initializer for Record Manager repositories ..." echo "INFO: Waiting for GraphDB to start up..." sleep 15s -ls ${SOURCE_DIR}/*-config.ttl | while read REPO_CONFIG_FILE; do - +ls ${SOURCE_DIR}/*-config.ttl | while read REPO_CONFIG_FILE; do + REPO_NAME=`$SCRIPT_DIR/get-value-of-rdf-property.py $REPO_CONFIG_FILE 'http://www.openrdf.org/config/repository#repositoryID'` if [ -z "$REPO_NAME" ]; then - echo "ERROR: Could not parse repository name from file $REPO_CONFIG_FILE" + echo "ERROR: Could not parse repository name from file $REPO_CONFIG_FILE" exit 1 fi