Skip to content

Commit

Permalink
refactor free-text tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lisp committed Jun 25, 2024
1 parent e7589e0 commit 4fdd950
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 276 deletions.
61 changes: 61 additions & 0 deletions extensions/sparql-protocol/free-text/simple-free-text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /bin/bash
set -e

## nb. these tests will fail while the implementation is in flux

# exercise a string to term identifier index
# there are two text index forms
# - a simple text index for just one string identifier
# - a compound text index for materialized view parameters
#
# this script tests an index of the first form, the simple text index.
# the intent of the simple text index is to provide the equivalent
# of a filter, but without iterative over supplied terms.
# instead of passing a sequence of solutions through a filter, as in
#
# select $string where { ?s ?p $string . filter(isMatchingString($string)) }
#
# (nb, the isMatchingString symbolizes the test, it does not actually exist.)
#
# these tests work with the test/foaf repository to exercise both index forms:
#
# for the simple index
# - replace the content of the "test/test" repository with text
# for this use the label statements from the stw dataset (https://zbw.eu/stw/version/latest/download/about)
# - execute a request which uses the text index.
# this will create it
# - drop the index

echo "${0} import text dataset" > ${ECHO_OUTPUT}

curl_graph_store_update -X PUT \
-H "Content-Type: application/n-quads" \
-H "Accept: application/n-quads" \
--account "test" \
--repository "test" \
--data-binary @stw-label.nt

echo "${0} run query" > ${ECHO_OUTPUT}

curl_sparql_request -X POST \
-H "Content-Type: application/sparql-query" \
-H "Accept: application/sparql-results+json" \
--account "test" \
--repository "test" \
--data-binary @- <<EOF \
| fgrep -c Vorsorge | fgrep -q 6
SELECT ?lbl
WHERE { ( ?lbl ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('Vorsorg:*') . }
EOF


echo "${0} drop text index" > ${ECHO_OUTPUT}

${CURL} -X DELETE "${STORE_URL}/system/accounts/test/repositories/test/text-index" \
-H "Authorization: Bearer ${STORE_TOKEN}" \
-H "Accept: application/json" \
| fgrep -s -q DELETE


echo "${0} complete" > ${ECHO_OUTPUT}

275 changes: 0 additions & 275 deletions extensions/sparql-protocol/views/free-text.sh

This file was deleted.

5 changes: 4 additions & 1 deletion run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ date
initialize_all_repositories
# problems with the repository content
# run extensions/git
run extensions/admin/revisions
# 20230814 confuses the curl_sparql_request operator
#run extensions/admin/revisions
run extensions/graph-store-protocol
run extensions/sparql-protocol/collation
run extensions/sparql-protocol/meta-data
run extensions/sparql-protocol/describe
run extensions/sparql-protocol/free-text
run extensions/sparql-protocol/parameters
run extensions/sparql-protocol/provenance
run extensions/sparql-protocol/revisions
run extensions/sparql-protocol/sparql-operators
run extensions/quality-of-service
# some translations depend on gensym state
# run extensions/sparql-protocol/sql
run extensions/sparql-protocol/temporal-data
Expand Down

0 comments on commit 4fdd950

Please sign in to comment.