Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Alex Latipov commited on
Commit ·
b9f7267
1
Parent(s): 434cda2
Fix HF corporate graph count parsing
Browse files
scripts/hf_load_corporate_graph.sh
CHANGED
|
@@ -48,16 +48,19 @@ wait_for_virtuoso() {
|
|
| 48 |
}
|
| 49 |
|
| 50 |
graph_count() {
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
import re
|
| 55 |
-
import sys
|
| 56 |
|
| 57 |
-
text =
|
| 58 |
-
matches = re.findall(r
|
| 59 |
print(matches[-1] if matches else "0")
|
| 60 |
-
|
| 61 |
}
|
| 62 |
|
| 63 |
echo "Waiting for Virtuoso before loading corporate graph ..."
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
graph_count() {
|
| 51 |
+
local raw
|
| 52 |
+
raw="$(
|
| 53 |
+
printf "select count(*) from DB.DBA.RDF_QUAD where G = iri_to_id('%s');\n" "${GRAPH_URI}" \
|
| 54 |
+
| "$ISQL_BIN" "$ISQL_PORT" "$DBA_USER" "$DBA_PASSWORD" 2>/dev/null || true
|
| 55 |
+
)"
|
| 56 |
+
RAW_ISQL_OUTPUT="$raw" python3 -c '
|
| 57 |
+
import os
|
| 58 |
import re
|
|
|
|
| 59 |
|
| 60 |
+
text = os.environ.get("RAW_ISQL_OUTPUT", "")
|
| 61 |
+
matches = re.findall(r"^\s*(\d+)\s*$", text, flags=re.MULTILINE)
|
| 62 |
print(matches[-1] if matches else "0")
|
| 63 |
+
'
|
| 64 |
}
|
| 65 |
|
| 66 |
echo "Waiting for Virtuoso before loading corporate graph ..."
|